Aircraft repair pad pseudocode...

Aircraft repair pad pseudocode...

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Buggi
Posts: 875
Joined: 29 Apr 2005, 07:46

Aircraft repair pad pseudocode...

Post by Buggi »

Okay, so I've done a bit of research and I'm curious on how hard it would be to impliment aircraft repair pads.

So, I dug and dug. And thought of this logic string. First a boolean variable for a unit: "IsAirBase"

Now those units with repair pads this =1;
More specifically:

IsAirBase=1;

Now, for the planes themselves, something like the following

Code: Select all

AirplaneTookDamage()
{
   If (health < 50% && currentOrders == Patrolling)
   { 
     UtilizeRepairPad();
   }
}
Obviously 50% could be tweaked. I included Patrolling because if you're controlling a unit, or simply don't care if it's destroyed, the code will ignore you.

Now, in UtilizeRepairPad() you'd need a "FindFreePad()" returning the ID of a free pad, if none exist (ie none are built), return out and that's it. Or have a set number of attempts at a certain time distance. OR set up a queue for repairpads and auto-equalize them. This would be a matter of swapping ID's for the repair pad. For big pads, with 4 pads themselves, it gets interesting.

Now, the code to land the plane, begin repair and keep it there until it's finished would be tricky.

I noticed that repair pads are pretty consistant in their naming, using "pad" or "land" in the name of the object to be landed on. However someone with more modeling experience may be able to shed more light on this.

My next dig project is for resurection. I loved this ability and would love it again. :-)

-Buggi
SJ
Posts: 618
Joined: 13 Aug 2004, 17:13

Post by SJ »

Pseudocode is all nice but as you said you left out all the hard parts, so why not finish this one into real code first instead of looking at resurection?
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Post by Gnomre »

The pad pieces are really more defined in the script than the model. You could name it "OMGPLANELANDSHERE" and it'd work fine (well... assuming it accepts names that long, I forget if it does or not, but let's assume so for the sake of argument :P) as long as you defined the pieces right in the script. From memory, the single vertex "land" points are where the planes actually attach to the pad when landing, and the other piece names are just arbitrary.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

Apparently selecting a piece to as a landing pad is done with something like:

For a regular landing pad (1pad):

QueryLandingPad(piece1,piece2)
{
piece1=1;
piece2=1;
}

For a carrier (2pad):

QueryLandingPad(piece1,piece2)
{
piece1=1;
piece2=2;

padflip = !padflip;
if (padflip)
{
piece1=2;
piece2=1;
}
}

For switech's helper (4pad)

QueryLandingPad(Func_Var_1, Func_Var_2, Func_Var_3, Func_Var_4, Func_Var_5)
{
Func_Var_1 = 0;
Func_Var_2 = 1;
Func_Var_3 = 2;
Func_Var_4 = 3;
Func_Var_5 = 6;
Static_Var_3 = !Static_Var_3;
if( Static_Var_3 )
{
Func_Var_1 = 2;
Func_Var_2 = 1;
Func_Var_3 = 4;
Func_Var_4 = 3;
Func_Var_5 = 1;
Func_Var_1 = 5;
}
}

So apparently there's this query landing pad function which is used to define what are the landing pad, but I don't get how comes there's two parameters for both the 1 pad airpad and the 2 pad carriers. Oh, and 0 is the groundplate, 1 the piece that comes just after, 2 the next piece, etc...


Also, don't forget that the IsAirBase=1; in the fbi also makes transport let the units they transport fire.
User avatar
Buggi
Posts: 875
Joined: 29 Apr 2005, 07:46

Post by Buggi »

Ahhh so the main functionality of the pad is in the COB script. So that would have to be changed in the Cob engine that Spring uses. I don't think it's implimented yet. :?

And I think resurection is a good start because all units heal themselves as it is now, so a repair pad would just speed up the process and takes planes away from battles.

Resurection would be nice because it would be a totaly new thing in the game.

-Buggi
User avatar
GrOuNd_ZeRo
Posts: 1370
Joined: 30 Apr 2005, 01:10

Post by GrOuNd_ZeRo »

Maybe you guys can implant some more feautures to this for us mod devs, like an airbase type that stations aircraft like C&C generals and they will take off automatically, when they get damaged or run out of ammo, they return to base, ammo could be defined in the weapon .tdf's or better yet, the unit's FBI file.

Mod makers will be VERY happy if you did :)

ofcourse their would be the choice between:

-CTOL, Conventional take off and landing, this will be for any type of aircraft, WW1~Current
-STOL, Short Take Off and Landing, for Turboprop aircraft and such, could take off from shorter airstrips maybe or big flat area's like roads and fields?
-STOVL, Short Take Off Vertical Landing, for Harrier type aircraft, could land nearly everywhere, including light carriers and fields, could also take off vertically if needed but maybe at extra-expense of fuel? if this will also be implanted.
-VTOL, Vertical Take Off and Landing, TA style aicraft and Helicopters, will be able to take off everywhere and land everywhere.

I know this is alot to ask, but this will really be some great features that will be needed to compete with the RTS world.

When the YS team would like to make money, esspecially from licensing the engine to us guys, I will gladly pay for it! I will kick EA ass! :D
SJ
Posts: 618
Joined: 13 Aug 2004, 17:13

Post by SJ »

Thats just standard cob commands so i dont see why it wouldnt be supported by the current cob parser.

The old spring contained planes that worked pretty much like you wants (limited ammo/fuel (was simplified to a single value) and needed a runway to takeoff/land). So I guess I might forwardport it someday but I dont see it as a priority.
User avatar
GrOuNd_ZeRo
Posts: 1370
Joined: 30 Apr 2005, 01:10

Post by GrOuNd_ZeRo »

I understand it's not a priority but it would just be a nice feature for us mod makers out there, esspecially for modern/WW2/etc mods.
Post Reply

Return to “Engine”