PDA

View Full Version : Homeworld 2 Formation Tutorial



Mantaray
17th Apr 08, 12:53 AM
Ok, here is a tutorial to fix/edit formations.
Now I know a lot of people have been wanting to make formations and parades and such but have no idea why when they put the formation code in the correct folder the game crashes,
Basically the LUAdc doesn’t de-compile the formations properly,
This tutorial will get you round it.
First off, open your raw formation file, you should get something like this



-- LuaDC version 1.0.1
-- 11/12/2007 09:57:56
-- LuaDC by Age2uN
-- on error send source file (compiled lua) and this outputfile to Age2uN@gmx.net
--
formationSlot(
{ 0, 0, 0, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })
formationSlot(
{ 1, 0, -1, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })
formationSlot(
{ -1, 0, -1, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })
formationSlot(
{ 2, 0, -2, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })
formationSlot(
{ -2, 0, -2, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })
formationSlot(
{ 3, 0, -3, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })
formationSlot(
{ -3, 0, -3, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })
formationSlot(
{ 4, 0, -4, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })
formationSlot(
{ -4, 0, -4, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })
formationSlot(
{ 5, 0, -5, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })
formationSlot(
{ -5, 0, -5, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })
formationSlot(
{ 6, 0, -6, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })
formationSlot(
{ -6, 0, -6, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })
formationSlot(
{ 7, 0, -7, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })
formationSlot(
{ -7, 0, -7, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })
formationSlot(
{ 8, 0, -8, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })
formationSlot(
{ -8, 0, -8, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })
formationSlot(
{ 9, 0, -9, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })
formationSlot(
{ -9, 0, -9, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })


if you where to insert it in this raw state, you get a crash to desktop upon loading.
Now the problem is, that 2 squiggly brackets are missing. So lets fix this now

Heres the old one


formationSlot(
{ 0, 0, 0, ,
{ 0, 0, 1, ,
{ 0, 1, 0, })

and here it is again with the brackets in,


formationSlot(
{ 0, 0, 0, },
{ 0, 0, 1, },
{ 0, 1, 0, })


now there in, it looks like common sense, but if you were to do this to all your formation slots it still looks untidy and is difficult to work with.
So now I would suggest that you edit it to appear like so:


formationSlot({ 0, 0, 0, },{ 0, 0, 1, },{ 0, 1, 0, })


now, you can put the formation slots directly next to each other which should allow easier edditing



formationSlot({ 0, 0, 0, },{ 0, 0, 1, },{ 0, 1, 0, })
formationSlot({ 1, 0,-1, },{ 0, 0, 1, },{ 0, 1, 0, })
formationSlot({-1, 0,-1, },{ 0, 0, 1, },{ 0, 1, 0, })


Now for editing,
Each set of 3 co-ordinates controls something on the ship.
The ship is positioned in the formation almost as turrets are on a ship.
The first batch of co-ordinates is the ships position relative to the origin.

The second batch is where the front of the ship faces. As it is set at the moment, the ship faces forward as there is a ‘1’ in the last space, if you instead put a 1 in the second place, the ships would face upwards, amusing but its nice to know.

The third batch of co-ordinates controls where the top of the ship faces, This ensures when the ship turns and moves that the top of the ship always faces upwards and acts as a level for the game engine (I believe).
That’s about the long and the short of it. At the moment I am playing with parade formations as they have an extra co-ordinate that I need to figure out before I write a tutorial about it, but I hope this is useful

xxobot
17th Apr 08, 1:59 AM
:awesome:

JMScomp
17th Apr 08, 4:56 PM
Awesome! :D

Quaetam
17th Apr 08, 6:01 PM
Great job :).

Also, I'd like to note that I have previously tested up to 100 ships per squadron, though I got to the point where I gave them almost random coordinates in the ship file, so it was basically a big cloud of interceptors:p.

Just a question, do the parade files work the same way?

Mantaray
18th Apr 08, 12:36 PM
i belive so, (roughly) but i havenbt figured out what the extra co-ordinate is for, if anyone knows could they shed some light on this?

Le Sun Tzu
18th Apr 08, 12:57 PM
-- format slot-name vector-offset vector-heading vector-direction of growth size-of-growth (set to 0 if want default)
-- offset determines offset from center of formation
-- heading determines heading, use { 0,0,1 } for forward
-- direction of growth determines how new formations will grow out
-- size of growth determines how spaced out additional formations are. Set to 0 for default
-- one slot MUST be called "misc", leftovers will get put here

-- left
paradeSlot("Hgn_AssaultCorvette", {-1045, -2, 875}, {0,0,1}, {-1,0,0}, 0 );
That is what the RDN files say about the parade format.

Mantaray
19th Apr 08, 12:19 PM
got it in 1 le, cheers for the heads up, played about with it and it all works as described

Quaetam
19th Apr 08, 2:42 PM
Thanks Le Sun, its a great help :D.

LifeOnMars
16th Jan 10, 6:50 AM
I wish I had found this thread before..... it would have saved me a lot of frustration!
lol

KeyBored
16th Jan 10, 7:07 AM
Woah, steady on, big bump! But yes, very usefull, pouk will like this :D

Pouk
16th Jan 10, 8:05 AM
Pouk has already used this helpful thing to the drone ball formation.

KeyBored
16th Jan 10, 10:35 AM
Has Pouk done that already? Oh well, I wont point stuff out for Pouk anymore! ^^

LifeOnMars
16th Jan 10, 12:33 PM
a simple but still very enjoyable thing:

****

formationSlot({ 100, 0, 0, },{ 0, 0, 1, },{ 0, 1, 0, })
formationSlot({ -100, 0, 0, },{ 0, 0, 1, },{ 0, 1, 0, })
formationSlot({ 300, 0, 0, },{ 0, 0, 1, },{ 0, 1, 0, })
formationSlot({ -300, 0, 0, },{ 0, 0, 1, },{ 0, 1, 0, })
formationSlot({ 500, 0, 0, },{ 0, 0, 1, },{ 0, 1, 0, })
formationSlot({ -500, 0, 0, },{ 0, 0, 1, },{ 0, 1, 0, })

formationSlot({ 100, 0, 150, },{ 0, 0, -1, },{ 0, 1, 0, })
formationSlot({ -100, 0, 150, },{ 0, 0, -1, },{ 0, 1, 0, })
formationSlot({ 300, 0, 150, },{ 0, 0, -1, },{ 0, 1, 0, })
formationSlot({ -300, 0, 150, },{ 0, 0, -1, },{ 0, 1, 0, })
formationSlot({ 500, 0, 150, },{ 0, 0, -1, },{ 0, 1, 0, })
formationSlot({ -500, 0, 150, },{ 0, 0, -1, },{ 0, 1, 0, })

****

this formation creates two parallel lines, e.g a 'corridor'. what i did next was to change squadron size of gun platforms to 12 and assign to them this kind of formation..... and then i exaggerated their navigation lights, and increased mesh render limit.
what comes out of this in the end is a nice colourful blinking corridor.

178thBG
30th Apr 11, 2:20 PM
i hope im not to late to the party.. can you create a CUSTOM formation like in hw1? where the ships stick in the exact formation you put them in?

or do you have to set up constant individual formations?

say i am about to fight an enemy fleet.. i want my destroyers up front cruisers in the back and frigates right behind destroyers.. with strike craft where ever i feel like putting them..

can i just move them into the desired positions in game, hit F8 for example, and have them stick that way, and move together ..

or are formations strictly predetermined by the code?


i know this topic is kinda old and inactive, but please dont close it yet mods.

ill watch for reply's.
thanks.

sirkillalot
30th Apr 11, 2:26 PM
This is awesome! Thank you Mantaray