formation.c, formation.h, formationdef.h...

Discuss the future of Warzone 2100 with us.
Post Reply
JorgeAldo
Rookie
Rookie
Posts: 24
Joined: 21 Dec 2006, 04:58

formation.c, formation.h, formationdef.h...

Post by JorgeAldo »

I´m looking for ways to implement a real military formation model to warzone, and while at it i stumbled across these files :

formation.c, formation.h, formationdef.h.

Reading it time after time i menaged to get some clues about how it works, but, unfortunately, i did not menage to find where all these functions are used. I added two new formations (echelon left and echelon right), but they arent used because the only function (that is, the only function i saw using formations) wich calls formationnew is hardcoded to call FT_LINE...

On the other hand the current formation code is very weak (no offense intended), as it tries to create a kind of flocking mechanism but using some kind of complex model using linked lists, etc... very confused code (or very confused programmer :P)...

I need some help to rewrite this formation bit from scratch, i plan to use a steering model for flocking (when units are not organized by the player but just happens to be walking towards the same general area) and for real military formations (selected by the user).

If the current code calculate damage based on the hit angle, formation is a good way to keep the best angle toward the expected enemy position and to keep turrets covering the possible angles of contact...

For more info about droid walking formations look at this site :

http://www.red3d.com/cwr/steer/gdc99/

There is a better flocking model without using the complex "formation list" model currently used by warzone.

But i am not able to scratch the current code cause i dont know where it is used (or if it is really used at all).

To implement what i am foreseeing i will need to rewrite the formation system completely, and plug the new model into the source tree (theres where i need help).

Thanks in advance.
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Re: formation.c, formation.h, formationdef.h...

Post by Watermelon »

formation functions are used in various files,probably mainly in action.c,order.c,move.c and some path planning source files like fpath.c.I think there is only 2 formation types implemented atm,one is FT_LINE the other one is FT_COLUMN(actually I think they are the same thing...)

edit:
I think wz has almost all of info(orientation/directon/motion of movement/velocity) to implement such a super real physics,the only thing is missing is 'mass'/max_force,though it can easily obtained by adding a 'WeightToMass/WeightToForce' simple function,since wz has pretty detailed weight info per component.

wz uses direction(x,y facing) and pitch(z facing) in degree's instead of a orientation vector3,though personally I found it's easier to understand/work with orientation in degree's than in vector3's.

hit angle calculation is implemented in the svn version,though all sides of body(front,rear,left,right,top,bottom)have the equal amount of armors,so it's not noticeable in the 'stock' wz game.
Last edited by Watermelon on 22 Jan 2007, 08:21, edited 1 time in total.
tasks postponed until the trunk is relatively stable again.
User avatar
lav_coyote25
Professional
Professional
Posts: 3434
Joined: 08 Aug 2006, 23:18

Re: formation.c, formation.h, formationdef.h...

Post by lav_coyote25 »

well...

line is / or should be  = ------------------  line abreast movement - skirmish line.

column is / or should be =  -  column ( or ant trail movement )
                                  -
                                  -
                                  -
                                  -
                                  -
                                  -

there are several others - most popular is the chevron - most often found in aircraft sorties  / tank skirmish lines etc.


            -
            - -
          -  -
        -      -
      -          -
      -            -

go here and follow the seperate links if your interested... ;D
Last edited by lav_coyote25 on 22 Jan 2007, 08:23, edited 1 time in total.
‎"to prepare for disaster is to invite it, to not prepare for disaster is a fools choice" -me (kim-lav_coyote25-metcalfe) - it used to be attributed to unknown - but adding the last bit , it now makes sense.
Troman
Trained
Trained
Posts: 424
Joined: 12 Aug 2006, 15:40
Contact:

Re: formation.c, formation.h, formationdef.h...

Post by Troman »

Regardless of where formation code is used the only situation when it has any effect seems to be when unit group halts, when they stop they try to build a formation, which is somewhat useless at that point. They don't build formations while moving, afaik wz just limits the speed of the group by the speed of the slowest unit in the group.

I see no reasons to cling to rudiments. Real formations would be really nice, but even flocking still sounds much better than ant-tails to me.
Sign Up for Beta-Testing:
?topic=1617.0
JorgeAldo
Rookie
Rookie
Posts: 24
Joined: 21 Dec 2006, 04:58

Re: formation.c, formation.h, formationdef.h...

Post by JorgeAldo »

Ok, i will write a new movement engine from scratch, with a full blown model of entities behaviors based on the behaviours described in this site (this will take some time).

Then i will post it here and IF someone is interested, take the code and plug it for me into warzone.

Ok ?

I still feel overwhelmed by the current source code, i dont know if its because of its size (not that biiiggg), because the source code confusion or because i am the confused one here :P
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Re: formation.c, formation.h, formationdef.h...

Post by Watermelon »

JorgeAldo wrote: Ok, i will write a new movement engine from scratch, with a full blown model of entities behaviors based on the behaviours described in this site (this will take some time).

Then i will post it here and IF someone is interested, take the code and plug it for me into warzone.

Ok ?

I still feel overwhelmed by the current source code, i dont know if its because of its size (not that biiiggg), because the source code confusion or because i am the confused one here :P
It would be cool if we have a better physics/AI system,I plan to do some 'source change visual enhancements' like improved destroyFX(currently it just disassembles the droid into parts and randomly 'launch' them into fixed directions,it will be more interesting/realistic if destroyed units leave wrecks on battlefield,and the wrecks will 'linger' for a few seconds before vanish.),but those changes will increase the memory usage(more entries in 'feature' list) and give the draw engine more pressure(draw engine needs to be optimized first) imo

WZ is a bit conservative about the memory consumption(due to the ps version I guess),so most data uses linked list to save memory when performing insertion/search/deletion

You can get on IRC(#warzone irc.freenode.net,or use Troman's sig's url) if you are confused by particular part(s) of the source,most dev's idle there when they are available for help.
tasks postponed until the trunk is relatively stable again.
JorgeAldo
Rookie
Rookie
Posts: 24
Joined: 21 Dec 2006, 04:58

Re: formation.c, formation.h, formationdef.h...

Post by JorgeAldo »

What about implementing Newton or ODE physics system into warzone ?

Theres a lot of places where we need physics modelling and we have the danger of building duplicated functionality...

Why reinvent the wheel ?

Let´s plug Newton into warzone and get rid of tons of legacy code...

(The formation thing scared the sh*t out of me, i never saw something so "indirect")
User avatar
lav_coyote25
Professional
Professional
Posts: 3434
Joined: 08 Aug 2006, 23:18

Re: formation.c, formation.h, formationdef.h...

Post by lav_coyote25 »

;D  welcome to the wide wonderful world of warzone 2100...  ;D
‎"to prepare for disaster is to invite it, to not prepare for disaster is a fools choice" -me (kim-lav_coyote25-metcalfe) - it used to be attributed to unknown - but adding the last bit , it now makes sense.
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Re: formation.c, formation.h, formationdef.h...

Post by Watermelon »

JorgeAldo wrote: What about implementing Newton or ODE physics system into warzone ?

Theres a lot of places where we need physics modelling and we have the danger of building duplicated functionality...

Why reinvent the wheel ?

Let´s plug Newton into warzone and get rid of tons of legacy code...

(The formation thing scared the sh*t out of me, i never saw something so "indirect")
I never used either physics engine/played game using either engine but I am pretty sure they are not designed for a rts,they are designed specifically for a first person shooter/a first person role playing game/driving to create interactive environment imo...the little physics enhancement granted by such engine simply does not worth the amount of cpu time and memory footprint used by the physics engine in a rts game...
tasks postponed until the trunk is relatively stable again.
JorgeAldo
Rookie
Rookie
Posts: 24
Joined: 21 Dec 2006, 04:58

Re: formation.c, formation.h, formationdef.h...

Post by JorgeAldo »

Not exactly.

Rigid body dynamics are for 1st shooters and the like, i agree. But both engines can be configured to use only newtonian models (without the complex rigid body dynamics thing).

RTS entities can be represented as simple points of mass (Punctual entities) without joints or articulations, this way it becomes a simple particle system (with rules accordingly to what tanks, droids and vtols can do) without all the fuss a joints/articulation thing implies... The only point where a droid would be represented as non punctual entity (IE a extensive body) is where we need collision detection.
User avatar
Stormkeeper
Rookie
Rookie
Posts: 22
Joined: 14 Feb 2007, 15:11
Location: Under the table next to you

Re: formation.c, formation.h, formationdef.h...

Post by Stormkeeper »

You think, that we'd mighta make good use of that "Weight" factor in wz and let the big boys (Python, Mantis, Tiger?, Nexus heavy chassis) on treads crush cyborgs and smaller enemy vehicles ?
+[Unstoppable]+
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Re: formation.c, formation.h, formationdef.h...

Post by Watermelon »

Stormkeeper wrote: You think, that we'd mighta make good use of that "Weight" factor in wz and let the big boys (Python, Mantis, Tiger?, Nexus heavy chassis) on treads crush cyborgs and smaller enemy vehicles ?
I think even the viper truck wheels can kill poor baba people in mission 1...

currently weight only decreases the speed on all types of terrain:road,off-road and some other type I couldnt recall atm...There is another value called engine output(you see it in design screen stats bar after picking a body),it would be interesting if we give the engine output some kind of bonus so heavy bodies can as useful as the light ones(actually even with 3 HC turrets a python is still no match for 3 viper with 1 HC each w/ or w/o micro,and probably 1 tri-HC python costs more than 3 HC viper due to the weird power cost multiplier from heavy body/propulsion)...
tasks postponed until the trunk is relatively stable again.
Post Reply