Semi Random Map Generator
- TheWizardKs
- Posts: 27
- Joined: Tue Jul 31, 2007 7:27 am
Semi Random Map Generator
I am uploading the latest version of my program. It fully randomizes the RRT_Industries.xml file, placing industries down using the full map area, not just the 10x10. Also gone is the IndustryBase.txt problem. The program now parses all info from xml files. To this end some things may not work, but it would have to be a method unknown to me. And probably if you let me know, it can be addressed.
There is a detailed readme.txt included in the zip. Let me know if you have any issues.
**********EDIT - all below this is old **********
Hi everyone, hope all is well.
I think most everyone knows of the 'randomize' feature in SMR is stuck at 10x10 and if your map is a 15x15 there is a lot of wasted space. I aim to change that.
I need to know how does one figure the limits in StartX,StartY based on map size. I knew at one time but have forgotten.
I have started a program to randomly assign the out of town and in town industries. It is very very rough currently and I have a few hard coded workarounds to deal with the one specific 15x15 map I am using. I am however rather impressed with the initial results. The map has 37 towns on it and while I have not played with the relocate cities option yet, the industries have been randomized and I was able to play the game with no crashes. I am at a sort of standstill on how to deal with the different industries, keeping in mind that there are custom ones as well as the fact only 16 can be used in a map. So the problem is how do I code in the 'AI' of which In City industries get paired with which Out of City industries. I am leaning towards using the RRT_Industries.xml file in the custom assets\xml folder and parsing it each run. There's alot of things to decipher though which is the con of that. I currently made a text file with all the current map industries listed that was easy to use but not flexible. Any ideas how to do this?
The other issue I am concerned with is trying to take into consideration the actual terrain of the map. Currently I have not a lot of water but have seen coal mines jutting out sometimes. Any one care to formulate ideas on how to check this during randomization?
When I get a slightly better 'user friendly' version ready I will let some testers help beta it.
There is a detailed readme.txt included in the zip. Let me know if you have any issues.
**********EDIT - all below this is old **********
Hi everyone, hope all is well.
I think most everyone knows of the 'randomize' feature in SMR is stuck at 10x10 and if your map is a 15x15 there is a lot of wasted space. I aim to change that.
I need to know how does one figure the limits in StartX,StartY based on map size. I knew at one time but have forgotten.
I have started a program to randomly assign the out of town and in town industries. It is very very rough currently and I have a few hard coded workarounds to deal with the one specific 15x15 map I am using. I am however rather impressed with the initial results. The map has 37 towns on it and while I have not played with the relocate cities option yet, the industries have been randomized and I was able to play the game with no crashes. I am at a sort of standstill on how to deal with the different industries, keeping in mind that there are custom ones as well as the fact only 16 can be used in a map. So the problem is how do I code in the 'AI' of which In City industries get paired with which Out of City industries. I am leaning towards using the RRT_Industries.xml file in the custom assets\xml folder and parsing it each run. There's alot of things to decipher though which is the con of that. I currently made a text file with all the current map industries listed that was easy to use but not flexible. Any ideas how to do this?
The other issue I am concerned with is trying to take into consideration the actual terrain of the map. Currently I have not a lot of water but have seen coal mines jutting out sometimes. Any one care to formulate ideas on how to check this during randomization?
When I get a slightly better 'user friendly' version ready I will let some testers help beta it.
- Attachments
-
- SMR_Edit.zip
- Version 2.0
- (6.53 MiB) Downloaded 1079 times
Last edited by TheWizardKs on Tue Dec 21, 2010 1:47 pm, edited 1 time in total.
Re: Semi Random Map Generator
At the bottom of this page:
http://www.hookedgamers.com/gamewiki/Si ... ustom_maps
you'll find a talbe called 'Table of MiniMap Boundaries'. This should give you the info you need.
http://www.hookedgamers.com/gamewiki/Si ... ustom_maps
you'll find a talbe called 'Table of MiniMap Boundaries'. This should give you the info you need.
I'm correct 97% of the time..... who cares about the other 4%....
- TheWizardKs
- Posts: 27
- Joined: Tue Jul 31, 2007 7:27 am
Re: Semi Random Map Generator
A yes, very nice, thanks much!
- CalmDragon
- Posts: 137
- Joined: Thu Jun 07, 2007 7:08 pm
- Location: Los Angeles, California
- Contact:
Re: Semi Random Map Generator
I seem to remember 15x15 901 pixel maps randomizing alright with the function built into the game. It wasn't for you? Long Beach, San Francisco, and Sosaria all are 15x15 901 px game maps and randomize terrian and cities for me. Try them and let me know how they work for you. Or what maps are you having problems with that they only randomize 10x10 of the 601 pixel maps?
motherboard : Asus P5N-E SLI
processor: Dual Core 2.4 GHz
memory : 2046MB
video card: GeForce 8800GTS 640MB
operating system: winxp media
Display: 24" Dell at 1920x1200
processor: Dual Core 2.4 GHz
memory : 2046MB
video card: GeForce 8800GTS 640MB
operating system: winxp media
Display: 24" Dell at 1920x1200
Re: Semi Random Map Generator
I have a 24 x 24 map I'm working on, and when I do the Random Cities, I get a 1/4-of-the-map size blotch of cities in the center. The game seems to only use an 8 unit circle (10 x 10 being 10 units by 10 units) for everything that it has to place. Also, when you don't put in locations for Industries, it will put anywhere from 4 to 0 .... Zero ... of each one on the map. You can have 4 fisheries, but no canneries.
I think what he is working toward is instead of putting 231 for a location number, you put in SX, and a mini program generates a number from a negitive 112 to positive 412. Along with the other number, it gets placed. The out of town industries can also be done this way.
The in-towns may be a problem. If you generate the numbers, they may not match. One other way would be to load in the names of the cities and have the in-city Industries placed that way since the X, Y and rotation is not needed for in city Indusrty placement.
CalmDragon, try a Random City on the Florida Gold map and check for Passengers in Goods. All the cities should be in the center 3rd or so.
I think what he is working toward is instead of putting 231 for a location number, you put in SX, and a mini program generates a number from a negitive 112 to positive 412. Along with the other number, it gets placed. The out of town industries can also be done this way.
The in-towns may be a problem. If you generate the numbers, they may not match. One other way would be to load in the names of the cities and have the in-city Industries placed that way since the X, Y and rotation is not needed for in city Indusrty placement.
CalmDragon, try a Random City on the Florida Gold map and check for Passengers in Goods. All the cities should be in the center 3rd or so.
I'm correct 97% of the time..... who cares about the other 4%....
- TheWizardKs
- Posts: 27
- Joined: Tue Jul 31, 2007 7:27 am
Re: Semi Random Map Generator
Snoopy has it correct, when you choose randomize, the terrain is just fine, but the cities, industries all place down on a 10 x 10 as when the game was released.
I am reading the RRT_Industry file to get which ones are on the map, then have the program build an Industry.txt file that I edit manually. I am editing it with the number of Out of City Industries, followed by each industry as a string, then the number of In City Industries, followed by a list of them. I edit them so the first listed out of city corresponds with the first listed In city ( i.e. Out = Grain Farm then In = Food Plant ). This is one hurdle I have to get past eventually.
Then I read the RRT_Cities file to get the tag name, StartX, StartY, so I can place the In City Industries correctly.
It has worked very well actually and the only hold up so far is...well it takes a while to play a game you know? My testing can never be load it up and see, I have to finish the game.
If there is interest in playing with what I have so far I will upload it, but you have to understand the file has to be manually edited the first time you run it ( Industry.txt ) so it is not a friendly program yet. I also have the current map I am modding crashing to desktop and I think it's time to check the Min-Max x,y coords.
I am reading the RRT_Industry file to get which ones are on the map, then have the program build an Industry.txt file that I edit manually. I am editing it with the number of Out of City Industries, followed by each industry as a string, then the number of In City Industries, followed by a list of them. I edit them so the first listed out of city corresponds with the first listed In city ( i.e. Out = Grain Farm then In = Food Plant ). This is one hurdle I have to get past eventually.
Then I read the RRT_Cities file to get the tag name, StartX, StartY, so I can place the In City Industries correctly.
It has worked very well actually and the only hold up so far is...well it takes a while to play a game you know? My testing can never be load it up and see, I have to finish the game.
If there is interest in playing with what I have so far I will upload it, but you have to understand the file has to be manually edited the first time you run it ( Industry.txt ) so it is not a friendly program yet. I also have the current map I am modding crashing to desktop and I think it's time to check the Min-Max x,y coords.
Re: Semi Random Map Generator
Messing around a bit I have some RUFF numbers for you.
First thing. The top and left side are negitive, the right and bottom are positive. The 0,0 point is in the upper left quarter.
Map___top & left____bottom & right
10_______-100________375
12_______-150________435
14_______-200________500
Understand, you can get closer to the edges, but it may make it hard to reach while playing.
And just to confuse you a bit....You run random numbers to place Out-Of-City Industries. I take it you have a variable as to how many of each type you place?
From there I would guess you place the Cities, random size, 0 - 3, then random placement of them. From there you do the random placement of the In-City Industries. I'd say for that you would need a number or letter corresponding to each City. You then take an In-City Industry, generate a number for how many you want, then generate a number as to which City it goes into, somehow avoiding duplicates.
Do you plan on using existing maps? If you did, what Industries you use is already decided for you. All you would have to do is remove the existing locations and generate yours. Your needed Industry list would already be made.
On the location generating, you might want to round them off to the next ten, or something like that, just to keep from loosing a barn to a mine underneath it...... Water might also be a problem........
The idea gives a whole new set of maps.....
First thing. The top and left side are negitive, the right and bottom are positive. The 0,0 point is in the upper left quarter.
Map___top & left____bottom & right
10_______-100________375
12_______-150________435
14_______-200________500
Understand, you can get closer to the edges, but it may make it hard to reach while playing.
And just to confuse you a bit....You run random numbers to place Out-Of-City Industries. I take it you have a variable as to how many of each type you place?
From there I would guess you place the Cities, random size, 0 - 3, then random placement of them. From there you do the random placement of the In-City Industries. I'd say for that you would need a number or letter corresponding to each City. You then take an In-City Industry, generate a number for how many you want, then generate a number as to which City it goes into, somehow avoiding duplicates.
Do you plan on using existing maps? If you did, what Industries you use is already decided for you. All you would have to do is remove the existing locations and generate yours. Your needed Industry list would already be made.
On the location generating, you might want to round them off to the next ten, or something like that, just to keep from loosing a barn to a mine underneath it...... Water might also be a problem........
The idea gives a whole new set of maps.....
I'm correct 97% of the time..... who cares about the other 4%....
Re: Semi Random Map Generator
I would be interested in giving it a go so upload it and add a little doc with a few instructions on how to use it.TheWizardKs wrote: It has worked very well actually and the only hold up so far is...well it takes a while to play a game you know? My testing can never be load it up and see, I have to finish the game.
If there is interest in playing with what I have so far I will upload it, but you have to understand the file has to be manually edited the first time you run it ( Industry.txt ) so it is not a friendly program yet.
The you may get some help testing it with a few others.
Bobby's Sid Meier's Railroads Forums and Bobby's Sid Meier's Railroads Wiki
:: The Only Working & Up to date Wiki Now ::
:: The Only Working & Up to date Wiki Now ::
- TheWizardKs
- Posts: 27
- Joined: Tue Jul 31, 2007 7:27 am
Re: Semi Random Map Generator
I have not used VB5.0 for a long time, I thought it would compile a setup program with XP Home, but the setup wizard is only crashing. Maybe because I installed it to the D drive. Anyway, that's the next thing I work on. I have Visual Studio 2005 and DotNet 2003 but both of those are so much different than my old standard ;p
I'll figure out a way to get a beta program here soon. Details on what I have so far, for those that are curious anyway:
I do not randomize the cities at this point. Nor do I insert any, only the industries. I know it would be easy, if not easier to create random cities and place them on the map. Eventually that is planned using some sliders. For now I am concentrating on the industries, which has proven to be a real pain in the derriere. I have 2 checkboxes, 1- Intelligent Out City placement ( match the In City Industry with the Out City if checked, otherwise all random ) and 2- At least 1 In City Industry for all towns. I then have a slider that determines the chance to add an industry. Once the map is selected and the boxes checked, I read in the cities and use a special variable format that tracks up to 3 InCity and 3 OutCity Industries assigned to each city. I loop through every one and throw the dice, assign an industry if dice > chance and space is available. I then random the x,y and check for validity. (the CTD was partially to blame to values beyond what Snoopy shows above, as well as the number of industries had exceeded the games ability to handle, and it chose to simply exit without a warning one). Maps that were just over the limit would load up with zero computer players, but if you try to load 1 or more AI's then it would CTD. That's pretty much what I have at the moment. And I have worked on it most of the day which means coding about 1 hour and playing about 5.
Also I have no interaction with the .tga map file so industries are appearing in and over water (coal mines under water). That is going to be a fairly hard thing to get past I am guessing as I have no experience working with actual graphical data on map files. And yes, Snoopy, it opens up a new playability on maps. A couple times today I got bought out by the computer and am convinced it cheats. Alot. Oh well ;D
More to come.
I'll figure out a way to get a beta program here soon. Details on what I have so far, for those that are curious anyway:
I do not randomize the cities at this point. Nor do I insert any, only the industries. I know it would be easy, if not easier to create random cities and place them on the map. Eventually that is planned using some sliders. For now I am concentrating on the industries, which has proven to be a real pain in the derriere. I have 2 checkboxes, 1- Intelligent Out City placement ( match the In City Industry with the Out City if checked, otherwise all random ) and 2- At least 1 In City Industry for all towns. I then have a slider that determines the chance to add an industry. Once the map is selected and the boxes checked, I read in the cities and use a special variable format that tracks up to 3 InCity and 3 OutCity Industries assigned to each city. I loop through every one and throw the dice, assign an industry if dice > chance and space is available. I then random the x,y and check for validity. (the CTD was partially to blame to values beyond what Snoopy shows above, as well as the number of industries had exceeded the games ability to handle, and it chose to simply exit without a warning one). Maps that were just over the limit would load up with zero computer players, but if you try to load 1 or more AI's then it would CTD. That's pretty much what I have at the moment. And I have worked on it most of the day which means coding about 1 hour and playing about 5.
Also I have no interaction with the .tga map file so industries are appearing in and over water (coal mines under water). That is going to be a fairly hard thing to get past I am guessing as I have no experience working with actual graphical data on map files. And yes, Snoopy, it opens up a new playability on maps. A couple times today I got bought out by the computer and am convinced it cheats. Alot. Oh well ;D
More to come.
Re: Semi Random Map Generator
Laughing at your last remark, it hit me what you might be able to do as far as water problems. The water level is 40, give or take a couple. There is a 'Z' number in there somewhere (it doesn't match the 40 reference, they use one set of numbers for the editor and a different in the game), and if you could figure it out, you could do a roll, locate the spot and check the 'Z'. If it is below a certain number, toss that location and throw again.
If I stumble across anything else, I'll let you know
If I stumble across anything else, I'll let you know
I'm correct 97% of the time..... who cares about the other 4%....
- TheWizardKs
- Posts: 27
- Joined: Tue Jul 31, 2007 7:27 am
Re: Semi Random Map Generator
Figured out the setup (don't ask and I won't turn red).
Tested the install on my Vista Home Premium or some crap, whatever it has and it worked.
read the Industry.txt file for short docs
the program will NOT install a start program folder so you will have to do that yourself.
Tested the install on my Vista Home Premium or some crap, whatever it has and it worked.
read the Industry.txt file for short docs
the program will NOT install a start program folder so you will have to do that yourself.
- Attachments
-
- Setup.zip
- Zipped with WinRar...and the files are packed somewhat with VB installer (think expand.exe ...DOS and I forget now) so just run setup.exe and choose folder to install to
- (1.44 MiB) Downloaded 1009 times
- TheWizardKs
- Posts: 27
- Joined: Tue Jul 31, 2007 7:27 am
Re: Semi Random Map Generator
Yes this is what I need to do, but how do you read a .tga file? Especially in a program written by MS that allows extensions bmp gif jpg for the most part only. I don't really want to study the format of tga files and build a map by reading binary input from the map file.The water level is 40, give or take a couple. There is a 'Z' number in there somewhere
There are some checks I need to put in the beta program yet, such as distance from one Out City industry to another, I do not do this check so you may see them on top of each other. Also, I only check distance from the linked In City industry for now so industries can be on top of other cities as well.
- TheWizardKs
- Posts: 27
- Joined: Tue Jul 31, 2007 7:27 am
Re: Semi Random Map Generator
looks like 2 people DL'd the beta, any luck using it?
I have managed to incorporate water testing and just now created my first map with the code. It said one industry is in water, now I load up to see if I did good.
I definitely see the gray scale map on my form, so I am getting it imported correctly, there is hope.
This achievement has prompted me to consider possible terrain altering as a feature, but as I mentioned, I am not very graphics orientated.
Also, I have included full checks on distance from all entities and added a slider to set average distance desired
The parsing of the main Industry.xml file still looms large, I am dreading it really.
More to come...
I have managed to incorporate water testing and just now created my first map with the code. It said one industry is in water, now I load up to see if I did good.
I definitely see the gray scale map on my form, so I am getting it imported correctly, there is hope.
This achievement has prompted me to consider possible terrain altering as a feature, but as I mentioned, I am not very graphics orientated.
Also, I have included full checks on distance from all entities and added a slider to set average distance desired
The parsing of the main Industry.xml file still looms large, I am dreading it really.
More to come...
Re: Semi Random Map Generator
Now that you have the water worked out, or close to it, you maay want to look to the other extreme, certain out-of-city Industries in the mountains. Mining may be fine up there, but it get a little hard to harvest when the next row may send you sliding down a mountainside.....and rocks don't grow grain to well.....
I was one of the downloads, and tho I did look it over, I'm a part of STEP Inc which is doing a lot of work on some new stuff for this game. I haven't really had time to do much more than look it over.
I was one of the downloads, and tho I did look it over, I'm a part of STEP Inc which is doing a lot of work on some new stuff for this game. I haven't really had time to do much more than look it over.
I'm correct 97% of the time..... who cares about the other 4%....
Re: Semi Random Map Generator
downloaded it but on installation it asks for the path put it in and it throws an error cant find path.TheWizardKs wrote:looks like 2 people DL'd the beta, any luck using it?
Bobby's Sid Meier's Railroads Forums and Bobby's Sid Meier's Railroads Wiki
:: The Only Working & Up to date Wiki Now ::
:: The Only Working & Up to date Wiki Now ::