Brad Wardell's Blog


Update on memory use

Published on Monday, February 14, 2011 By Brad Wardell In Elemental Dev Journals

imageSome people are good at making things. Others are good at breaking them. I guess I’m a breaker. 

As some long time players know, we’ve been trying to find ways to reduce the memory foot print of Kumquat (the engine behind Elemental). It’s a non-trivial thing to do, especially when long ago when we were specing this we were thinking of the day of 64-bit gaming when the 2 gigabyte memory limit was no longer a concern.

2 Gigs

Now, a quick thing about that.  No matter how much memory is on your computer, a PC game will only be able to see 2 gigabytes of it unless the game itself is 64-bit which, to my knowledge, there are no major games that fit that yet.  This is something pretty high on our priority list for the future but with most people still running 32-bit Windows, we have to focus on the here and now.

Crazy Games

Anyway, I have a saved game that upon loading would instantly crash the game because it was on a crazy sized maps with crazy sized cities with crazy numbers of units. The challenge to the team was to find a way to make this work.

Most games work around this problem with unit limits. That’s why Sins of a Solar Empire and Starcraft 2 (to name two examples) have very definite numbers of units in the game.  War of Magic has no such limit. There’s nothing stopping someone from creating tens of thousands of unique units. 

Multithreaded

The Kumquat engine is highly multithreaded. Now, what does that mean? It means that if you have multiple cores, execution of the game will occur on multiple cores.  The AI has its own thread. The graphics engine has some threads the main game has a thread, the music has a thread and so on.

It’s the reason why, even on a relatively low end system, you can zoom out and see the world and then zoom in and see individual people living out their lives in one smooth, fluid motion. It’s a pretty impressive technical feat imo.  But it comes at a cost – memory.  The easiest, fastest way to implement this ability was to give each unit its own instance so that it could be threaded.  That doesn’t mean each unit is its own thread, that would create a different set of problems. It’s a bit more complicated than that (ok, it’s a lot more complicated than that). But what it means is that the engine can choose to put different groups of units into their own thread in order to make sure everything remains smooth. But it means doubling up on memory – or tripling or quadrupling and so on.

Now, this isn’t something that was a mystery to us. We knew about this. The problem was, how do we have our cake and eat it.  The solution basically boiled down to months of work to write a different system to do this.  So for the past few months, that has been what Codecritter and the gang have been trying to do.  Now, in v1.19, some people people have reported a performance drop so that’s being addressed presently as well.

But the good news is that, in theory, the next beta of v1.2 (v1.19c? d?) should largely eliminate the memory issue for most people.

Far Reaching effects

Most people don’t connect gameplay limitations to memory. But there’s a definite connection. Because when you’re fighting a memory limit, it greatly limits what you can add to the world. You end up having to bland things out because, frankly, adding more “stuff” becomes very problematic.  Most people don’t make these connections (if you read forums they think the designers or developers are just oblivious or didn’t “see” some issue). But that is the challenge of designing a game – any game – on any platform is making guesses as to how much of a design can fit in.  That’s another reason why sequels are so tempting. You already know the scope.

The bottom line is that it’s good news for War of Magic and great news for Fallen Enchantress.

Light…is not your friend

Published on Friday, February 11, 2011 By Brad Wardell In Elemental Dev Journals

One of the most challenging things in making a modern PC game is nailing the lighting.  Light is all powerful when it comes to deciding how a game will look.

In most games, the camera is fixed. In some games, the camera lets you zoom in and out…a little bit…but not rotating.  It’s not a technical restriction as much as an artistic restriction. The more fixed the camera, the more optimization you can do on the presentation of the game.

image

War of Magic v1.19b.

image

Photoshop filter 1

image

Photoshop filter 2

image

Photoshop filter 3

Now, in these cases, I’m not really changing the lighting, I’m just applying a Photoshop filter in a way that simulates how the existing light source might change the look. 

In Fallen Enchantress, the lighting system is going to be redone which means that visually, it’ll look very different from War of Magic (i.e. there will be no question about what game you’re looking at from a screenshot).

But it is amazing how different something can look – with the same graphics – just by changing the light sources.

If you are familiar with examples, feel free to post them in the comments section.

The natives may not be friendly

Published on Wednesday, February 9, 2011 By Brad Wardell In Elemental Dev Journals

Jeff Vogel has a great blog about how creators should never read their forums. It’s definitely worth a read.

Now, as you guys know, I do read our forums. A lot.  Why? Because I’m dumb. As in, dangerously dumb. I have to consciously remember not to swallow my tongue dumb.

But there’s probably a bit of karmic retribution in there too. I got into making games because I was one of those nerd ragers on Usenet back in the day. Greedy bastardly idiotic game developers who put out games before they’re finished. I’ll show them how it’s done. Only a total moron can’t see when their game isn’t ready for prime time. Cough.

Truth be told though, the Stardock communities are pretty different than most. I hang out on a lot of Internet communities and I think I can safely say that our forums are pretty good. Good enough to the point that someone joining them would likely notice the difference pretty quickly.

We have some advantages there in terms of the type of products we make. No MMORPGs, no FPS’s helps. We have a different demographic. We also rarely but definitely kick out chronic nerd ragers. You can find them on other forums screaming a fit about how they were kicked off because we couldn’t handle a little constructive criticism. Constructive criticism being “You asshats should be disemboweled for your idiocy!”  Everyone knows that it’s ass hat. Not asshat. So of course they got kicked off.

Jeff Vogel is right in what he says. If you read forums, you’ll inevitably get aggravated and say something you shouldn’t.  And nowadays, with game journalism reduced to combing “the nets” for something spicy to get page views, saying things when you’re aggravated carries a lot of risk.

But the question that inevitably comes up over and over is this: Why are we here in the first place? The money? Making niche PC games is not the fast track to money. “It barely pays for my jet fuel™”.  No, the reason, at least for me, is to hang out and talk with other gamers about this stuff.  Not to get all mushy but we’re here because we love you guys. In a manly way that is. Of course. So don’t expect us to disappear any time soon.

Not that’ll stop me from saying horribly inappropriate things from time to time. You bloody basement dwelling troglites. And yes, I’ll be over on Friday to debate the nature of the dark side of the force following the next Clone Wars episode.

This land is…clean

Published on Tuesday, February 8, 2011 By Brad Wardell In Elemental Dev Journals

image

Debugging AI is tough. Is the AI stupid because of a bug? Is it stupid because the AI developer was stupid? (in my case, that’s usually why). Or is it stupid simply because the player is doing something that the AI didn’t know how to handle.

So thanks to the forums, one thing that popped up was that the AI sovereigns were being unusually stupid by not cleaning up the goodie huts near them. Why weren’t they? There’s a fairly good algorithm for scouting the FOW and then going after goodie huts once it knows of them.

But it wasn’t.

Why?

image

The answer was that I was using a function called pUnit->GetPosition() which returned x,y coordinates. I thought (wrongly) that it returned the coordinates in tile form (i.e. what tile on the board it was in) but it wasn’t. It was returning the pixel position. So when I passed this into my various functions, it came up telling me that I was in enemy territory and to run away. Hence, the sovereign would run to a city and stick around there.

While not a crippling issue by any means, it is one of those things that would give a human player a significant advantage over the computer players, especially early game.

Frog-2009 is looking to stay

Published on Friday, February 4, 2011 By Brad Wardell In Personal Computing

For years I got a new desktop machine annually.

I have a naming convention based on what their role is. And not only was there no N-2010 (no new work laptop, work desktop, home desktop or ultra portable) but there probably won’t be a 2011 one either (other than the recently acquired MacBook Pro).

A big part of the reason is that nothing is really making use of these latest/greatest desktop machines. As people have reported with the MacBook Air, even a relatively low end machine with a SSD can feel very snappy.  That’s what I’ve been doing with my X-2009 machines – adding SSD’s to them which gives them a new lease on life.

Sadly, I haven’t even upgraded their video cards. There hasn’t been anything released to compel me to. The last time I upgraded a video card for something specifically was for Half-Life 2. But this machine handles L4D 2, SC2 and other such games without a problem.

It’s no wonder the PC makers are increasingly flailing about making strange new quasi-PC or Android tablet type machines.

So what is happening? In my view, we’ve reached the part in the exponential growth curve of performance (Moore’s law) where it’s becoming increasingly difficult to recognize the performance differences between a brand new machine and one that is 18 months old.  This will only become more apparent as time goes on.

Big cut in energy bill

Published on Thursday, February 3, 2011 By Brad Wardell In Personal Computing

As I mentioned last month, I started monitoring our energy usage very closely.

It turned out we had two key areas that were running away with power.  The first was keeping the pool room warm. That was costing us a fortune. And by warm I mean like 80 degrees (it’s supposed to be about the same temp as the water).  The other was the recirculating hot water which was using a lot of gas.

Using this knowledge and making lots of other adjustments, I cut our energy bill by 45% this past month! W00t.

Things that make me happy

Published on Thursday, February 3, 2011 By Brad Wardell In Life Journals

When things are tough, what are your sources for coping? Here’s a brief list of mine.

  1. My wife
  2. My kids
  3. My sister-in-law
  4. The people I work with
  5. Learning new “Tech”
  6. Internet Communities
  7. Learning new things
  8. Helping others
  9. Passing on skills to others
  10. Reading a good book.

Lua vs. Python

Published on Thursday, February 3, 2011 By Brad Wardell In Elemental Dev Journals

In previous journals we’ve discussed the intention to create a modding layer that would use Python as its scripting language.  Python is slower than Lua in terms of interpreted languages but there’s nothing stopping us from having C++ source that people could use to in addition or instead of a scripting language for performance sensitive elements of a game.

With that said, let’s hear from those familiar with both on what they think of either one and why.