Opened 12 years ago

Closed 11 years ago

#1688 closed enhancement (fixed)

[PATCH] Add random map "Belgian Uplands" based on erosion

Reported by: FeXoR Owned by:
Priority: Should Have Milestone: Alpha 12
Component: UI & Simulation Keywords: patch RMS RMGEN
Cc: Patch:

Description (last modified by historic_bruno)

A random map with its heightmap generated by erosion. It will not be as fair as more symmetric maps but looks more natural.

Attachments (12)

belgian_uplands2012-10-1.zip (113.3 KB ) - added by FeXoR 12 years ago.
All needed files in a ZIP archive (.js/.json/.gif)
belgian_uplands2012-10-1.diff (16.4 KB ) - added by FeXoR 12 years ago.
The SVN .diff
belgian_uplands2012-10-2.zip (102.8 KB ) - added by FeXoR 12 years ago.
All needed files in a ZIP archive (.js/.json/.gif)
belgian_uplands2012-10-2.diff (16.4 KB ) - added by FeXoR 12 years ago.
The SVN .diff
belgian_uplands2012-10-3.zip (104.0 KB ) - added by FeXoR 12 years ago.
All needed files in a ZIP archive (.js/.json/.gif)
belgian_uplands2012-10-3.diff (23.7 KB ) - added by FeXoR 12 years ago.
The SVN .diff
belgian_uplands2012-10-4.diff (23.7 KB ) - added by FeXoR 12 years ago.
The SVN .diff
belgian_uplands2012-10-4.zip (104.0 KB ) - added by FeXoR 12 years ago.
All needed files in a ZIP archive (.js/.json/.gif)
belgian_uplands2012-10-5.zip (104.3 KB ) - added by FeXoR 12 years ago.
All needed files in a ZIP archive (.js/.json/.gif)
belgian_uplands2012-10-5.diff (24.7 KB ) - added by FeXoR 12 years ago.
The SVN .diff
belgian_uplands2012-10-5b.zip (104.4 KB ) - added by FeXoR 12 years ago.
All needed files in a ZIP archive (.js/.json/.gif)
belgian_uplands2012-10-5b.diff (24.9 KB ) - added by FeXoR 12 years ago.
The SVN .diff

Download all attachments as: .zip

Change History (22)

comment:1 by historic_bruno, 12 years ago

Description: modified (diff)
Keywords: patch added; random map erosion hightmap removed

From a quick look at the patch, I see at least two unnecessary deepcopy()s, on line 314 snd 324 of belgian_uplands.js (since the assigned variable is just a number and not an object reference).

comment:2 by FeXoR, 12 years ago

My dear, yes! I forgot I added some deepcopies because some problems appeared but most of them were unneeded. Removed all of them I think. The 4 remaining ones are needed (the last may not, but if I add checks for better start locations it will be).

Thx and sry!

New files added.

Last edited 12 years ago by FeXoR (previous) (diff)

by FeXoR, 12 years ago

All needed files in a ZIP archive (.js/.json/.gif)

by FeXoR, 12 years ago

The SVN .diff

comment:3 by historic_bruno, 12 years ago

Milestone: BacklogAlpha 12

comment:4 by FeXoR, 12 years ago

Removed some typos (variable names), reviewed documentation to make more sense, added props to the map as suggested in topic http://www.wildfiregames.com/forum/index.php?showtopic=16535

New version added.

Last edited 12 years ago by FeXoR (previous) (diff)

by FeXoR, 12 years ago

All needed files in a ZIP archive (.js/.json/.gif)

by FeXoR, 12 years ago

The SVN .diff

comment:5 by FeXoR, 12 years ago

Generating a giant map and saving it works but afterward (when the engine tries to load the map?) an out of memory error occurs...

Trying to fix that by reducing the prop density on very large and giant maps...

Done.

I also added progress checks and set the progress bar.

Those are all improvements that came to my mind until now so I don't know how to improve it further ATM. I'll be away the next week anyway.

Last edited 12 years ago by FeXoR (previous) (diff)

by FeXoR, 12 years ago

All needed files in a ZIP archive (.js/.json/.gif)

by FeXoR, 12 years ago

The SVN .diff

comment:6 by FeXoR, 12 years ago

I had a strange error when generating this map. Here's the link to the chat: http://irclogs.wildfiregames.com/2012-10-03-QuakeNet-%230ad-dev.log

EDIT: OBSOLETE Start

historic_bruno didn't get this error so it could only be a problem on my system. Even deleting the SVN directory (and the cache) and downloading it again didn't fix it. I have really no idea what causes it.

I don't really mind deleting the code to log the time needed for the various generation processes but it would be convenient if it could stay in (documented in preferably but I don't really mind as said before). ATM it's documented out because I thought that was the cause of this error but that seams very unlikely on closer examination.

EDIT: OBSOLETE End

EDIT: Now I'm quite sure it was the line "RMS.SetProgress(100);" after exporting the map! Now all seams to be fine. Please check if that's indeed the case with the version from 2012-10-3 by uncommenting that line. Generating a tiny map with 2 players and seed 0 about 10 times with and without that line should be enough to be quite sure (it seams to fail about half the time with that line). The error message isn't very descriptive and I still don't know why it appears nor why it appears that late (after saving the map).

If everything seems to be fine I think the map is good to go to SVN. Some seeds of tiny/small maps with many players still raise errors due to not enough valid start positions found (or they wind up right next to each other so it generates but is quite unplayable). That is written in the map description to make players avoid those cases. Not sure what to do about it.

Last edited 12 years ago by FeXoR (previous) (diff)

by FeXoR, 12 years ago

The SVN .diff

comment:7 by Erik Johansson, 12 years ago

Is it possible to check for whether or not a given seed will produce valid start positions and avoid them? I understand that would most likely mean a longer generation time, but if it's only for smaller maps it shouldn't be as much of an issue, especially if it's only in those cases. If you play a small map with a lot of people you're most likely caring more about the speed of the game once it's running than the generation time.

comment:8 by FeXoR, 12 years ago

It would be possible. I could just put everything (but the placement of terrain, decorative props and entities) in a while loop and let it run until it fits two things:

  • Enough fitting tiles are present to place all players
  • The closest two players are at least 20-30 tiles apart of each other (have to test the exact values)

Hopefully that would be only 2 or 3 loops even for tiny maps with 8 players.

This should work since all manipulations start with totally random values (especially the hightmap) and so will not "stack" onto each other for each loop.

EDIT: Whow! Indeed it works. It's close to impossible to check the progress though since the loop takes about 95 percentage of the generation time (on tiny maps) and it's impossible to guess how many loops it will take. How many loops it takes in the end and why it restarts is logged. Debugging by showing the areas valid for start locations will not work properly for more than one loop (the lines documented out to paint all tiles valid for start positions in pure colors by the type of check). Average number of loops for a tiny map with 8 players is more like 8 (Ten tests: 4, 21, 8, 7, 2, 5, 1, 1, 9, 20).

Last edited 12 years ago by FeXoR (previous) (diff)

by FeXoR, 12 years ago

All needed files in a ZIP archive (.js/.json/.gif)

by FeXoR, 12 years ago

All needed files in a ZIP archive (.js/.json/.gif)

by FeXoR, 12 years ago

The SVN .diff

comment:9 by FeXoR, 12 years ago

The addition of "belgian_uplands2012-10-4.zip" was the result of a miss click, sry.

The files with "2012-10-5" are the recent ones.

EDIT: It may be a good idea to slightly raise the needed distance between players with the map size. It rarely occurs that bigger then tiny maps need more than one loop so it's OK I guess.

Done. I'll be gone for a week now. I'd be grateful for other ideas or adding this version to SVN.

Giving Iberians its civ bonus walls (or at least towers like on most island maps) if the player distance allows it may now work but I don't think so. Walls will likely wind op in water and even towers only might obstruct interactive entities so the AIs would likely fail.

Last edited 12 years ago by FeXoR (previous) (diff)

by FeXoR, 12 years ago

All needed files in a ZIP archive (.js/.json/.gif)

by FeXoR, 12 years ago

The SVN .diff

comment:10 by historic_bruno, 11 years ago

Keywords: review removed
Resolution: fixed
Status: newclosed

Added in r12813.

Note: See TracTickets for help on using tickets.