View topic - Engine will stop spawning start units and resources



All times are UTC + 1 hour


Post new topic Reply to topic  [ 64 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
PostPosted: 27 Jan 2010, 16:49 
Spring Developer

Joined: 01 Jun 2005, 10:36
Location: The Netherlands
In the next major version the engine will not bother with start units or start metal/energy anymore.

This change has been made to clean up an ugly deprecated piece of engine code, and because spawning start units the way the engine did was not flexible, leading to many games writing gadgets to actually remove the engine spawned start unit only to replace it with a new one.

More reasons and details about the changes can be found in the three related commits:

I've made an example gadget that should be pretty much a drop in replacement for the removed engine functionality for many games. (It honours startmetal/startenergy mod options, custom team keys, honours sidedata, shouldn't error if sidedata doesn't specify a start unit, etc.)

Modify it as desired (different way to determine start resources/storage, spawn multiple units, calculate optimal build facing for the start unit, etc.), in particular try to get rid of ugly hacks like re-spawning start units. :-)

If I've missed an important feature someone relied upon please let us know.

EDIT: Link to example gadget updated and added the commit containing zwzsg's improvements to the list of commits above.


Top
 Offline Profile  
 
PostPosted: 27 Jan 2010, 16:52 
P.U.R.E. Developer
User avatar

Joined: 21 Feb 2005, 03:38
Location: Herding cats uphill whilst wearing roller skates.
What about GameEnd being triggered, if there aren't any Units? What about Commander Ends behavior?

Personally, I'd like to see Commander Ends removed and replaced with a Gadget; it's another hardcoded TA-ism that's seen it's day go by.


Top
 Offline Profile  
 
PostPosted: 27 Jan 2010, 17:00 
Spring Developer

Joined: 01 Jun 2005, 10:36
Location: The Netherlands
Yes there are many more TA-isms. Who knows, maybe I or someone else gets around to those too sometime ;-)

For now these remained unchanged.


Top
 Offline Profile  
 
PostPosted: 27 Jan 2010, 17:11 
Kernel Panic Co-Developer
User avatar

Joined: 16 Nov 2004, 13:08
Will the replacment gadget be included in base?


Top
 Offline Profile  
 
PostPosted: 27 Jan 2010, 17:14 
Spring Developer

Joined: 01 Jun 2005, 10:36
Location: The Netherlands
It is included, but not enabled. (i.e. it's in LuaGadgets, like the other example gadgets)


Top
 Offline Profile  
 
PostPosted: 27 Jan 2010, 17:16 
P.U.R.E. Developer
User avatar

Joined: 21 Feb 2005, 03:38
Location: Herding cats uphill whilst wearing roller skates.
Is that change committed to the main branch yet?


Top
 Offline Profile  
 
PostPosted: 27 Jan 2010, 17:16 
Spring Developer

Joined: 01 Jun 2005, 10:36
Location: The Netherlands
Yes.


Top
 Offline Profile  
 
PostPosted: 27 Jan 2010, 17:22 
P.U.R.E. Developer
User avatar

Joined: 21 Feb 2005, 03:38
Location: Herding cats uphill whilst wearing roller skates.
OK, will test it later then.


Top
 Offline Profile  
 
PostPosted: 27 Jan 2010, 18:05 
Tournaments Moderator
User avatar

Joined: 08 Dec 2007, 17:39
Location: UK - England
Will this fix units spawning to a slight angle to the side when just being built by a lab?


Top
 Offline Profile  
 
PostPosted: 27 Jan 2010, 18:08 
Supreme Annihilation Maintainer
User avatar

Joined: 11 Jan 2008, 16:55
will this break spawning random commanders?
When u pick the random side in the lobby,ingame,It replaces your initial commander with a random one,core or arm.


Top
 Offline Profile  
 
PostPosted: 27 Jan 2010, 18:12 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
you might have to update a widget or gadget or two


Top
 Offline Profile  
 
PostPosted: 28 Jan 2010, 20:26 
Spring Developer

Joined: 01 Jun 2005, 10:36
Location: The Netherlands
Oh, btw, one other thing.

The fact that this gadget now handles StartMetal and StartEnergy, also means I have removed StartMetal and StartEnergy from EngineOptions.lua (since it isn't an engine option anymore...)

So please copy the relevant parts of EngineOptions.lua to ModOptions.lua (if desired). If you already override EngineOptions.lua or override the options in ModOptions.lua then this is irrelevant of course.

The relevant part of EngineOptions.lua, right before I removed it:
Code:
  {
    key    = 'StartingResources',
    name   = 'Starting Resources',
    desc   = 'Sets storage and amount of resources that players will start with',
    type   = 'section',
  },

  {
    key    = 'StartMetal',
    name   = 'Starting metal',
    desc   = 'Determines amount of metal and metal storage that each player will start with',
    type   = 'number',
    section= 'StartingResources',
    def    = 1000,
    min    = 0,
    max    = 10000,
    step   = 1,  -- quantization is aligned to the def value
                    -- (step <= 0) means that there is no quantization
  },
  {
   key    = 'StartMetal',
   scope  = 'team',
   name   = 'Team Starting metal',
   desc   = 'Determines amount of metal and metal storage this team will start with',
   type   = 'number',
   section= 'StartingResources',
   def    = 1000,
   min    = 0,
   max    = 10000,
   step   = 1,  -- quantization is aligned to the def value
   -- (step <= 0) means that there is no quantization
  },
  {
    key    = 'StartEnergy',
    name   = 'Starting energy',
    desc   = 'Determines amount of energy and energy storage that each player will start with',
    type   = 'number',
    section= 'StartingResources',
    def    = 1000,
    min    = 0,
    max    = 10000,
    step   = 1,  -- quantization is aligned to the def value
                    -- (step <= 0) means that there is no quantization
  },
  {
   key    = 'StartEnergy',
   scope  = 'team',
   name   = 'Team Starting energy',
   desc   = 'Determines amount of energy and energy storage that this team will start with',
   type   = 'number',
   section= 'StartingResources',
   def    = 1000,
   min    = 0,
   max    = 10000,
   step   = 1,  -- quantization is aligned to the def value
   -- (step <= 0) means that there is no quantization
  },


Top
 Offline Profile  
 
PostPosted: 04 Feb 2010, 17:13 
Spring Developer

Joined: 01 Jun 2005, 10:36
Location: The Netherlands
For developers, to temporarily make Spring sort-of compatible with mods that don't have the gadget yet, do:

Code:
mkdir -p installer/builddata/springcontent/LuaRules/Gadgets
cp installer/builddata/springcontent/LuaGadgets/Gadgets/game_spawn.lua \
   installer/builddata/springcontent/LuaRules/Gadgets/game_spawn.lua


(This works unless the mod itself has a gadget / file with that name.)


Top
 Offline Profile  
 
PostPosted: 17 Feb 2010, 02:59 

Joined: 22 Jan 2009, 19:25
Hi,

mhh .. have without problems managed the migration from modinfo.tdf
to .lua on different old mods that not more maintained....

But this change i cant handle easy ;)
Have as a example depacked BA7.11 to BA711.SSD dir and on a test the
game starts - but without units/resources.
This was expectet ...
Now i copyed the game_spawn.lua to Luarules/gadgets/ ...
Now the units (the commander) apear - but still no resources .........?
and i know the BA mod WILL updatet to work flawles, but i need to understand this to fix a couple of old mods to work with the new system.
(if its not TO MUCH work - still like primary to PLAY spring and dont code it ... :P )


Top
 Offline Profile  
 
PostPosted: 24 Feb 2010, 22:42 
XTA Maintainer
User avatar

Joined: 24 Feb 2005, 02:58
Location: In Alaska Bridge to nowhere land.
thank you... will get to updating xta this weekend...


Top
 Offline Profile  
 
PostPosted: 27 Feb 2010, 21:21 

Joined: 27 Feb 2010, 03:18
what starts the game then.

Every game engine spawns starting units!


Top
 Offline Profile  
 
PostPosted: 27 Feb 2010, 21:46 
Engines Of War Developer

Joined: 09 Jun 2005, 22:39
Location: Germany, the EU
Kerr wrote:
what starts the game then.

Every game engine spawns starting units!
Wrong - almost every RTS game spawns start units. What starts the game would be eg the following gadget http://github.com/spring/spring/blob/master/installer/builddata/springcontent/LuaGadgets/Gadgets/game_spawn.lua. No worries if you're not a game dev - they'll be sorting it out.


Top
 Offline Profile  
 
PostPosted: 28 Feb 2010, 20:13 

Joined: 27 Feb 2010, 03:18
But why remove starting units?

I don't get it.

:?

And no, Every rts game engine, in most cases the game and game engine are the same thing, since spring is only an engine though it's going to remove functionality in and of itself for spawning starting units, and people will have to use a gadget to spawn starting units?


Top
 Offline Profile  
 
PostPosted: 28 Feb 2010, 20:18 
Spring Developer

Joined: 01 Jun 2005, 10:36
Location: The Netherlands
Because the way engine spawned starting units was less flexible than having some gadget spawn starting units.

For example: in many games engine spawned starting unit was immediately removed after it was spawned only to spawn a new starting unit facing another direction.

Another example: random faction is usually implemented by removing engine spawned starting unit, picking a random faction and then spawning the startunit of that faction at the same place.

If the game would respawn anyway then it isn't really needed for engine to spawn units in the first place. (Besides, the code that did this was in a very confusing part of the loading procedure, which could use a cleanup or removal.)


Top
 Offline Profile  
 
PostPosted: 28 Feb 2010, 20:21 

Joined: 27 Feb 2010, 03:18
but you are making it more complicated on mods that don't want random starting units...

If I did not want any lua gadgets in my mod, would my mod run in any capacity?


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 64 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.