Map generator

Map generator

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

Moderator: Moderators

MadrMan
Posts: 12
Joined: 17 Jan 2009, 20:13

Map generator

Post by MadrMan »

Hi

I've been working on a map generator for a while now (2 years or so, with long breaks).

It can generate maps on-the-fly. So you simply have to give the appropriate seed + possibly other settings and spring would generate it on startup and everyone would be on the same map. No download times or anything just generation times (which shouldn't be long).

A small part of the ArchiveScanner/VFSHandler was changed to allow archives/files to be made from inside spring instead of having to write it out to disk first.

I got it to work on the latest master again after plenty of merging but i have a few questions because i'm not entirely sure how to best do a few things.

Currently it can generate the .smf file, not the .smd or .smt yet (it loads these from an existing map)

https://github.com/MadrMan/spring/tree/mapgen

- I need to be able to generate an .smd file from spring, or simply set all the required members in the MapInfo class. The former is probably the most reliable because spring already does quite a few safety checks on them and if the MapInfo class changes the generator wouldn't need to be changed. Is the .smd format still needed with the newer maps? or is it all replaced with the lua mapinfo stuff?

- Settings for the generator are currently passed into the script.txt as 'mapgenseed={seed}', i may or may not add more at some point. I also have to set mapname to the matching mapname or spring won't be able to find the generated map. Any suggestions on how to do this in a better way? or is this fine?

- The .smt format might be a bit annoying to get right. Generating the textures should be doable but would i need to compress them aswell? I haven't messed with this yet.

- The actual height generating is currently done from within a C++ class, but i'm slightly tempted to move it all into lua. This could severely decrease the speed, however.

Opinions? :-)
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: Map generator

Post by PicassoCT »

mappers .. meat the discjockey 2000. It can play music and has three sort of standard comentary on the political situation.

"That maschine is fantastic..."

"Ssssh, dont praise the maschine.."
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Map generator

Post by AF »

hmmm I wonder what happened to SJs map generator

SJs was an external tool rather than part of spring. The main reason he didn't persist with his map generator project and why nobody has ellaborated since is because the process of generating a map in that format is costly. SM3 would have been a more appropriate format for this but it never took off.

I would speak with braindamage, he mentioned he would like to improve the map format, possibly remove some compile steps and other stuff I don't remember
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Map generator

Post by abma »

hu? jk is also working on a map-format? https://github.com/jk3064/Map-Blueprint
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: Map generator

Post by PicassoCT »

Rohrschachtest map generator.. what do you see in this dsd:

a beautifull butterfly
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Map generator

Post by zwzsg »

I don't like idea of the random map generator recipe to be in C++, first because it greatly raise the entry level for mappers (most of which aren't coders), but mostly because that means any new recipe would have to be built-in into Spring.exe

Technically we can already do random map generator in pure Lua. Even though we can't change the map texture / tile, I workarounded that by disabling ground rendering and drawing my own quads in Spring OpenGL Lua.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Map generator

Post by smoth »

Madrman this sounds neat. Have some shots of the results?
User avatar
KaiserJ
Community Representative
Posts: 3113
Joined: 08 Sep 2008, 22:59

Re: Map generator

Post by KaiserJ »

+1 to smoths request; i'd love to see the maps and see how you've handled metal and other stuff

neat idea IMO
Satirik
Lobby Developer
Posts: 1688
Joined: 16 Mar 2007, 18:27

Re: Map generator

Post by Satirik »

abma wrote:hu? jk is also working on a map-format? https://github.com/jk3064/Map-Blueprint
doesn't look like he is ...
User avatar
MidKnight
Posts: 2652
Joined: 10 Sep 2008, 03:11

Re: Map generator

Post by MidKnight »

Nice work, Madrman! Thanks for contributing something exciting and unique to Spring!

You guys, don't forget to thank him for his work before starting with the questions/suggestions/complaints/requests!
MadrMan
Posts: 12
Joined: 17 Jan 2009, 20:13

Re: Map generator

Post by MadrMan »

I believe jK isn't working on the actual map format but rather on the format of other files which are part of maps aswell. BrainDamage said he is going to improve the SSMF format but he's been busy lately so it might take a while before that happens.

smoth/KaiserJ: I'll show some shots when i have the smt working aswell (currently it looks very flat)

zwzsg: mappers normally wouldn't touch the generator code. but yea, if the code was going to be changed it would become a bit of a mess. i think i might stick it all into lua. i just hope speed won't become a problem when i do so.

MidKnight: thanks :-)
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Map generator

Post by hoijui »

it sounds sane to me, to first try to get the basics done (have it able to create everything a map needs), and then focus on the details of the code that generates the map ("C++ or Lua?"). if you have to start testing (in multiplayer) with other people, it should also be easier if it is all contained within spring.exe, and one would not have to tweak and setup external stuff and make sure everyone uses the same content.

good luck from me too! :-)
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Map generator

Post by smoth »

a generator is not the same as the format(smf) or the config files which is what the map blueprint(the configs) is.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Map generator

Post by knorke »

MadrMan wrote:- I need to be able to generate an .smd file from spring, or simply set all the required members in the MapInfo class. The former is probably the most reliable because spring already does quite a few safety checks on them and if the MapInfo class changes the generator wouldn't need to be changed. Is the .smd format still needed with the newer maps? or is it all replaced with the lua mapinfo stuff
looks like there is no need for .smd file anymore:
http://springrts.com/phpbb/viewtopic.php?f=56&t=26028
Technically we can already do random map generator in pure Lua. Even though we can't change the map texture / tile, I workarounded that by disabling ground rendering and drawing my own quads in Spring OpenGL Lua.
would it be possible to allow Lua to change maptexture? Beside mapgenerators it would have multiple uses.
Even if it only worked before the game starts for whatever reason (during loading) it would be kind of nice...
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Map generator

Post by Google_Frog »

I'd like to change the map texture. I already requested it a while ago to make terraforming look better.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Map generator

Post by zwzsg »

As a first step, it would be really nice if we could change which tile texture is associated with each square of terrain.

And as second step, something to redraw a tile texture, or add a new tile texture.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: Map generator

Post by FLOZi »

Including being able to draw a void
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Map generator

Post by smoth »

first lets just see the guy get the basics. I am sure he has lots of ideas of his own...
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: Map generator

Post by PicassoCT »

He posted here, he demanded the drama. Now that we all have put our hearts into it we can put fire into this once he ignores our advicious comands.


I suggest to put wheels on the Map generator. Everything is better with wheels.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Map generator

Post by Tobi »

MadrMan wrote:i just hope speed won't become a problem when i do so.
You could consider to offer to Lua large `building blocks', which can be used to compose a map generator, and which are implemented in C++. Think of e.g. a 2d perlin noise source as a building block, and allowing Lua to stack multiple perlin noises with different parameters to create a final map. Many other building blocks are probably possible.
Post Reply

Return to “Engine”