Brad Wardell's Blog


Retail pain accelerates

Published on Wednesday, November 17, 2010 By Brad Wardell In PC Gaming

Got a lot of good stuff going on this week in terms of development. But it’s also a very stressful time as we watch retailer after retailer tell us that they’re eliminating much of their PC gaming space starting 1Q2011.  I wish the reason was because everything’s moving to digital. But as much as Steam and Impulse and the others have grown this past year, the real issue is the continuing migration of users to other platforms followed by the publishers.

This is going to put further pressure on the PC game industry to evolve or die.

Sins of a Solar Empire updates

Published on Wednesday, November 17, 2010 By Brad Wardell In Sins News

Stardock and Ironclad have been looking at what's next for Sins of a Solar Empire.  One of the big things on our list is to implement a new memory model for the game.  The reason this matters is that right now, it's hard to add more ships or structures into the game because of the infamous 2GB memory limit on 32-bit systems.

So in the coming couple of months, we're going to be working on a new update to Sins of a Solar Empire: Trinity that implements this.  After that, we can evaluate new opportunities in the Sins of a Solar Empire universe.

AI Wars Part 2: Building a better empire.

Published on Monday, November 15, 2010 By Brad Wardell In Elemental Dev Journals

For you  map makers out there, you’ll be happy to know that I have modified the code today so that if you set your map to NO objects that it will create no objects at all (before it used to still seed the basic set which is no longer needed in v1.1). 

This means I can make a really boring but --- explicitly controlled map.

Screenshots of what’s going on

Please excuse the ugly screenshots. I’m in the debugger.

Turn 1:

image

Everyone on my test map gets 1 fertile land and 1 shard. It’s a barren, ugly world. This world has no quests. No goodie huts. No Monsters.

 

Turn 20: Comparison time

image ME

 

image AI: Gilden – The heavy production faction

image AI: Capitar – The merchant heavy faction

imageAI: Yithril – Warrior/Archer faction

So as the AI guy, my first evaluation on this is to decide whether they are making the right choices.  All three of the AI here have decided not to put any resources into training units but instead have put it into building up their city.

Turn 50: AI errors

image

 

Version 1.1 of Elemental supports mana maint. The AI must learn how to use this.

image

 

I don’t need to go further. Now it’s time to go back and make adjustments.  Stay tuned for part 3.

AI Wars

Published on Monday, November 15, 2010 By Brad Wardell In Elemental Dev Journals

To best understand the AI of v1.1 one must first understand the nature of threads.

In a normal game, the players all function in a single thread. There is a while loop in which various components of the game are given the opportunity to to do their part – draw something to the screen, look for player input, update the game state and of course, move the computer AI.

In most games, including v1.0, the AI does all their work at the end of a turn.  This is why in most games you hit the turn and there is a delay, the AI is having to think about and plan what they do.

The challenge, of course, is making sure players aren’t waiting too long between turns, especially if the game locks them out of the UI (which is the norm).

But there is another way: Threads.  Threads allow you to have different things computing concurrently. Even on a single-core machine, threads can make a huge difference. Threads are the reason why Stardock games have historically had such a strong reputation for good AI.  The AI can be calculating strategies while the player moves. There can even be background threads that do nothing but look at the game state and set various flags for the AI to act on when the time is right.

Threads are the reason why Galactic Civilizations II was able to have some of its most infamous diplomatic moments such as “So, I see you’re building up quite a fleet there, so let me guess, you’re going to mass up for an attack, take my planet and then sue for peace? Well, sorry but in the meantime, I’ve been putting ships around your ships..”

In the OS/2 version of GalCiv (back in the 90s) that had cloaked ships, players were greeted with the horrific realization that the AI had surrounded them with cloaked ships and preemptively wiped out their massed fleet.  And this was back when the game was made with 486’s in mind.

Threads rule.

So why not threads?

Why do games (including Elemental v1.0 and other major strategy games of 2010) not use multithreaded AI? Debugging. If multiple things are touching bits of memory, modifying variables, creating or deleting objects it can be a real pain to coordinate.  The bigger the team, ironically, the harder it is to do. 

Plus, truth be told, most people just aren’t that comfortable juggling many threads. It requires a different way of solving a problem. It’s a bit like recursion, they can be hard to envision if you’re not used to it. 

On Elemental, I didn’t have the opportunity to go into that.  On our other games, the only coding part I was responsible for was the AI (except our earliest games).  On Elemental, things went somewhat..differently. By the end of the project I had added lead developer, producer, and design implementer to my hats so the AI had to be done in the more traditional way.

Now that we have Kael to take charge of production, Toby as design implementer and CariElf back as lead developer, I can do for Elemental what I do best: Multithreaded AI development.

Threads: Breaking a problem up into components

When you play a game, what are the things you do? What are the mistakes typical in computerized opponents?

The most obvious is that you’re looking and thinking about your strategy all the time.  So let’s look at the threads we should have in Elemental:

1. Global Strategic AI thread. This is little more than one big while loop that sits in a thread. It’s very low priority and all it does is look at the map and see what sorts of pre-designed situations have been triggered.  Think of it as pattern recognition. If it recognizes a pattern, it sets a flag and the AI in question then begins to deal with it.  This is where players can have the most impact by telling me what sorts of cheese they do to thwart the AI.

If I were writing the Starcraft AI, for instance, this thread would be the one seeing if I’m about to get baneling rushed or if photon canon rushed and deal with it. 

It also sets flags on known items as to whether they should be targeted for control, imbued, recruited, killed, etc.

This is NOT like an expert system or a neural net because the AI is not learning. It is adapting to player strategies but its choice of adaptations is limited to what we (the Elemental community and I) come up with.  Eventually I hope to export this as a C++ DLL for others to play with or better yet make it available in Python but that’s aways off.

2. Player Strategic AI thread. This is the thread that handles deciding what should be built, what strategies it should employ, where it should send its soldiers, what spells it should cast, what type of unit it should design, what technology it should research, what city improvement should be built.

3. Tactical Strategic AI.  The tactical battles are the one part of the game I’m not involved in yet. We have two capable developers handling that.  I won’t be taking that over until the expansion pack.  But that will become another AI thread down the line as a background thread looks at every army group and sets what types of strategies they should employ generally as well as potentially against any enemies that are near by.

Testing the AI

This is my AI map for v1.1 Beta 1. The goal with this map is to teach the AI how to play the game effectively using the v1.1 game mechanics. 

 

image

This battle will be the subject of my  next journal entry.

Bringing game lore into the game

Published on Saturday, November 13, 2010 By Brad Wardell In PC Gaming

image

One of the struggles we’ve always had has been integrating the considerable “lore” created for our games into the game itself.

Galactic Civilizations suffered in this way and Elemental has really has been a challenge.  The Kingdoms and the Empires are each highly unique civilizations with rich cultures. One of the things I look forward to doing this next year is working with the team to enrich the world with this lore.

Don’t be too proud of your technological marvel

Published on Saturday, November 13, 2010 By Brad Wardell In Personal Computing

I’ve been playing around with the Mac Book Pro for the past week. It’s amazing how primitive it is compared to even the iPad in terms of usability. Using a Mac is like going back in time.  It’s better than say Windows XP or Vista but it’s slightly behind Windows 7 which is, itself, pretty primitive.

If Microsoft doesn’t get a clue soon, the iOS and Android devices are going to grow up and we’ll look at Windows in the same way we look at Sparc Stations today.

Getting a life

Published on Saturday, November 13, 2010 By Brad Wardell In Life Journals

I’m trying to get some hobbies. I’ve focused on my job for so long that I haven’t really developed a sort of “normal” life. There is no home life. Only work at office and work from home. But this sabbatical I’m on has been helpful.

Today my boys and I explored the woods around our house and saw a lot of deer. I’ve been researching a bit on deer habitat and it’s really interesting to find out how deer live.  Since learning more about “Deer beds” I’ve been able to spot them all over the place. 

Our yard has enough woods for quite a few deer. On a typical walk we’ll see about a half dozen deer (usually almost all does).  Now we know where they go when they’re sleeping.

The right wing greenie

Published on Saturday, November 13, 2010 By Brad Wardell In Politics

So, on the one hand, I like the idea of having a 0 emissions house. On the other I have philosophical objections to the federal government picking winners and losers. So I have some trepidation as I install the 20KW solar array because of the almost insane level of tax incentives on it.

Keep a close eye on Air Play and Air Print

Published on Saturday, November 13, 2010 By Brad Wardell In Personal Computing

Apple’s Air Play has the potential to be a game changer for the tech market depending on where Apple takes it. Frankly, from a business point of view, it scares me.  When every monitor and receiver and TV becomes an Air Play device, that could spell the beginning of the end of the PC as we know it.

Microsoft and Sony and especially Nintendo should be afraid too. What happens when you can just tell one of your TV’s to display (and play the sound) of your iPhone 5/6 game or have your monitor display your iPad 3 app on it and just use the iPad or iPhone as a controller.

They’re already making these kinds of deals. I wonder how long it’ll be before people connect the dots and see where Apple is really going with this stuff.   

Twitter fails still for me

Published on Saturday, November 13, 2010 By Brad Wardell In Virtual Communities

Twitter still strikes me as not having enough meat. I like blogs. It’s a pity we were never able to get a more consistent blog format because I think there’s a market niche still to be filled by something that easily supports small articles.