Engine will stop spawning start units and resources - Page 2

Engine will stop spawning start units and resources

Resources to get you going on your new project, or to help you over some emergent problems during your development cycle.

Moderators: Moderators, Moderators

Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Engine will stop spawning start units and resources

Post by Tobi »

You could spawn the start unit directly in LuaRules' main.lua
0 x

User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6113
Joined: 29 Apr 2005, 01:14

Re: Engine will stop spawning start units and resources

Post by FLOZi »

Kerr wrote:but you are making it more complicated on mods that don't want random starting units...
Not really as the gadget is provided in the base files to be backwards compatible, you just have to have gadgets set up..
If I did not want any lua gadgets in my mod, would my mod run in any capacity?
Would basically never happen.
0 x

User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7017
Joined: 16 Nov 2004, 13:08

Re: Engine will stop spawning start units and resources

Post by zwzsg »

The exemple 'game_spawn.lua' provided doesn't work:

Code: Select all

Unsafe attempt to change game state
Not sure if it's best to fix by allowing unsafe changes or by moving the spawning to GameFrame.
0 x

User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Engine will stop spawning start units and resources

Post by TradeMark »

cant you leave the default behaviour if some file is not found etc?

will just make mods harder to make when the amount of needed lua files is growing constantly.
0 x

User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Engine will stop spawning start units and resources

Post by Argh »

It involves dropping exactly one file into LuaRules. It's not the end of the world.
0 x

User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Engine will stop spawning start units and resources

Post by TradeMark »

yeah.... and what next, one another lua file... then one another... and so on.
0 x

User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: Engine will stop spawning start units and resources

Post by SinbadEV »

TradeMark wrote:yeah.... and what next, one another lua file... then one another... and so on.
NO, it would involve adding a few lines of code to said one file until all of the behavior required to make a TA game with the spring engine has been moved out of the engine proper and into a single lua file and we can finally get the open source community to like us.
0 x

User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Engine will stop spawning start units and resources

Post by TradeMark »

okay... few lines of code vs few files is as messed up IMO.
0 x

User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Re: Engine will stop spawning start units and resources

Post by SanadaUjiosan »

I don't know, I'm happy with leaving the engine in the hands of those who are capable. If we want Spring to get better, it'll have to change. Just the way things work.
0 x

User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Engine will stop spawning start units and resources

Post by TradeMark »

well... theres no cons in making default options really
0 x

User avatar
ScarySquirrel
Posts: 82
Joined: 29 Apr 2007, 04:25

Re: Engine will stop spawning start units and resources

Post by ScarySquirrel »

Wow, even more improvements.
This is what makes Open Source great: it's always improving.
0 x

User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7017
Joined: 16 Nov 2004, 13:08

Re: Engine will stop spawning start units and resources

Post by zwzsg »

Here is a better version of game_spawn.lua
  • Switch off error about unsafe change
  • Snap start unit to 16x16 grid
  • Start unit face toward map center
Attachments
game_spawn.lua
(4.02 KiB) Downloaded 189 times
0 x

User avatar
hoijui
Former Engine Dev
Posts: 4342
Joined: 22 Sep 2007, 09:51

Re: Engine will stop spawning start units and resources

Post by hoijui »

zwzsg, i have it ready to put into spring source, put i do not get the snap-to-grid thing. i mean... i can imagine what id does, but what is it good for? could it be negative for any mod?

edit: .. is it that in-game, you can only place buildings into this grid too?
0 x

User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7017
Joined: 16 Nov 2004, 13:08

Re: Engine will stop spawning start units and resources

Post by zwzsg »

For mods that start with mobile units, it doesn't really matter since the unit can move.

A naive concern would be that displacing units could make them spawn in a cliff or acid if they were already very close to it. However, a proper examination dispels this argument: if you stay within the same 16x16 cell, you are in the same passability "tile" gameplaywise.

For mods that start with immobile units (Gundam, EvoRTS, KP, ...), it makes them align to the building grid that all the regularly built structures are forced into. This helps with two things:
- Decals alignement. For start pos that are not roundish, decal gets slightly misaligned. It's a hard to notice small detail, but would still looks a bit sloppy.
- Lining up with regulary built structure around the start structure.

hoijui wrote:edit: .. is it that in-game, you can only place buildings into this grid too?
Image Is it an actual question I'm supposed to answer?
0 x

User avatar
AF
AI Developer
Posts: 20671
Joined: 14 Sep 2004, 11:32

Re: Engine will stop spawning start units and resources

Post by AF »

"AF fully endorses zwszgs improvements and looks forward to future additions"

*gives zwzsg a cookie*
0 x

User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6113
Joined: 29 Apr 2005, 01:14

Re: Engine will stop spawning start units and resources

Post by FLOZi »

Link in first post should be updated to reflect new git directory structure

http://github.com/spring/spring/blob/ma ... _spawn.lua
0 x

Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Engine will stop spawning start units and resources

Post by Tobi »

Thanks, updated.
0 x

User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2695
Joined: 25 Aug 2004, 13:31

Re: Engine will stop spawning start units and resources

Post by bobthedinosaur »

I'm sorry, I am confused. Where are devs defining what units are the start units with this gadget?
0 x

User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7017
Joined: 16 Nov 2004, 13:08

Re: Engine will stop spawning start units and resources

Post by zwzsg »

Spring.GetSideData fetches it from your mod /gamedata/sidedata.tdf
0 x

User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2695
Joined: 25 Aug 2004, 13:31

Re: Engine will stop spawning start units and resources

Post by bobthedinosaur »

oh neeto
0 x

Post Reply

Return to “Game Development Tutorials & Resources”