Frogboy Frogboy

Multi-Core AI

Multi-Core AI

Video:

http://screencast.com/t/kIaXyrkUd

Discussion:

This weekend I’m working on optimizing memory usage in the game. This requires a lot of testing that involves having the AI play against the AI on the largest possible map with lots of players.  Now, late game, there’s only a handful of players left (in the video above you can probably figure out how many) but the times can take a lonnng time.

Let me first ask those of you reading this, how many of you have played the beta on a large map with lots of players with >500 turns into it? It gets slow. There are thousands of units and dozens of cities and lots of things going on. Each unit has its own armor, weapons, enchantments, equipment, rings, etc.  And each turn, the game has to go and evaluate all these to see if the various cached values need to be updated – and late game, they often do.

So in a bit of frustration, I bit the bullet and created a worker thread for each AI.  In FE 0.86, the player and “the AI” move simultaneously.  In my build, the player and each AI player moves simultaneously.

This could only be done because of the work in the past few months of making the game much more thread safe.  So it’s a good robustness test to be able to not just have a few “dedicated” threads where each thread has a specific job. Now, we can toss threads around as needed and let your multi-core machines take care of the rest.

Or put another way, the idea of putting all these into their own threads is pretty obvious. The ability to actually do this safely is the key element here.

Oh, in case you’re wondering, in my example the end turn wait went from 8 seconds to 2 seconds in my massive, mega game.

59,350 views 41 replies
Reply #26 Top

Quoting Frogboy, reply 23

Quoting Heavenfall, reply 21Your reports are not automatically submitted. See this https://forums.elementalgame.com/415301

In 0.86 they are via Smart Exception.  But it is still very helpful for people to make a POST with what they ran into.

Uhm... I'm getting a shit ton of mod crashes. Feel free to add me to your ignore list. Or is there a way not to send errors?

Reply #27 Top

It has a good UI. Don't worry.  See the post on SmartException.  

Reply #28 Top

Phew! I must have gotten 10 crashes yesterday because my animationpack didn't support my (modded) unitmodeltype (or something).

Reply #29 Top

Quoting Frogboy, reply 12

Quoting Gammit10, reply 11I would love to get that far into a game, but thus far it keeps crashing.

I couldn't find any crash reports from you.  While we do get a lot of data automatically, it would be helpful if you posted some crash info (OS, video card, etc.).

I have sent in at least two debugs for FE.  What typically happens is that the game hangs and then Win 7 automatically kills it.  The only one true crash I had, it generated the zip file.  I sent that in as well.

 

My setup for testing:

Windows 7 64 Professional
Intel i7 920 quadcore @ 2.66 GHz (w/ hyperthreading)
Asus P6T LGA 1366 Intel X58 motherboard with latest system drivers as of 3/10/12, latest BIOS check as of 3/1/12
OCZ Gold 6GB (3 x 2GB) DDR3 2000 Low Voltage RAM
EVGA SuperClocked GeForce GTX 560 Ti (Fermi) with latest Nvidia drivers as of 3/10/12
Creative Audigy 2 Gamer Soundcard (PCI) with latest drivers as of 3/10/12
OCZ Vertex 3 SSD for OS
WD HD for game



I'm wondering if it's my Audgy soundcard.  I can try disabling it this week and testing.  Any known issues with anything you guys see? 

 

Reply #30 Top

I,m glad I just changed my pc from a single core Xp 32 bit to a core 2 duo win 7 64 bits.

 

Got a really good deal on the used rig. Could not say no to it :-) I only got 1 crash since I've been playing it. It's really stable playing on medium 4 opponents. No lag and no slow downs.

Reply #31 Top

Quoting Frogboy, reply 24
You don't "need" multiple cores. But we don't technically support single core.  Dual core is the minimum spec.

I just checked the System requirements for FE here:

https://store.stardock.com/product/ESD-SDE-W017

If dual-core is the minimum spec, you probably should change it to say that. Even if users could run the game on a single-core computer, I can't imagine it would be a good experience.

Reply #32 Top

People have computers with single core processors? Even my phone has a dual core processor...

Reply #33 Top

Older computers and netbooks would be an example of single-core computers still.

Reply #35 Top

I have three computers at home and 2 of them are still single core. As long as they work for the kids I don't see why I should change them.

 

Same for my dual core. As song as it's enough for my games I will keep it. With three kids going to college soon I have to save as much as I can.

Reply #36 Top

Large random map, max AI's all set to ridiculous, by turn 350 it was down to just 4 AI's.

Have not noticed any slow down in turns in fact, its fastest now as almost no monsters lairs any more.

Then again, even at the start, there was no speed issues, just random crashes due to memory.

Using an Intel® Core™ i7-920 Processor with 12gigs ram (but the application would crash when it got to 1.7 gigs

 

Reply #37 Top

Dear Frogboy. Did you planned some beta release with multi threaded AI?

What you think about  breaking 4GB memory limitation (using x64 memory maping features and x64 executable) .

To many users had x64 OS with big amount of memory (16GB and more) .

We like play epic games at extralarge maps with slow pacing.

Reply #38 Top

Multi-core games is a given now.   What I can't understand is why nobody is designing games to run dual- and triple-monitor.  Except maybe the shoot-em-ups, but even those just happen to run triple-monitor by coincidence--they're not designed that way.   You have your top-level screen display right side, your detail screen left side.  You click on a city, the city detail pops up on your left monitor, while your strategic map remains on the right.  This is not rocket science.

Reply #39 Top

Quoting tetleytea, reply 38
Multi-core games is a given now.   What I can't understand is why nobody is designing games to run dual- and triple-monitor.  Except maybe the shoot-em-ups, but even those just happen to run triple-monitor by coincidence--they're not designed that way.   You have your top-level screen display right side, your detail screen left side.  You click on a city, the city detail pops up on your left monitor, while your strategic map remains on the right.  This is not rocket science.

Why would a game publishers want to allocate time and money for functionality that will be used by less than 1% of all users and have no impact on sales?

Reply #40 Top

Maybe their marketing people are operating off the same outdated information you are.   It's MUCH more than 1% of the market who has dual monitors nowadays.  Even higher, if games would be architected to take advantage of it.  And sure it would impact sales:  if you're the first to do it.  That's always been true:  the first to the dinner table, gets the lion's share of the food.

Reply #41 Top

Quoting Edwin99, reply 39



Quoting tetleytea,
reply 38
Multi-core games is a given now.   What I can't understand is why nobody is designing games to run dual- and triple-monitor.  Except maybe the shoot-em-ups, but even those just happen to run triple-monitor by coincidence--they're not designed that way.   You have your top-level screen display right side, your detail screen left side.  You click on a city, the city detail pops up on your left monitor, while your strategic map remains on the right.  This is not rocket science.


Why would a game publishers want to allocate time and money for functionality that will be used by less than 1% of all users and have no impact on sales?

 

I was thinking about that when I was playing Diablo 2 yesterday. It would be cool if D3 would let me put the map on the second screen so I could play on the main screen and never be blocked off.

 

I have no idea of the % but I know I will bever go back to 1 screen. I won't go to three though to much space. My friend has a 52 inch screen to play on his computer. I have a hard time seeing him with a smaller scfreen next to it. Maybe that's why its not practicle.