random map script early stages

flobi

Rewrite Civilization
Joined
Sep 17, 2005
Messages
68
Location
Constantinople
This is a random map script I've been working on:
http://tech.flobi.com/test/civmap/
(previously: until 20101106)
(previously: until 20101107)

I know, it seems a little heavy on the mountains sometimes (except in Chrome where they're all but absent...though Chrome is a wizard at the speed of displaying it). I don't know, I guess I am looking for opinions, comments, advice. Whatever. I attach a screenshot for those who don't have a web browser. ;)

I'd kinda like to make an HTML5 civ1 map editor, but for now, it's just a toy that makes interesting designs. Heck, I'd love to just reproduce the whole game in HTML5 and fix those pesky 20 year old bugs, but I'm sure there'd be copyright issues, lol.

If anyone knows where I could find what parts of the save file and map files do what (I'm curious about editing HEX in JavaScript, never done that before), that would help for sure, I don't know if anyone has ever documented that, but I can't seem to find anything. Anyways, thanks in advance.
 

Attachments

  • civmapgen.jpg
    civmapgen.jpg
    320.1 KB · Views: 161
Really cool! Keep up the good work. I like it!

You might want to limit the "available" area one more row top and bottom, and maybe 2 more columns on the left and right. The executable apparently runs into problems when you get too close to the edges.

Good luck trying to figure out an algorithm for rivers!

If you add a "write text file" button, we can use them in TerraForm to create games.

To know more about how/what Dack did, read all 7,000 posts in his TF thread.

Thanks!!!
 
jpciv, thanks. Is this the thread: TerraForm -- a map editor for CIV dos?

And, would you mind screenshoting an example of the edge errors you're seeing. I'm not seeing it, I guess. Thanks again. :)

It looks like this (below) is the pattern of the resources in the original, offset by a random and repeated over the map. Shouldn't be too hard to replicate. Don't have too many ideas about the rivers so far besides what would be obvious anyways. On the other hand, I haven't really contemplated them too much yet.

attachment.php


I did have an idea just now to speed up the script...I'm redrawing the entire map every iteration of the seed processing loop...but really, I only need to redraw the square of the seeds themselves and the 8 adjacent.
 

Attachments

  • bonus_map.png
    bonus_map.png
    1.7 KB · Views: 342
A while ago, I made a map generator too. The thread was probably too far buried for you to see it. If you like anything I did, you're free to copy it - or rather adapt it. I hope you know Python!
 
@UD Thanks for updating that for me. :) I had looked at the old script a little, when contemplating making this, but I'm not too familiar with python. I essentially came up with the logic in mine while laying in bed not sleeping for a few hours envisioning the growing continents like you see in my script if you leave "Display Growing" checked (it's still fun to watch even if I can't play any of these yet) after reading a bunch of other stuff including yours. The whole expanding seed idea, I guess I got from you though, as well as trying to keep mountains & hills near each other.

I think my next step will be to get some resources (inc. rivers) on the map and trying to save it. Oh, and I have to consider the bonus villages too, right?
 
Okay, so I update for it to add rivers, show the map faster, go a little lighter on the mountains (still haven't taken care of the Chrome...I don't see any mountains now in Chrome), take out the supposedly invalid diagonal ocean squares (and randomly @75% the single ocean squares just for good measure). The river chasing can still run into a problem of not wanting to intersect other rivers and fail to reach an ocean (like Tron lightcycles getting stuck). Oh, and I added resources...but the grassland resource is linked with the rest and not on the aprox 50% that it should be.
 
Grasslands pattern detected...will likely update soon:
 

Attachments

  • grasslands_bonus.png
    grasslands_bonus.png
    336 bytes · Views: 227
Normal bonuses are in a pattern...grassland ones are...makes one wonder if I'll find the same thing with villages...and perhaps other things...

By the way, the script has been updated with the grassland pattern.
 
Oh how weird, I never thought I'd find a pattern of the actual land mass, but it seems that it is this

XX
XO

where X is land and O is ocean. I've loaded 3 random maps so far and found no squares violating the pattern. And I thought about it, with that pattern, one needs not do a chasing or seeding, just spread in any direction from any landmass and the result will not cause the questionable ocean so no search for that would even be necessary.
 
So, I'm halfway through page 14 of TerraForm -- a map editor for CIV dos...apparently I picked a time to do this where I can't actually get TerraForm. Still haven't found too much help on the idea of saving this as far as the ordering of the file itself, but I've seen a lot of things that one would need to take into account when saving.

I'm kinda hoping that one doesn't need to open a prior .sve/.map file to create something from my script. I guess if it comes down to it, I can just have a dummy .sve/.map combo that it starts from.

I've updated the page (see first post): I made it show a blank (i.e. all ocean) map when it opens and added a little editing options on the side. Also removed the "alert(e.which)" making it when you click it gives you a number...kinda annoying, didn't really mean to push that part from dev. Sorry about that.

Still no loading or saving, no starting locations, or (etc.). As the thread says, "early stages." And, of course, I'm doing this all for fun, so anything that does or doesn't come out of it is...what it is.
 
Awesome! It's deff getting better.

As for the ability to input / output games, I recommend you follow Dack's example and just use a very simple text file. Check out the spoilers.zip file in the 1492 GOTM thread, and look at the mapout.txt file. If you download and play the scenario, you can easily see how the mapout.txt file represents the map.

http://forums.civfanatics.com/showthread.php?t=373721

Once you create the mapfile.txt with your program, just read it into TerraForm and save it. Voila!

You are correct, there is a pattern for which grasslands get shields

As for the special resources and goody huts, there are 32 variations, from 00 to 1F, is the one you have found is just one of 32 possible ones. For the most part, if you're building random maps, it doesn't matter which one you use, just pick one at random.

When it really matters is when you're building specific situations, and want huts or resources to be in specific places. Then you either play with the variables until you get which one that works, or more likely, pick one, and build the map specific to that particular set of resources.

Looks like rivers are working properly - you don't seem to have any "lost" rivers that go nowhere. Are you only allowing a river to start if it's touching an ocean square?

BTW, oceans get numbered as to their size (I believe), and if the ocean square isn't labeled as Ocean#1, then the AI civs won't build ships to sail on it. There are tons of weird quirks like this in the system - I hope you will enjoy finding them all!

I don't have any example of games that don't work at the edges, but there are some comments (I believe) somewhere in the TerraFoem thread.
 
I'm starting to understand why it takes a month and a half for the original program to get to the choose a difficulty menu...thanks everyone for your help :).
 
Back
Top Bottom