Random Map Generation

Wargus is a Warcraft 2 mod that allows you to play Warcraft 2 with the Stratagus engine.
User avatar
Andrettin
Posts: 433
Joined: Sun Jun 30, 2013 9:58 pm
Location: Vienna, Austria
Contact:

Random Map Generation

Postby Andrettin » Thu Sep 26, 2013 3:26 am

I have been working on a random map generator script =)

Right now, it is capable of generating maps like this:
Image

It creates random rocks and trees, placing the appropriate transition tiles between rock and grass/trees, and then creates gold mines.
User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

Re: Random Map Generation

Postby b_o » Thu Sep 26, 2013 4:06 am

Nice. Reminds me of this: http://www.warmaker.net/
User avatar
Andrettin
Posts: 433
Joined: Sun Jun 30, 2013 9:58 pm
Location: Vienna, Austria
Contact:

Re: Random Map Generation

Postby Andrettin » Thu Sep 26, 2013 7:19 am

The random map generator can now create patches of dirt, too:
Image
b_o wrote:Nice. Reminds me of this: http://www.warmaker.net/
Thanks :)

Yes, that was a good random map generator... too bad it is closed-source, or I could take a look at its algorithm.
User avatar
Kyran
Posts: 499
Joined: Sat Dec 31, 2011 5:19 pm
Location: Australia
Contact:

Re: Random Map Generation

Postby Kyran » Thu Sep 26, 2013 8:35 pm

Are you going to have this in game?
04:27 jim4 why haven't you added wc1 support? this project sucks. i'm only going to use freecraft
05:06 jim4 finished wc1 support yet? i've been waiting for 6 years
05:10 jim4 new things scare me
User avatar
Andrettin
Posts: 433
Joined: Sun Jun 30, 2013 9:58 pm
Location: Vienna, Austria
Contact:

Re: Random Map Generation

Postby Andrettin » Sun Sep 29, 2013 9:52 pm

Kyran wrote:Are you going to have this in game?
It is already in-game :) It was built in-game from the ground up.
User avatar
Kyran
Posts: 499
Joined: Sat Dec 31, 2011 5:19 pm
Location: Australia
Contact:

Re: Random Map Generation

Postby Kyran » Tue Oct 01, 2013 6:19 pm

Andrettin wrote:It is already in-game :) It was built in-game from the ground up.
!!!

I love you!
04:27 jim4 why haven't you added wc1 support? this project sucks. i'm only going to use freecraft
05:06 jim4 finished wc1 support yet? i've been waiting for 6 years
05:10 jim4 new things scare me
User avatar
Andrettin
Posts: 433
Joined: Sun Jun 30, 2013 9:58 pm
Location: Vienna, Austria
Contact:

Re: Random Map Generation

Postby Andrettin » Wed Oct 02, 2013 12:36 am

Kyran wrote: !!!

I love you!
Hehe :D

The code I have so far is in this file:
https://dl.dropboxusercontent.com/u/173 ... ration.lua

It creates grass, rock, tree, dirt and water terrain, and randomly places 6 gold mines and 2 oil patches. The file is loaded by stratagus.lua (I put it after the loading of cheats.lua). You can use it in a map by deleting all "SetTile" code from the map's sms, and replacing it with:

Code: Select all

GenerateRandomMap(128, 128)


The "128, 128" can, of course, be replaced with map width and height of your preference, but at the moment numbers higher than 128 do not work.

Note that start locations and peasants/peons still need to be placed by the map file itself.

Who is online

Users browsing this forum: No registered users and 1 guest