Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3 4 ... 7

Author Topic: History Generator Simulator  (Read 26421 times)

Illyris

  • Bay Watcher
    • View Profile
Re: History Generator Simulator
« Reply #15 on: October 13, 2015, 12:29:22 pm »

.
Logged

kytuzian

  • Bay Watcher
    • View Profile
    • Kytuzian - Youtube
Re: History Generator Simulator
« Reply #16 on: October 13, 2015, 12:33:15 pm »

Bug found. 

It freezes sometimes after a battle when reinforcements don't work. 

I don't remember exactly what changes I made, but here is the newer version, and I believe it fixes that bug:
http://www.mediafire.com/download/1myv71lwx89me7b/History+Generator-2015-10-13.zip

One of the major changes is that there is now an event log (for trade agreements, declarations of war).
« Last Edit: October 13, 2015, 07:39:31 pm by kytuzian »
Logged

alamoes

  • Bay Watcher
    • View Profile
Re: History Generator Simulator
« Reply #17 on: October 13, 2015, 04:02:50 pm »

Thank you. 
Logged

kytuzian

  • Bay Watcher
    • View Profile
    • Kytuzian - Youtube
Re: History Generator Simulator
« Reply #18 on: December 31, 2015, 09:00:07 am »

Alrighty. New version here, several changes, a couple of which is pretty major.

Download:
http://www.mediafire.com/download/kky29wl5ou70pli/History+Generator-2015-12-31.zip

Major Changes:
The world is now made of cells (tiles, if you like). Currently they're 5x5 pixels, but you can change the value to whatever you want in utility.py, its the CELL_SIZE variable.

Cities are no longer circles, but a bunch of adjacent cells. They expand by taking on more cells, and are more likely to take cells that are already surrounded by several owned cells.

Groups no longer have varying movement speed but all move at the same speed. All groups take up exactly one cell, regardless of actual size.

Minor Changes:
Nations now have capital cities. These don't really do anything, except the capturing nation gains more morale when they capital an enemy's capital, and the losing nation loses more morale. At the moment, both of these values are twice what capturing/losing a normal city is, but I could change it to be more drastic pretty easily. A new capital is chosen randomly, but weighted by population, so larger cities have a higher chance of becoming the new capital.

Non-religious wars are now more likely to be fought between nations that are closer together.
Attacks are now more likely to be made by nations on cities that are closer to one of their cities.
Both of these changes are pretty much the same, instead of just being a random choice of one of the nations/cities to attack, its now weighted by distance. This only makes sense, as you are much more likely to be angry with your neighbors than with people halfway across the world, and its must more logistical to attack the people who are close to you.

Major Bug Fix:
Fixed a bug where a units upgrades were sometimes set to None, resulting in a plethora of issues. I have yet to test it by running it all night or anything, but it run for a little bit without bugs--enough, at least, for me to say its relatively stable.

Minor bug fixes:
Like, probably some, but I don't really remember any of them.
« Last Edit: December 31, 2015, 09:08:05 am by kytuzian »
Logged

Antsan

  • Bay Watcher
    • View Profile
Re: History Generator Simulator
« Reply #19 on: January 01, 2016, 08:10:26 am »

I found a bug:

Code: [Select]
The Meritocracy of Zouym has triumphed with 54 remaining troops!
They have taken the city of Udmqx from The People's Oligarchy of Xa.
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1539, in __call__
    return self.func(*args)
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 590, in callit
    func(*args)
  File "./history_generator.py", line 129, in main_loop
    i.move_armies(flatten([nation.moving_armies for nation in self.nations if nation != i]))
  File "/home/thomas/Downloads/Spiele/History Generator/History Generator/civil.py", line 348, in move_armies
    moving_army.step(armies)
  File "/home/thomas/Downloads/Spiele/History Generator/History Generator/group.py", line 25, in step
    self.on_end(self)
  File "./history_generator.py", line 314, in do
    self.attack(attacker, attacker_city, attacking.members, defender, city)
  File "./history_generator.py", line 334, in attack
    if not battle.check_end_battle():
  File "/home/thomas/Downloads/Spiele/History Generator/History Generator/martial.py", line 516, in check_end_battle
    self.battle_over(self)
  File "./history_generator.py", line 362, in end_battle
    attack_city.capture(battle.a_army, a)
  File "/home/thomas/Downloads/Spiele/History Generator/History Generator/civil.py", line 48, in capture
    self.nation.cities.remove(self)
ValueError: list.remove(x): x not in list
can't invoke "event" command: application has been destroyed
    while executing
"event generate $w <<ThemeChanged>>"
    (procedure "ttk::ThemeChanged" line 6)
    invoked from within
"ttk::ThemeChanged"
Logged
Taste my Paci-Fist

kytuzian

  • Bay Watcher
    • View Profile
    • Kytuzian - Youtube
Re: History Generator Simulator
« Reply #20 on: January 01, 2016, 08:54:52 am »

Yep, yep, got that one, along with several others and some new features. I do appreciate it though.

Download:
http://www.mediafire.com/download/47uyue9xrqdd4bn/History+Generator-2016-01-01.zip

2016-01-01

Major changes:
- Cities now have two types of cells, city and surrounding. Surrounding generates food, people consume food. If there isn't enough food, city tiles can switch into surrounding tiles, and surrounding tiles can be lost altogether.
- If two nations have neighboring cities, they must either be at war with each other or trading with each other. They can no longer be neutral.
- Cities now recruit troops on a monthly, rather than yearly, basis. This should drastically increase the size of battles.

Minor changes:
- Removed cornsilk and snow as possible colors for nations, because they're essentially white and can't really be seen.
- Added WAY more colors for nations.
- Changed default cell size from 5 to 4.
- City names now show above the average location of all their cells, as opposed to just their first cell, as it previously worked.
- Cities no longer change their name when their ownership is changed.
- Battle's window title now shows the name of the city being fought for.
- Tweaked rate at which nations will trade with each other, so trading is less likely.
- Increase rate at which nations declare war for non-religious purposes.
- Added morale bonus for cities which have enough food to feed themselves.
- Decreased chance of revolts.
- Doubled group movement speed.
- Factored the number of nations into the revolt chance. (More nations = fewer revolts)
- Greatly increased the cost of founding cities (10x more expensive).
- Decreased soldier's recruitment cost and upkeep.
- Armies will now return to their owning nations cities if the city they meant to attack is no longer of the war.
- Reinforcing armies will now attack their destination if it has been taken over by an enemy. Otherwise, they will also return to the original nation.
- Armies from defeated cities will now leave and return to another city of the nation if there is one. If there isn't one, they will stay and fight to the end.
- Removed the header for each month, instead printing the date along with each message.
- Added this changelog file to the release.

Bug fixes:
- Fixed bug where crash would occur when city had already been taken and was attacked again.
- Fixed bug where nations could trade with nations they were already at war with.
- Fixed issue with reinforcing other cities hanging up the game.
- Stopped nations from declaring war on themselves, because that's stupid.

kytuzian

  • Bay Watcher
    • View Profile
    • Kytuzian - Youtube
Re: History Generator Simulator
« Reply #21 on: January 02, 2016, 05:45:28 pm »

Finally starting to add some GUI to this program, hopefully it will be more enjoyable now that you can sort of interact with it (although still not directly influence anything yourself, of course).

Download:
http://www.mediafire.com/download/pupxhfv1a2e3t5z/History+Generator-2016-01-02.zip

Changes:
Major changes:
- Added fairly simple GUI to a new control window to allow for the control of time passing. Run continuously makes the simulation keep running until the box is ticked again.
- Garrisons are no longer a separate army, but rather randomly drawn from the city's population (at most half of the population) when it is attacked.
- Armies now consume food, and will partially disband if there isn't enough food (a random amount, based on how much food is missing).
- Added GUI for examining cells and cities (just click on a cell to open it).

Minor changes:
- Added more constants instead of magic numbers at the top of various files.
- Allowed troops to defend themselves against projectiles.
- Gave units more ammunition based on the number of soldiers in their unit and their discipline.
- Removed more printing from console.
- Added the current year to the main window title.
- Tuned down soldier costs a little, to decrease ridiculously large army sizes.
- Added a display for the city's population and army size.
- Cities can now completely starve. This shoud fix the problem with millions of little cities clogging up the map view.
- Fewer people leave cities when there isn't enough food to feed all of them (randomized).
- Not having enough food now decreases morale (in addition to increasing morale when there is enough food).
- Cities are now more likely to expand when they have more surrounding farmland.
- Increased chance for caravans to go the nation's own cities over trade partners.
- Nations can no longer have the same color (although some colors are pretty similar anyway).
- Removed some similar colors.
- Slowed down the default simulation speed (delay between steps).

Bug fixes:
- Fixed bug that made it more or less impossible for cities to actually build any improvements.
- Fixed bug where soldiers would use their opponents discipline to determine their fatigue.
- Fixed bug where army couldn't return if an attack failed and its nation lost all its cities.
- Fixed bug where losses wouldn't scale with FOOD_PER_PERSON.
- Fixed bug where offices wouldn't actually be simulated.

kytuzian

  • Bay Watcher
    • View Profile
    • Kytuzian - Youtube
Re: History Generator Simulator
« Reply #22 on: January 03, 2016, 06:34:09 pm »

Alright, some more changes, mostly just adding new GUIs to inspect various aspects of the simulation. Also I made a video explaining how to install and run the simulator:
https://www.youtube.com/watch?v=QHqwqbvspxQ

Download:
http://www.mediafire.com/download/z52vuy847f8dp6c/History+Generator-2016-01-03.zip

Major changes:
- Created informational GUIs for nations, religions, and armies.

Minor changes:
- Stopped cell information window from opening on a focus switch to the map view.
- Added a city founded event.
- Added city's history to its information window.
- Food now spoils based on several factors, the amount of food, the age of the city, and the number of cells in the city.
- Reorganzing some event data.
- Increased the average life expectancy.

Bux fixes:
- Fixed crash when attempting to add more improvements.
- Fixed issue with cities not producing any money.
- Fixed issue with troop radius not properly scaling.

My Name is Immaterial

  • Bay Watcher
    • View Profile
Re: History Generator Simulator
« Reply #23 on: January 03, 2016, 08:08:56 pm »

so many updates
i've got whiplash
:P

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: History Generator Simulator
« Reply #24 on: January 04, 2016, 09:45:52 am »

No screenshots? :o
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

MarcAFK

  • Bay Watcher
  • [INSANITY INTENSIFIES]
    • View Profile
Re: History Generator Simulator
« Reply #25 on: January 04, 2016, 09:51:16 am »

Very interesting.
Logged
They're nearly as bad as badgers. Build a couple of anti-buzzard SAM sites marksdwarf towers and your fortress will look like Baghdad in 2003 from all the aerial bolt spam. You waste a lot of ammo and everything is covered in unslightly exploded buzzard bits and broken bolts.

Antsan

  • Bay Watcher
    • View Profile
Re: History Generator Simulator
« Reply #26 on: January 04, 2016, 09:56:48 am »

I haven't checked the latest version yet, but unless this means what I want (which I doubt)
Quote
- Stopped cell information window from opening on a focus switch to the map view.
Could you add an option to not display battles? It's annoying when I let this run in the background and every two seconds the battle window pops up in front of whatever I am doing at the time.
Logged
Taste my Paci-Fist

Sacasco

  • Bay Watcher
    • View Profile
Re: History Generator Simulator
« Reply #27 on: January 04, 2016, 04:07:10 pm »

Wow. I am incredibly impressed. How have I never seen this before?
I've thought occasionally about how I'd do something like this and while you've approached it very differently to my thoughts, I can't argue with the results.
You seem to have built, looking through a couple of the scripts very briefly, a lot which isn't yet used. I'm curious, what are you planning to use people and offices for? (Unless I'm being stupid and have missed it...)
Are the reinforcements other armies arriving or something else entirely? How are you working out the rate at which reinforcements arrive and how many start on the battlefield?
I don't know whether this is a bug or intended behaviour (the eternal conundrum...), but most nations seem to be using almost entirely ranged units.

A few comments:
  • In battle, I'd make the arrows fly faster. As in, at least two or three times as fast. Archers seem to be having a lot of trouble dealing with smaller units or fast-moving ones, and that could deal with that problem, as well as improving their ability to deal with a large number of units. This should also stop units running out of ammunition so quickly.
  • I'd recommend removing some of the lighter colours, as I am having difficulty seeing them on the world map, and find it impossible to see their arrows, especially.
  • Some battles last a long time, simply because the reinforcements are coming on so slowly. Like I said earlier, I don't know how it works, but it seems a bit odd having over 700 reinforcements arriving in units of 10 at a time.
  • I'd also either make the armies smaller or have each individual represent multiple soldiers. I feel that the battles are slightly too large for the system you're using.

So yes, seriously impressed by this and looking forward to seeing it progress!
« Last Edit: January 04, 2016, 04:28:24 pm by Sacasco »
Logged

kytuzian

  • Bay Watcher
    • View Profile
    • Kytuzian - Youtube
Re: History Generator Simulator
« Reply #28 on: January 04, 2016, 11:24:31 pm »

so many updates
i've got whiplash
:P

And now, for another update:

The biggest changes here are the religion ones, although there are some other significant ones.

Download:
http://www.mediafire.com/download/314aisep5mbvhbl/History+Generator-2016-01-04.zip

Major changes:
- Cities from the same nation now merge together when they have a neighboring square, ideally reducing the overall amount of overlapping cities. Merged cities will display events from all previous merged cities.
- Religions tolerance is no longer a single number. It is now calculated from a base tolerance, modified by the gods domains and their importances.
- Religions can now change over time, changing their tolerance (gods can be added and removed from the pantheon, assuming they're polytheistic).
- Added lots of new events for all the religion stuff.

Minor changes:
- Events are now outputted on a monthly, rather than yearly, basis.
- Reduced the chance of religions being monotheistic (20% by default).
- Events in the nation/city display screens are now displayed in chronological order (as opposed to the no order from before).
- Made tolerance for religions actually make sense (higher tolerance is more tolerant, rather than less).
- Gods now have an importance attributes that tracks how important the god is to the civilization.
- Keeping the civilization's capital city for a year adds morale.
- Added a new option to the main control screen that allows battle windows to be minimized by default.
- The controls window will now reopen if closed.
- People now have an effectiveness stat that affects how well they perform the duties of their office (higher tax multipliers).
- Offices can now provide a morale bonus every year for the nation.

Bug fixes:
- Fixed bug where nation actually could be the same color as each other.
- Fixed bug where gods sometimes displayed no domains in the information window.

No screenshots? :o

I just added a couple basic ones to the OP. I should probably start adding them with updates from now on.

I haven't checked the latest version yet, but unless this means what I want (which I doubt)
Quote
- Stopped cell information window from opening on a focus switch to the map view.
Could you add an option to not display battles? It's annoying when I let this run in the background and every two seconds the battle window pops up in front of whatever I am doing at the time.

You're right, that means that the first click (to focus on the window when its not already focused), won't open the information window for the cell. However, I did address your problem in this release, there's now a checkbox you can click on and all the battle windows will start minimized instead of popping up over whatever you're doing.

Wow. I am incredibly impressed. How have I never seen this before?
I've thought occasionally about how I'd do something like this and while you've approached it very differently to my thoughts, I can't argue with the results.
You seem to have built, looking through a couple of the scripts very briefly, a lot which isn't yet used. I'm curious, what are you planning to use people and offices for? (Unless I'm being stupid and have missed it...)
Are the reinforcements other armies arriving or something else entirely? How are you working out the rate at which reinforcements arrive and how many start on the battlefield?
I don't know whether this is a bug or intended behaviour (the eternal conundrum...), but most nations seem to be using almost entirely ranged units.

A few comments:
  • In battle, I'd make the arrows fly faster. As in, at least two or three times as fast. Archers seem to be having a lot of trouble dealing with smaller units or fast-moving ones, and that could deal with that problem, as well as improving their ability to deal with a large number of units. This should also stop units running out of ammunition so quickly.
  • I'd recommend removing some of the lighter colours, as I am having difficulty seeing them on the world map, and find it impossible to see their arrows, especially.
  • Some battles last a long time, simply because the reinforcements are coming on so slowly. Like I said earlier, I don't know how it works, but it seems a bit odd having over 700 reinforcements arriving in units of 10 at a time.
  • I'd also either make the armies smaller or have each individual represent multiple soldiers. I feel that the battles are slightly too large for the system you're using.

So yes, seriously impressed by this and looking forward to seeing it progress!

Thank you! Out of curiosity, what's different from the way you would have approached it? And yes, you're correct, there's a lot that has no use or minimal use (people and offices are among them, as offices do affect the amount of money gained from taxes, but that's pretty much it). There's also alliances, but those do literally nothing. I finally fleshed out religions a bit, but I plan to do a lot more there too.

Reinforcements are more troops from the same army arriving. Essentially, each battle is a series of skirmishes. I created this system because it made the battles run much much faster, having 10000, 20000, or possibly more troops on the screen at a time is just too slow. As for using all ranged units, well, they shouldn't. It's a 50-50 chance for each unit type, so it should be pretty even. Based on my own observations, it seems to be working as intended (although perhaps that's not the right ratio for ranged to non-ranged unit types, but that's a separate problem).

  • Yes, that is quite the issue. I think I'm also going to make ranged units aim ahead of their targets a little (although I don't want to slow down the battles too much). More ammo might be an option, but I could also make them shoot more slowly and increase projectile damage.
  • Yes I think the battles do need fixing, because I think the numbers of soldiers in the armies is reasonable, but the length of the battle isn't (like I said before, 20000 troops or more, can take more than half an hour). I'm not exactly sure what the solution is, though. Having each soldier represent several people seems reasonable, but also less epic. It might also do well if I could optimize the battles so I could double the size or something like that.

Thanks again!

Antsan

  • Bay Watcher
    • View Profile
Re: History Generator Simulator
« Reply #29 on: January 05, 2016, 12:48:07 am »

You're right, that means that the first click (to focus on the window when its not already focused), won't open the information window for the cell. However, I did address your problem in this release, there's now a checkbox you can click on and all the battle windows will start minimized instead of popping up over whatever you're doing.
Thanks! That helps a lot.

Quote
Reinforcements are more troops from the same army arriving. Essentially, each battle is a series of skirmishes. I created this system because it made the battles run much much faster, having 10000, 20000, or possibly more troops on the screen at a time is just too slow. As for using all ranged units, well, they shouldn't. It's a 50-50 chance for each unit type, so it should be pretty even. Based on my own observations, it seems to be working as intended (although perhaps that's not the right ratio for ranged to non-ranged unit types, but that's a separate problem).
I think I have seen that there are different unit types (further divided than only ranged/close combat, based on unit size, attack/defense, movement speed…). It also seems that reinforcements always arrive in a certain order, that is, first comes one unit type and when those are all done for the next unit type appears and so on.
It seems strange.
Also it often enough happens that one army sends much more per skirmish than the other one despite having less reinforcements overall. The army sending more troops at once seems to be at an advantage.
Some fights can be pretty one-sided, completely independent of unit size. Some units just mop up opposing units. It almost seems as if one soldier there can kill hundreds of enemies before dying. Just now I observed a battle where close-combat units were doing moderate damage to ranged units. When the ranged units ran out of ammo and went to close combat themselves, they suddenly dominated the battlefield.
Logged
Taste my Paci-Fist
Pages: 1 [2] 3 4 ... 7