[MA] SDK and Python

Well that's the easy part, I got an idea that I would really want to add to the game but I it seems like it would be a beyond complicated code. Basically since the mod starts in 1900, having an empty world is unrealistic. Basically uo have the option to start with a preset world, that is much more realistic than civ. It would place cities, units, routes etc. All before the first turn. But the civs will be on different levels, so there won't be 18 close to equal medium size civs. Most of the civs would be 1 or 2 cities big, realisitcly creating parts like central america, much of Europe. Then several civs would be larger, some over vast areas of desert or tundra (like Russia, Canada, australia), others to represent USA, china, India etc. But those are minor details

Cities placement would be the hardest part, and I would defiantly need help, the rest I could handle with minor help. Something like routes would be on a simple basically get the terrain type and give a percent if there will be a route there. Sane thing with improvements.

Place buildings basically somewhat random, extra chance to get one if bigger population or are a stronger civ.

Place land units based on pop, if Capitol, strength of civ, randomness. Place naval units based on if they have naval buildings.

Place all ancient wonders randomly.

I am sure this is all possible but will take a lot of code. Will something this long crash cIV? Since I'm sure when the game loads it will rake minutes to go through this code. only thing that would be hard is city placement.
 
You know me pretty well, thus I leave it to Jamie :D
 
ahhh fine be like that. City placement is easy, you have a tool for that... I could make a change to the historical cities to add a player type to the coords aswell, if it's not -1 (no_Player) then on gamestart place a city at this coords with the name and given to that player. Lovely

the units and routes is something you have to do more manually. Defining simmilar dicts in another module (which imports HC) to defines routes on what plots units on what plots and improvements.

and no it won't crash civ, I am 90% certain of that...
 
why does it have to be different? Am I missing something?
 
It isnt a set map. The code that you have done is on city built it gets named something. What would happen with this code is during custom game, it can be any map script or any map size. Than on game load, if the option is enable, it automatically creates a random world, that looks modern. Cities will be placed randomly. So first there will be the capitols placed where the settlers are (after that, settler is deleted). Then all other cities will be placed. Some civs will get no more cities, some will get many. The whole world will be controlled by some civ or another. I am assuming it would make it very difficult to make the code be "smart" and have it so there are many one city civs, some medium, some large, have all the land taken up (culture too not just land) but not to have cities just randomly placed (so american cities are all together next to eachother, not randomly througout different continenets)
 
hmm... I think that is way out of my depth I'm afraid, I can't think of anything at the moment that would allow me to do this
 
Is there a way to find a random plot? So you find a random plot, check to make sure it doesnt belong to anything (and it is land), then check to see which civ is closest (by checking the plots around it) than place a city there. Run that 100 some times, then do a check of every plot of the same thing (dont want to do that first because it would probably go in order of the plots and so one specific civ would probably just be huge). By default, the randomness should grant some civs a lot of land (get a couple citites early and so it multiplys) and some have only 1 or 2 cities (because the random plots didnt land by them).

the only question is can you find the culture around them? Cant you get the x and y of the plot, and find it from there?
 
seems plaussible, random plts and not in radius of another city...

not sure about the culture atm...
 
You end up with cities in garbage locations
 
maybe you could write some code to ensure good sites then? make it a function...

just to ensure that cities have reasonable terrain, a couple of resources and stuff like that!
 
Advanced Start already does that beautifully, don't see a reason to write something like that
 
Because advanced start will not fill up the whole world or even close and it will not accurately have it like the real world, just still a bunch of 18 civs that are all the same size.

Locations don't matter, nowadays there are cities everywhere and where their isn't, the land is still owned. Locations really aren't that important in my opinion.

You do culture same as city. Can you check a plot to see if it is owned? Just like if u check if theirs another city in the radius, just check if there's culture, if not keep extending the area until you find it, or possibly if there isn't just a skip that plot and keep going until u find a plot with culture in it
 
Since this failed to interest me, I will just provide the pseudocode and see if Jamie wants to convert it to codes.

onGameStart
1) Check the start plot of each alive player. Build the capital and extend to fledging culture.
2) Create an empty list to store index of plots
3) Loop through every single plot and store the index into the list.
Exclude all impassable, water plots, and plots with culture since they are within city radius of capital. If you do not want to spawn on bonus, exclude as well.
I know there is a method to plot using the index, but there isn't a way to get the index from a plot.
Thus, you will have to "create" your own index.
For instance, store it as (x * 1000) + y
Thus, a plot with (51, 100) will be stored as 51100.
And when you need x and y from this index, just use index/1000 for x, and index%1000 for y.

4) Now use a while loop to keep spawning random plots while the list is not empty.
So each time you selected a random index, get the x and y and get the plot.
If there is a cultural plot within 2 or 3 radius from this selected plot, build a city here and assign it to that player.
Extend it to fledging culture as well.
Remove all 21 plots from the existing list, so the list gets smaller.
Keep looping till the list is empty and the world is filled up.
Of course, there might be some plots where there will never be cultural plot nearby, such as 1 tile islands.
Thus, beside the while loop not empty condition, you have to keep a counter as well, which increases each time you loop through.
If the counter reaches 10000 and list is still not empty, just break the loop.
 
I will read through this when I have time,

Unfortunatly time is something I don't really have :( Just started college and am there 9 till 4 everyday (bar friday when I leave at 2) and I'm not even taking computing :lol:
 
Time is the same problem for me. Huge update for the mod is taking months and should take a couple more :mad: (sidetracked from dead computer battery). When I got time though i could give it a shot - probably couldnt do plot index but I could probably do the other parts (once you get plot - the checks) probably wtih a lot of errors though - i understand python though a lot more than from last attempt at something
 
Top Bottom