The importance of optimization

When I was a kid, the Amiga could multiask on 512K of memory and run some pretty darn good games.

My Commodore 64 was a blast to play and required less memory than a typical modern icon image.

Today, we live in an age where the resolutions are so large, the textures do detailed that we need lots of memory.  I think most people recognize this.

But one thing we really tend to focus a lot of attention on is performance.  Readability in code is important but so is performance.  This week, we’re doing a lot of work on making sure our algorithms are efficient to ensure that the game runs well on lower end systems.

It’s not just a point of pride. It’s not just dealing with a pet peeve. But there’s a good business justification – the better the performance, the more PCs it’ll run on.

78,485 views 32 replies
Reply #1 Top

Batch, batch, batch, that's the name of the game.

Are you guys really taking advantage of the multicore systems so abundant today?

Reply #2 Top

This time is was a batching issue, but more-so a 'building off a generic class and not paying attention to overhead'.   :(  But now we have a nice lightweight terrain icon class that speeds things up considerably.

Reply #3 Top

Ah, something related to dynamic dispatch?

I've found game component systems to be very hard to get right. If you take the standard hierarchical path, it's far too rigid and hard to adapt in all the strange ways that games tend to require.

Reply #4 Top

But if everyone makes super-optimised games that run on lower end systems, how are the computer part manufacturers going to sell all those new and more powerful parts they keep developing?

Support your local (?) hardware manufacturers; make your code a bloated inefficient mess today!

(really though, I'm just looking for an excuse to spend money I shouldn't be spending on an i7...)

Reply #5 Top

It'd be nice if Elemental could use all 8 threads on my i7, but at least 4 is absolutely necessary. I want good AI, and if it takes more CPU power, then by all means use it.

Reply #6 Top

Quoting Beric01, reply 5
It'd be nice if Elemental could use all 8 threads on my i7, but at least 4 is absolutely necessary. I want good AI, and if it takes more CPU power, then by all means use it.

 

I'm ready to overclock and wait 20 sec every turn if the A.I needs that much time to be at full power (but with 2 x 3.0GHz I want to believe that my CPU is 5x as powerful as the max CPU power needed.

Reply #7 Top

The map sizes you guys churned out for gc2 are what made it for me, I still remember when that immense size came out...man that was funny stuff...and awesome! I guess that's what performance means to me, have a good week!

Oh...any idea what a lower end system is for elemental? ballpark? anything?

Reply #8 Top

I will see if Elemental on everything high will make my pc slow down... cause this thing is BEAST! }:)

Reply #9 Top

I have no idea of the exact specs, maybe a dev will answer, but I would guess any level of computer that is still in use in the U.S. in decent numbers. Go to Newegg.com and look at the lowest components available at any price, and that would probably be a good idea.

My guess would be 1 gig of RAM, 128 Meg video card, I have no idea what is considered a low end CPU, I am sure single processor CPUs are still in use... this is just me spitballing, I know nothing.

Reply #10 Top

I pray every night that my pentium II, 250megs of ram and my voodoo II video card can run this!

Reply #11 Top

Quoting "Servius",


I pray every night that my pentium II, 250megs of ram and my voodoo II video card can run this!

 

Can you even run anything past Windows 3.11 with that? ;P

Reply #12 Top

Hi guys.

 

Are we going to see this improvments in the next build?

 

Warder

Reply #13 Top

I pray every night that my pentium II, 250megs of ram and my voodoo II video card can run this!

I will add you to my prayers bro

Reply #14 Top

Are we going to see this improvments in the next build?
Yes, though it's less somthing you 'see' and really just makes the game 'feel' peppier.

Reply #15 Top

Quoting BoogieBac, reply 14

and really just makes the game 'feel' peppier.

I am sensing a perturbation in the kitchen. A good one.

Reply #16 Top

Thanks... Thanks... Thanks....

I'm working in software development in industrial environment (C#) and you may not believe how many "young" developers forgot this important point: performance!

They could talk for hours about last Microsoft techs, but almost doesn't know , for example, that giving a size when initializing a dictionary divide the time to add elements in it by 2...

Yes, readability is important, but if no one uses your soft, who will really read the code? And readability is not equal to maintainability.

Reply #17 Top

Just the fact that you guys are concern that this game should work on lower end machine is a blessing to everybody who as three kids and is not rich enough to buy up to date computers all the time...

 

Thank you

Reply #18 Top

Quoting AG3, reply 11
[quote who="Servius" comment="10"]

I pray every night that my pentium II, 250megs of ram and my voodoo II video card can run this!



Can you even run anything past Windows 3.11 with that? [/quote]

Actually, 386SX with 8 or 16 Mb RAM (i don't remember for sure) can run Win 95 if you're creative. And 64 Mb is ok for Windows 2000, probably for XP too.

Reply #19 Top


And 64 Mb is ok for Windows 2000, probably for XP too.

You have a strange definition of "ok", methinks :P .

I had 512 MB ram with WinXp and while it certainly worked, having to use freeware programs to free up as much RAM as possible in between games was a real hassle, not to mention the massive swap file writing to the harddrive whenever I tabbed out of a game. After I installed 1.5GB in that PC, it was like entering heaven itself, the difference was unbelievable. I don't think I'd dare try it with 64MB :)

In my more modern computer, the jump from 2GB to 4GB (well, 3.4'ish with 32 bit XP) was awesome as well. From 4GB to 8 was good too, but nothing as noticable as the previous two.

It puzzles me a bit how games seem to demand increasingly more powerful graphics cards that cost oodles of money, but no one jumps on the 64bit wagon and shows us what they can do with 6-8GB of RAM. Can't we just leave 32 bit to die in a ditch already, please? :pout:

Reply #20 Top

I suspect that I'm not the only person who has pre-ordered Elemental who still plays Master of Magic and LOVES IT to this very day!  It's all about the gameplay, as far as I'm concerned.  Sure, graphics and sound effects and a nifty soundtrack are nice...  But give me rock solid gameplay and replayability and I'll play your game for decades.

Reply #21 Top

I'm pretty sure Stardock are unreasonably serious about this. If GC2 is a good comparison, I'd about bet money that with a very conservative set of video and audio options enabled on a sub-spec machine, the RTM version of the cloth map will play well enough even on middle-largish maps. That's how GC2 worked for me, anyway.

Reply #22 Top

Brad has stated more than once that he wants people to be able to play the cloth map mode on netbooks.

Reply #23 Top

Quoting Moussu, reply 16
Thanks... Thanks... Thanks....

I'm working in software development in industrial environment (C#) and you may not believe how many "young" developers forgot this important point: performance!

They could talk for hours about last Microsoft techs, but almost doesn't know , for example, that giving a size when initializing a dictionary divide the time to add elements in it by 2...

This is an example of what I dislike about talking about performance: giving a size to a dictionary will improve your insert time depending on the average size of the dictionary upon use. To be able to estimate that, you have to run tests, take metrics,... And unless it's a constant, sometimes you will end having to resize on an addition, so it's a pretty hard to measure this performance gain.

Performance is nice, but in lots of cases is hard to get an idea about where are the performance bottlenecks without the whole software running. You can spend 1 month and gain 50% performance in some code, and when the development advances discover that the code you improved uses 0.0001% of the computing time...

I prefer the idea of building things that work, and then, if they don't work fast enough, analyze why and make them run fast enough.

Reply #24 Top

Quoting AG3, reply 19

It puzzles me a bit how games seem to demand increasingly more powerful graphics cards that cost oodles of money, but no one jumps on the 64bit wagon and shows us what they can do with 6-8GB of RAM. Can't we just leave 32 bit to die in a ditch already, please?

Graphics are shiny, and shiny looks good on a box (and it's the first thing your average game review talks about). Going to 64 bit requires having content to make use of the extra space, and until 32 bit versions of Windows finally die off, isn't something you can use exclusively.

 

(What I hate is Microsoft for even selling a 32 bit version of Windows 7. Stop that nonsense, you can't even buy a 32 bit processor anymore for a PC.)

Reply #25 Top

Yes you're right. Before optimizing you have to measure and figure out what to optimize.

My point  about giving a size is when knowing how many items will be inserted (forgot to specify it, my bad), like after getting back some data from a database. So at that time you may initialize the dictionary with the size of the query result, before inserting items.

It's simple, efficient and does not take 1 month to measure it or to implement.:) So why wait until a "slow" system when it can be done right at the beginning, when coding the 1st time?

And there is dozen other "case" like that..