Official Codex Discord Server

  1. Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.
    Dismiss Notice

Why end turn take so long?

Discussion in 'Strategy and Simulation' started by Reapa, Oct 23, 2015.

  1. Reapa Doom Preacher

    Reapa
    Joined:
    Jul 10, 2009
    Messages:
    1,915
    Location:
    Germany
    Is it just me or did games like Heroes of Might and Magic 3, Master of Magic, Eador: Genesis process enemy turns faster than the new ones like Heroes 7, Sorcerer King, Eador: Master of a broken World? I can't imagine newer graphics or even 3d landscape should affect waiting time in any way especially behind the fog of war and the A.I. is in most cases even more incompetent than it was in the older games. Heck, even features like equipment, crafting, magic research available spells have gotten fewer and fewer so it should take considerably less time for the pc to decide what to do in a turn.
    Anyone out there got any insight into this?

    Update:
    It seems with Eador: Masters of a Broken World the graphics do get in the way of faster turns since the game is made for dual cores and maxes them out on idle on lowest settings. tested on amd 3.8ghz x4 and geforce gtx 650ti with different affinity settings. the game peaks at 50% cpu usage on 3 or 4 core affinity and 100% on two cores in idle.
    I'm still interested in any other games and your thoughts on the matter so keep it going.
     
    Last edited: Oct 24, 2015
    ^ Top  
  2. Damned Registrations Prestigious Gentleman Furry Weeaboo Nazi Nihilist

    Damned Registrations
    Joined:
    Feb 24, 2007
    Messages:
    13,839
    Watching the dev behind Civ 4 in an interview a while ago made me think a lot of AI these days is preoccupied with a lot of invisible rules that the player wouldn't directly notice; rules designed to make the AI players feel either more human, more fair, or more in character. I think older games generally didn't pay much attention to those sorts of things and settled for a relatively quick and dirty 'whatever gives some sort of challenge'.
     
    • Brofist Brofist x 2
    ^ Top  
  3. Raapys Arcane

    Raapys
    Joined:
    Jun 7, 2007
    Messages:
    4,840
    Unless the game world simulation is very complex(rarely true these days), most of the turn processing time is generally spent on pathfinding and/or resolving battles. Pathfinding should be approximately the same in any grid/hex based system, now and then, so the difference is likely down to the battles. In ye olden days they'd usually resolve them using some very simple algorithm(which often produced absurd results), these days they're prolly a bit more thorough.

    That said, I don't really think there is any excuse. Today you have 4 very quick CPU cores to play around with, so the fault is likely with poor programmers who can't multithread the turn processing properly or managers unwilling to spend their budgets on it(i.e. slow turn processing is "good enough").
     
    ^ Top  
  4. The Brazilian Slaughter Arcane

    The Brazilian Slaughter
    Joined:
    May 11, 2007
    Messages:
    1,872,027
    Location:
    Belém do Pará
    Bad optimisation is more likely.
    There's no excuse for end turn in a 8 faction 4X taking more than five seconds in days where a good PC can run a Pdox game with far more data.
     
    • Brofist Brofist x 1
    ^ Top  
  5. Reapa Doom Preacher

    Reapa
    Joined:
    Jul 10, 2009
    Messages:
    1,915
    Location:
    Germany
    pathfinding for player seems pretty much instant. I see no reason for it to take longer for pc behind fog of war. battle outcomes also instant with reasonable results. pretty sure Damned is onto something there.
    especially since heroes 7 bragged about A.I. speed having been exponentially increased with the latest patch. i'm pretty sure they just cut out some rules there instead of remaking the whole A.I.
     
    ^ Top  
  6. Reapa Doom Preacher

    Reapa
    Joined:
    Jul 10, 2009
    Messages:
    1,915
    Location:
    Germany
    with a 4core processor at peak levels i expect to wait considerably less than 5 seconds. perhaps less than a second. the thing is, if you watch your task manager you can see the games making you wait without maxing out the processor graph. clearly something stupid is happening there. if you have any resources to spare while making the player wait you're doing something very very wrong.
     
    ^ Top  
  7. Raapys Arcane

    Raapys
    Joined:
    Jun 7, 2007
    Messages:
    4,840
    Keep in mind the AI does a lot more pathfinding than just sending troops here and there though. He also has to check all other armies, where they might be heading and how long they'll take to get there, possible interception courses, etc. He also needs to develop lots of possible paths for his armies every turn to determine which path gives him the better overall outcome. It becomes part of the decision making process just like it is for the player, except the AI has to do it all by the book. A single fact that you can determine at a glance can take the AI millions of cycles to compute.
     
    • Brofist Brofist x 1
    ^ Top  
  8. Reapa Doom Preacher

    Reapa
    Joined:
    Jul 10, 2009
    Messages:
    1,915
    Location:
    Germany
    there's a very special case that, unlike the others where you compare speeds between similar but different games with different devs and so on, is basically the same game. Eador: Genesis and Eador: Masters of the Broken World. it's the very reason why i even had to think about the waiting times on end turn and opened this thread. while you can make a colossal shard in genesis with 16 enemies and get instant end turns, doing the same in masters of the broken world makes it nearly unplayable. you get to build one building, send your hero on one quest, often enough resulting in only one event without any battles and then have to wait for what feels like half a minute to get to do the same thing again. what could possibly have changed in the 3d remake of that game that made it lose all its enemy turn processing speed?
     
    ^ Top  
  9. Reapa Doom Preacher

    Reapa
    Joined:
    Jul 10, 2009
    Messages:
    1,915
    Location:
    Germany
    that's not just pathfinding then, it's all the strategy it has to compute save for units and resource management. it's been done before and it was faster and should have become even faster with newer processors. especially since maps as a rule have become smaller due to 3d, high def, and all the shit that pushes a computer to its limits in the graphics department. heroes 7: 7gb ram used with a 95% gpu use.
     
    ^ Top  
  10. Nekot-The-Brave Prestigious Gentleman Arcane Patron

    Nekot-The-Brave
    Joined:
    Jul 26, 2015
    Messages:
    1,280
    PC RPG Website of the Year, 2015 Codex 2016 - The Age of Grimoire Make the Codex Great Again! Grab the Codex by the pussy Divinity: Original Sin 2 BattleTech Bubbles In Memoria A Beautifully Desolate Campaign Pillars of Eternity 2: Deadfire Pathfinder: Kingmaker
    Inefficient AI creation. I'm sure that the port to MOTBW was not 'perfect' and thus could not possibly be the same as the system in Genesis. I suppose they tried to make the AI 'more complex' for the port and lost a lot of the efficiency that the previous system had.
     
    ^ Top  
  11. Reapa Doom Preacher

    Reapa
    Joined:
    Jul 10, 2009
    Messages:
    1,915
    Location:
    Germany
    i imagine that it would be a copy paste thing when you consider that you have the same units, the same landscape, the same heroes, the same story, the same resources and buildings... the first guy, beta tester, whatever that plays the game should immediately see a huge difference in waiting time to the previous game. even if you don't max out the enemies you still get to wait a lot for each one you have and not late in the game but at the very beginning. so when you see that the game plays so poorly in comparison to the old, why would you keep any A.I. complexity you've added? then again i had to reduce the refresh delay from default 40 to 1 and poll mouse delay from 25 to 1 to in genesis config to speed up the game and prevent the mouse from skipping. maybe it's all a tweak issue but MOTBW doesn't have a detailed config file. it has a config.exe but solely for graphic tweaks. and i'm fairly positive even with genesis the refresh delay has no effect on enemy turn processing. i'd have to test that.
     
    Last edited: Oct 24, 2015
    ^ Top  
  12. Average Manatee Prestigious Gentleman Arcane

    Average Manatee
    Joined:
    Jan 7, 2012
    Messages:
    10,134
    You're right, it can take millions of cycles.

    My i7 should therefore take about 1ms to process turns for 12 AIs.
     
    ^ Top  
  13. Reapa Doom Preacher

    Reapa
    Joined:
    Jul 10, 2009
    Messages:
    1,915
    Location:
    Germany
    you're probably not gonna get multithreaded A.I. support from simple devs of cheap games, but one core should be enough for about the same speed. it's just not getting used at full capacity for whatever reason. in fact i just watched MOTBW during the enemy turns and there was no noticeable difference in processor usage to the game running idle! whatever the game does, it seems to be actively limiting the A.I. processor usage at extremely low levels.
    EDIT: the game also never goes over 50% of whole processor usage so it doesn't even support 4 cores. gonna try limiting it to 2 and see if it fares better.
    EDIT 2: Alright, the game maxes out 2 cores on idle so no surprise there if it doesn't support 4 cores and takes a while on enemy turns. there are 2 things that can be done: overclock or tweak whatever the game has to process on idle. funny thing is whatever i said in the beginning about graphics not being able to be the reason behind slow enemy turns proves to be wrong. in fact they might just be the only reason for slow enemy turns apart from cheap programming.
     
    Last edited: Oct 24, 2015
    ^ Top  
  14. dag0net Arcane

    dag0net
    Joined:
    Aug 5, 2014
    Messages:
    2,734
    Raapys clearly said "a single fact that you can determine at a glance."
     
    ^ Top  
  15. Reapa Doom Preacher

    Reapa
    Joined:
    Jul 10, 2009
    Messages:
    1,915
    Location:
    Germany
    that one fact is a whole turn. in the case of heroes for example you see resources you can reach, you go get them. you see army in reach you check for how potent in comparison to yours and attack or run away. simple stuff.
     
    ^ Top  
  16. dag0net Arcane

    dag0net
    Joined:
    Aug 5, 2014
    Messages:
    2,734
    If it's really that simple I can't imagine why you'd bother playing it, but.. each to their own I guess.
     
    ^ Top  
  17. Average Manatee Prestigious Gentleman Arcane

    Average Manatee
    Joined:
    Jan 7, 2012
    Messages:
    10,134
    I did say about. I don't think anyone would mind if turns took 50 ms.

    Never played MOTBW but it's probably slow because the game is literally animating the movements of unseen stuff rather than just making it instant.

    Graphical fidelity almost certainly has zero relation to the turn speed.
     
    ^ Top  
  18. Reapa Doom Preacher

    Reapa
    Joined:
    Jul 10, 2009
    Messages:
    1,915
    Location:
    Germany
    if the game get's slower after the 500th turn i'll let it slide but you really don't have much to process in terms of overview, comparisons and strategy in the first few turns. in fact due to the overview limitations because of the fog of war, if an A.I. doesn't cheat and see the whole map it doesn't even have millions of cycles to go through. TB strategy tends to be also grid based so if you consider the fact that in the beginning you can't see very far, your units are very limited cause of lack of resources and buildings you just might get a number closer to thousands.
     
    ^ Top  
  19. Reapa Doom Preacher

    Reapa
    Joined:
    Jul 10, 2009
    Messages:
    1,915
    Location:
    Germany
    updated OP.
     
    ^ Top  
  20. Average Manatee Prestigious Gentleman Arcane

    Average Manatee
    Joined:
    Jan 7, 2012
    Messages:
    10,134
    FWIW the task manager saying that something always takes up 100% of a CPU core's time is irrelevant. Most likely they are https://en.wikipedia.org/wiki/Busy_waiting or something similar. This is just the sign of a badly programmed game, the CPU equivalent of when a game has no frame limiter and therefore automatically uses 100% of the GPU's cycles to run at 5000 FPS on the menu screen even though your refresh rate is 60 hz and all the extra frames are discarded.
     
    ^ Top  
  21. Destroid Arcane

    Destroid
    Joined:
    May 9, 2007
    Messages:
    16,620
    Location:
    Australia
    If you design your game for simultaneous turns instead of sequential you can farm off the AI turns to other cores while the player is taking their own turn. This should result in almost instant turns no matter how complex the AI is, unless the player just sits there hammering end turn.
     
    • Brofist Brofist x 1
    ^ Top  
  22. Reapa Doom Preacher

    Reapa
    Joined:
    Jul 10, 2009
    Messages:
    1,915
    Location:
    Germany
    how is that irrelevant? it's blocking cpu processing power. same as with gpus getting hot. even if the extra frames get discarded they are being computed. there is no doubt the game is badly programmed. whether it's because it artificially inflates cpu usage or doesn't work with more than 2 cores is irrelevant. the enemy turns do not seem to have enough processor space.
     
    ^ Top  
  23. Reapa Doom Preacher

    Reapa
    Joined:
    Jul 10, 2009
    Messages:
    1,915
    Location:
    Germany
    can you give examples of such games?
     
    ^ Top  
  24. Destroid Arcane

    Destroid
    Joined:
    May 9, 2007
    Messages:
    16,620
    Location:
    Australia
    I don't know of any :(
     
    ^ Top  
  25. Average Manatee Prestigious Gentleman Arcane

    Average Manatee
    Joined:
    Jan 7, 2012
    Messages:
    10,134
    It's irrelevant in terms of determining whether a faster CPU would help. Task manager might say the CPU is using 100%, but its probably actually using something like 20% of your CPU time to calculate the turn and the other 80% is literally the CPU spinning in place being a heater.

    Yes, it is bad in terms of wasted cycles and needlessly running your CPU/GPU hot,
     
    ^ Top  

(buying stuff via the above buttons helps us pay the hosting bills, thanks!)