Brad Wardell's Blog


It’s not the game’s problem, it’s a player problem

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

I finally threw in the towel on Starcraft this week. As a single player game, it’s amazing. Game of the year as far as I’m concerned.  It’s multiplayer design is phenomenal as well. It’s the single best game purchase I made in 2010.

And yet, playing online, against humans, has demonstrated why I just cannot stand multiplayer games in general.  At various times during the beta I was ranked between "bronze” and “diamond” leagues.  In my experience, the difference between silver and gold is pretty small in terms of player quality.  Above that, you are starting to deal with a much higher quality of player.

The problem is, at silver and gold levels of Starcraft, the players you’re up against are overwhelmingly “all in” starting strategists. That is, they expect to win or lose the game in the first 5 minutes, which, to me, as a father of 3 nearing 40 years of age, is an anathema. I want to play the damn game.

The key to Starcraft is “scouting”. You scout to try to figure out what strategy they’re going to employ.  This works in theory  -- if you’re willing to devote inordinate amounts of time to the meta game that is Starcraft multiplayer. The meta game consists of scouting YouTube and various other sites to see what the latest fad opening cheese tactic is.

Playing against Zerg? Check to see if they’re doing a Baneling rush. Mutablob? Or are they going to do the extra roach cheese rush? Or something entirely different.

Playing against Protos? Photon canon rush? remote base? Probe hiding in your base?

Playing against Terran? Mass marine + peon rush? Mass Reapers? Rush for cloaked banshees? Or any of the myriad of other all-in strategies.

Scout. Scout. Scout.  That’s the alleged answer but it misses the point.  If you want to play the game, counter or no counter you still lose.  If you fail to counter, game is over in 5 minutes.  If you successfully counter, they quit and game is over in 5 minutes.

I don’t even know what Blizzard could do about this because we are playing two different games. I am playing a game of Starcraft, they are playing the Meta game of Battle.net rankings. 

I get more pissed off when I counter all-in strategy than when I fail because I don’t even get the satisfaction of taking the fight back to them. They quit immediately when their all-in attempt has failed and move on to the next game.

But that frustration is rivaled by the feeling that if I don’t want to be victim to the latest all-in strategy I have to keep up with it.  The extra Roach trick, for instance, is really hard to spot from “scouting” and very hard to counter (and if you’re wrong about which strategy they’re going to employ – something the “scout” people ignore, you end up crippling yourself).

Probably the only realistic thing that Blizzard could do is have those at Bronze, Silver and Gold Leagues have a somewhat randomize set of start-up conditions so that players can’t literally play out a recipe strategy they read on the net.  But I don’t see that happening.

I love Starcraft. I love it so much that I get frustrated that I can’t just get to play the actual game. I’ll have to stick with LAN parties for now I guess.

Happy Thanksgiving!

Published on Thursday, November 25, 2010 By Brad Wardell In Elemental Dev Journals

On behalf of Stardock, I’d like to wish the entire Elemental community a Happy Thanksgiving!  We’re very thankful to have you as participants in this ongoing journey to creating the ultimate fantasy strategy game.

Wherever you are today, our thoughts are with you. Have a great day!

Elemental Geekout: Dumb Outlaw

Published on Wednesday, November 24, 2010 By Brad Wardell In Work Reports

Welcome to the first of an ongoing series for people interested in game development.

Tonight, I’m trying to figure out why an outlawis just standing there instead of either a) running away, attacking, or c) just doing something.

image

So here is this outlaw. He’s not doing anything. Why?

First step was to rename him into something easy to identify in the debugger -- “Dumb Outlaw”.

image

Now in the debugger I wait…

image

image

He’s trying to go to tile 57, 51.

image

So why isn’t he moving???

image

It turns out, it’s because when I spawned the unit, I fenced them in. I randomly gave them a range in which they could wanter. Well, some units got a fence of 0 and so even if I told the unit to go far away, it didn’t matter because it wouldn’t go beyond its fence.

Stupid AI tricks

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

image With Elemental: War of Magic v1.1 BETA now out, you can see the direction we’re heading with the game.  Global mana has made a huge positive impact on game play and having your population being put to work (literally) not only provides a great game mechanic but connects the player to the game more closely.

As you can imagine, such significant game play changes require a lot of new AI coding to make it effective.  With Kael joining us to relieve me as the Producer on Elemental, I have more time for working on the AI (I am still handling the role of senior lead developer on the game which is a position I’m looking to fill – hint hint). 

A 5 step process

The process I use to make good AI works roughly as follows:

Step #1: Make the AI multithreaded.

This is the most important thing because it allows the developers to focus on making the AI effective without worrying about time so much.  Games with single-threaded AI have painful late games where you can wait a long time between turns. 

This part was accomplished in the v1.1 beta. It still has to be debugged (90% of crashes are due to this) since you have to make sure the AI isn’t monkeying around with main game data.

Step #2: Play the game at a basic level

This is pretty obvious. Can the computer players do everything that the human can do? This is something that I’m working on this week.  This can be effectively described as playing the game without worrying about opposing forces.

Step #3: Play the game at a competitive level

This is where it plays the game knowing that there are others trying to thwart it or destroy it.

Step #4: Play the game at the meta-game level

This is where it gets good at handling diplomacy, its dynasty, trade, and maximizing resources.

Step #5: Eliminate stupid AI tricks

Stupid AI tricks are simply little holes or little exploits that really need to be explicitly looked for and eliminated.

So for those of you who have v1.1, can you list THREE (no more, no fewer) things that you see the AI do that are either stupid or result in its destruction and what you would do if you were them?

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.