Generating a large 2d world like map

by goosmaster   Last Updated September 01, 2019 19:05 PM

So I have this idea for a risk like game, but for this idea I would have to generate a procedural generated world. The problem being that my main programming knowledge is PHP (7). As far as I know it is not the best language to be generating anything with a large scale (both in therm of processing speed and memory consumption). I have looked at the php pack and unpack functions to save data while generating a world (and generating it in "chunks") along the way. But I found out that saving it to a mysql database was faster than encoding and saving it to binary files, also fetching and decoding from binary. So I decided it was not a route worth proceeding.

The main bottleneck is memory and speed, I do not need to generate a map often, but do need large maps. Think a 1024x1024 grid (or maybe even (but not more than) double that). And it needs to be loaded fast for the end user (going back to the whole chunks idea, I should only need to load (and render) a part of the map for the user.

With each "tile" containing data like: co-ordinates; biome type; height data and a few more unique data, like if it contains troops.

I found a nice javascript based world generator (MIT licensed) created by Azgaar; Azgaar's Fantasy Map Generator. But I would still like to tweak a few things about it and need to either decode it so my code could use the output. Or use the source code to rebuild it using php (or another language)

So my question(s):

Should I generate a earth-like world map with php, and accept that it has limitations regarding speed and memory constrains.

Or would it be beneficial to try to use the Azgaar's Fantasy Map Generator's output (svg) and decode it for a mysql database?

Or the third option; learn a new language to generate such a world (or find an open source equivalent and adapt it if needed). If so what language do you recommend?



Related Questions


Updated August 13, 2019 13:05 PM

Updated May 01, 2018 23:05 PM

Updated April 05, 2015 16:02 PM

Updated July 10, 2016 08:02 AM

Updated April 14, 2016 09:02 AM