create maps programmatically

Asked by Dustin D on 2013-01-30


I'm using Wargus for research and I'm wondering how easy it would be to create wargus maps that vary the terrain (only water or land tiles) and vary units. There would be no buildings involved. I would like to generate a few hundred that vary by different water/land layouts and units and I'm wondering what the encoding for maps is.

Is it as easy as just creating a matrix where each element represents the terrain and the unit (if there is one) in that location?

Any help/advice in this direction is greatly appreciated.

Thank you,

Question information

English Edit question
Wargus Edit question
No assignee Edit question
Last query:
Last reply:
Kyran Jackson (erstmap) said : #1

Stratagus uses plain text files for the maps.

A title goes something like:
SetTile( tiletype, x, y, 0)

So for grass to over the first 10 blocks along the x axis we'd put:

SetTile( 80, 0, 0, 0)
SetTile( 80, 1, 0, 0)
SetTile( 80, 2, 0, 0)
SetTile( 80, 3, 0, 0)
SetTile( 80, 4, 0, 0)
SetTile( 80, 5, 0, 0)
SetTile( 80, 6, 0, 0)
SetTile( 80, 7, 0, 0)
SetTile( 80, 8, 0, 0)
SetTile( 80, 9, 0, 0)
SetTile( 80, 10, 0, 0)

For units we'd put to follow:

CreateUnit("unit-peasant", 2, {87, 8})

Dustin D (dtd212) said : #2

Excellent, thank you! So do I just make a file containing a list of these statements and then give that file a .pud.gz extension?

And is there any type of header, such as setting the dimensions of the map? Or does the system just figure it out from the statements.

Thanks again!

Kyran Jackson (erstmap) said : #3

This thread has an example blank map. The presentation file (smp) defines the dimensions and the number of players.

Pali (pali) said : #4

Note that pud format is binary and is used by Warcraft II. Stratagus using only smp and sms text files (can be also compresses)

Ulit Jaidee (ulitjd-s) said : #5

I put both files "example.smp" and "example.sms" in the directory "data/maps".
Then, I ran the Wargus. And then, I choose "Single Player Game" --> "Select Scenario".
At this point, I supposed to see the "example" maps in the list, but I didn't.
Could any one tell me, what I should do to make it run?

Kyran Jackson (erstmap) said : #6

The scenario list shows the maps located in data/maps/multi, you'll have to move those files to that directory.

Joris Dauphin (joris-dauphin) said : #7

As kyran said, in wargus, the default map is in directory maps/multi/.
but the root directory is maps/, so, I have the '..' as first entry which let you navigate the tree directory (up to maps/ content).

for your convenience, you may modify scripts/guichan.lua:438
and replace
-- 8< --
mapname = "maps/multi/(2)mysterious-dragon-isle.smp.gz"
-- >8 --
by your map.

Can you help with this problem?

Provide an answer of your own, or ask Dustin D for more information if necessary.

To post a message you must log in.