patchBos Wars - Patches: patch #7399, Lua map generator


You are not allowed to post comments on this tracker with your current authentification level.

patch #7399: Lua map generator

Submitted by:  Peter Schäfer <redadder>
Submitted on:  Sat Nov 20 22:18:53 2010  
Open/Closed: OpenStatus: None
Assigned to: None

(Jump to the original submission Jump to the original submission)

Fri Dec 10 17:06:58 2010, comment #6:

Hi Michiel,

can you enlighten me as to the purpose of the smp, sms and lua files? I can take a guess, but it is better if I get told ..

Can we use 3 gosh types where the 3rd is the boundary between the other gosh types? So I can show off the border ability of my map generator.

I was unable to find the ..

Peter Schäfer <redadder>
Tue Dec 7 08:54:09 2010, comment #5:

Hi Peter,
Please discuss "live" map creation with people that understand the code better. I only make levels, and some lua code for e.g. AIs.

I would like to cooperate to create (offline) some maps to prove that the generator is able to do so. This might be a first step towards live maps, and your effort spent so far will bear at least some fruit.

If I understand right, we need a conversion script in lua from the textual output of the current generator to Boswar map format, i.e. a folder with 3 files: presentation.smp, setup.sms, terrain.lua. The "smalland" map is a good example of the correct file format - since many levels have a different file layout.

The simplest way of mapping the letter codes to patches would be to use the gosh colors 06 and 09 with the 3000 series exclusively - that would only give 2 terrain types. All the other gosh series can be combined with this (except the 9000 series), and could be added later.

I am not skilled enough to create such lua code. Can you help? I am able to build on example code, though.

Michiel van der Wulp <mvw>
Project Member
Mon Dec 6 22:16:12 2010, comment #4:

Hi Michiel,

I find the reasons against randomness unconvincing.

The random seed for the lua random map generator can be set from the C code, although that is some effort.
If the lua random generator is not the same across platforms, then a software generator can be used.

While randomness reduces multiplayer fairness of maps, my lua map generator can be used to generate perfectly rotation-symmetric maps, that is as perfect as the extra randomness added in terrain blob generation intentionally allows.

If you want to work on terrain transitions, I will gladly cooperate in finding an automated solution. I still have to look at your patch to understand the task.

Peter Schäfer <redadder>
Mon Dec 6 12:47:38 2010, comment #3:

Hi Peter,

Already a long time ago, I implemented a randomly generated map, see patch #6857. I wanted to overcome the problem that you know where everything is on a map after a few times playing, which I find disturbing the fun.

The implementation of that patch was not suitable for Boswars, so I changed my idea to have some map generated in e.g. 10 variants, so that you can pick one to play.
Let's build on this idea: Can we generate a nice background with the "gosh" patches for the desert that is random, and then place the oases like I did in these levels?

Please download the zip from patch #6857 and look at the levels. Lacking is a nice background.

So, to answer your questions:
- I would like to create maps offline.
- The patches to use are the gosh and/or goshgeom patches.
- Buildings: Use one vault as HQ. No other buildings for now. Building positions are easily corrected manually, so no algorithm perfection is needed here.

I think the most difficult implementation detail will be regarding patches: the edges between soil types. Maybe, as a first step, we should do this manual.

Michiel van der Wulp <mvw>
Project Member
Thu Dec 2 23:53:18 2010, comment #2:

Hi Michiel,

I kind of thought that someone who had been working on BOS would tell me how to improve the generator to make it work for BOS. But to answer the question:

To make the generator create BOS-maps..
- the random map script authors, for example me, have to know which terrain to use, and how to write scripts

- improve rendering(thats the last step) such that all added "non-terrain" of the type building or unit or special is always placed on the map, even if displaced. This is necessary if you place initial buildings with the map generator, as currently it is possible that it attempts to place two in the same spot.

- This also might be improved further by having different buildings have different foundation. Currently one building is one map tile.

- optionally, render to more than one output map, i.e. have one level for terrain, one level for buildings and one level for units.

To create maps offline, and allow editors to improve these..
- have a conversion script to BOS map format, or create the BOS format directly from LUA.

To create maps live..
- call LUA map generator in the BOS executable. This should preload the map generator code, copy the lua state, and then run a random map script in that context.

I can help with some of these steps, but I need people to express their interest and point out the obvious things(to them) to get me started.

Peter Schäfer <redadder>
Thu Dec 2 13:52:41 2010, comment #1:

Hi Peter,

Interesting generator. I tried it out.

Running the lua code as follows generates a text file r1.txt:
lua generator_random_1.lua 7 200 r1.txt 56987
This text file contains letters that represent the patch type.
So far, great! The maps look fine, they may need some manual work, but may save me a lot of time while guaranteeing randomness and original shapes.

But how can we convert this text into a Boswars map?
What do we need to complete the work?

Michiel van der Wulp <mvw>
Project Member
Sat Nov 20 22:18:53 2010, original submission:


here is a LUA generic map generator, which might be useful for BOS.
It is intended to be used together with random map scripts written in LUA similar to the rms of the Age of Empires series. I realize there is work to do till it is useful for BOS, and I'm willing to invest some time in that.

The main interface is Generator.lua, the main files to execute are the generator_example files.

This release, v0.1.1 is under the terms of the GPLv2 or any later version.

Best regards,
RedAdder (

Peter Schäfer <redadder>


Attached Files
file #22071:  generator_0.1.1_GPLv2.7z added by redadder (57kB - application/x-7z-compressed)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by mvw (Posted a comment)
  • -unavailable- added by redadder (Submitted the item)

    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat Nov 20 22:18:53 2010redadderAttached File-=>Added generator_0.1.1_GPLv2.7z, #22071

    Back to the top

    Powered by Savane 3.1-cleanup