Category: Planitia

Planitia Update 32: World’s First!

I hereby present the world’s first multiplayer game of Planitia…with no further comment.


Planitia Update 31: More Multiplayer

I’ve been working on Planitia’s multiplayer for about six weeks now. It has required a pretty major rewrite to the underlying engine as well as near-continual rewrites to how I’m transmitting my data.

But…

The game is now inherently stable. In other words, two computers can connect and run the underlying world simulation and it’ll be exactly the same on both computers – they’ll never get out of sync. Which means that when the game does get out of sync, it’s due to player interaction, which can easily be logged and debugged. Most of the out-of-syncs are being caused by code I wrote months or even years ago that access the system timer manually – you just cannot do that in a multiplayer engine; you must use update timers (in other words, instead of a villager farming for 500 milliseconds, it farms for 15 33-millisecond updates).

I need to scour all the code that performs player actions as well as all my units and make sure nothing is using direct timing calls, but after that…well, the game should stay in sync, at least on a LAN. I’ll also need to clean up the multiplayer startup code so that it’s easier to start a game (right now you have to put the IP of the server into your engine.cfg file) as well as implement the last couple of god powers and then…

And then I’ll be releasing the multiplayer demo. ‘Sright! Of course, this demo will be LAN only – I cannot emphasize this enough. If you play it over the internet and it lags horribly, I hereby revoke your authorization to come crying to me. That’s not to say I won’t fix that eventually – I certainly plan to.

Sigh…once again I can’t post a new screenshot with pretties because that’s not what I’m working on. Indeed, after doing multiplayer coding going back to graphics would seem like a holiday.

Edit: Sol suggested I present a screenshot of two instances of the game running in sync. Great idea!


What I Did During My Three-Day Weekend

Worked on Planitia. I now have two different computers (as opposed to client and server on the same computer) connecting and swapping data. They are playing a multiplayer game! The only problem is that they are not playing the same game. I’ve got synchronization problems, but I knew I was going to, and I’m pretty sure I know how to fix it. Fortunately Planitia is much, much simpler a game than most.

Played Castle Crashers. If you’ve got an Xbox and you don’t have this game, fix that. The game is just a purely fun side-scrolling beat-em-up (remember those?) with RPG elements on, and it’s exponentially more fun the more people you get playing. It also has that one brilliant design decision that makes for superior games…something that other games don’t do but seems completely obvious once a game does it. And that something is that gold, weapons, and pets are shared between the characters on your account. So if you start a new character, you’ll be able to buy all the potions, sandviches, and bombs that you need. You’ll also be able to immediately switch out your starter weapon for something better and pick up a pet, one of which helps you level up faster. My god! It’s like they actually asked themselves, “How can we make it less tedious and more fun for players to level up multiple characters?”

Of course, you can also shine levelling up multiple characters and just put all your time into one…which Megan did, getting to level 45 over the weekend. Of course, even with maxed-out strength and defense, Insane Mode is still kicking her butt.

And finally, played Sly Cooper and the Thievius Raccoonus. I’d heard about these games but I’d never tried them out.

(See, I just don’t get this. Why didn’t I? I was all over the Jak & Daxter and Ratchet & Clank series of games like white on rice…why didn’t I get into Sly before now? I can’t explain it. Sucker Punch should be right up there with Insomniac and Naughty Dog…but they aren’t. I mean, the games were successful enough to merit sequels and the company is still going, but they weren’t the huge breakout successes they deserved to be, in my opinion. It doesn’t help that their first game, Rocket: Robot on Wheels, was one of the best platformers for the Nintendo 64…and nobody ever heard of it.)

Anyway, the game has a great style with some interesting characters. Sly’s a thief, but he only steals from criminals (claiming that it’s too easy to steal from regular folk). When Sly was a kid, his family was attacked by a group of criminals called the Fiendish Five, who stole the Thievius Raccoonus, the book Sly’s family had recorded all their thieving techniques in. The Fiendish Five split the book up into five parts and now Sly, all grown up, wants to get them back.

Which is just an excuse for some very smart platforming and collecting. While I was initially annoyed that Sly is a one-hit wonder (no hitpoints – one hit kills him) I was then gratified to see the game immediately move to mitigate this. Collecting one hundred coins gives Sly a “lucky charm”, which will allow him to get out of one jam – and it will even allow him to recover from falling into water or off the level, something I’ve never seen a game do before. There are also places where you can simply pick up lucky charms, and you can store up to two of them, effectively giving Sly three hitpoints. If you’re having trouble with a certain segment of the game, the game will start spawning Sly with a lucky charm on him – a good idea.

Plus, in the second world (of five) you can find a page of the Thievius Raccooonus that allows Sly to fall into water without losing a lucky charm, making him even more durable. So they do a good job of making Sly appear initially weak so that the player understands that this is a sneaking game, but then almost immediately mitigate his weakness so that things aren’t too hard.

Complaints? Well…the jumping seems a little “floaty”. Sometimes Sly will kind of hover in midair while the game seems to decide his fate. About half the time this actually works in the player’s favor but it doesn’t really make me feel like I’m in control of him. And it’s a bit of a shame since the control is tight otherwise. Also, the camera controls are backwards from what I’m used to and you can’t swap them, you just have to get used to them.

Still, that hasn’t prevented me from enjoying the game. I’m on the third world now, and things are toughening up – and getting kind of creepy, since the boss here is a big fat green voodoo priestess. I’m looking forward to finishing the game and moving on to Sly 2…and I need to find a copy of Sly 3 somewhere.


Planitia Update 30: MULTIPLAYER GET!

That’s right. After weeks of work and a near-full engine rewrite I have multiplayer working in Planitia. Now, right now everything has to be hardcoded – number of clients, the IP addresses, everything. So I can’t release a demo yet. I’ll need to at least bang in some code so that clients and servers can find each other on a LAN before I do.

I’m just terribly, terribly excited. I did a ton of research for this (and of course I’ll be Writing An Article) and it paid off tremendously – everything is working exactly like I expected it would once the system was implemented.

Now, that’s not to say it’s perfect. The system is updating an average of six times a second, which means that right now units jump across the map and there’s a bit of lag between clicking a button and having something happen in the world. Both of these can be made to look better with interpolation and prediction, though they don’t actually change how the game plays.

If you guys want to get a leg up on finding out how I did the multiplayer, you can read the following articles:

For making your engine multiplayer ready:
Instant Replay: Building a Game Engine with Reproducible Behavior

For implementing network multiplayer in an RTS:

1500 Archers on a 28.8: Network Programming in Age of Empires and Beyond
“Real-Time Strategy Network Protocol”, Game Programming Gems 3 page 496 or Best of Game Programming Gems page 459, by Jan Svarovsky

Teehee! I’m so excited!

Oh, and the next installment of Let’s Play Starflight will be delayed a day. For some reason.


Subterranean

Sorry I haven’t updated recently…I’ve been working hard both at work and at home, and also had the holiday over the weekend (which went well; we got a great view of the fireworks and all my kids loved them, though my littlest was covering her ears at first).

Just wanted to let you guys know that the next version of Planitia…will be multiplayer-enabled 🙂 And I’m hoping to have it for you in a week or two.

Oh, and I will be doing something special for the 50th Name That Game! this week…I just don’t know what yet.


Planitia Update 29: Planitia Beta .74 Available For Download!

You can download it here.

What’s new?

* The following god powers have new functionality (but may be missing graphical effects): Healing Rain, Lightning Storm, Meteor, Golem.

* I have changed to the new animated sprites for all the walkers. Tell me what you think.

* You can now only add units to your army when your general is near one of your own villages. This fixes the problem of the AI sitting inside your village pumping out units in a continuous stream.

* Speaking of the AI, it has not been upgraded to deal with the new god powers yet, so beating it is now trivially easy.

* And finally new terrain manipulation system! This is what I’m really wanting feedback on, you guys.

Here’s how it works. The “Flatten” button is now gone from the UI. That’s because the cursor is now always in “Manipulate Terrain” mode unless you specifically choose another spell. You can tell when you’re in Terrain mode because the cursor will be white.

While in Terrain mode, you can left-click and hold to raise the terrain. You can right-click and hold to lower the terrain. And you can click both buttons at once to flatten the terrain. The terrain will be flattened to the height of the tile you originally clicked in.

What I’m looking for is feedback on how easy it is to use the new system and whether or not these expanded controls actually add anything to the game.

Please download, play and leave feedback! Thanks.


Planitia Update 28: What Price Animation?!

Okay, while I love how the units in Planitia look, I hate the fact that they aren’t animated. This makes it tough to figure out exactly what a unit is supposed to be doing.

Unfortunately, I Are No Artist, and the selection of sprites on the internet that have a walk animation and face in eight directions is rather limited. I started by ripping sprites out of Powermonger, which worked but they are just so darn pixelated.

My friend Ryan suggested I try one of Reiner’s tilesets.

Now, I’ll be frank. I don’t really like Reiner’s sprites simply because they look so mundane. The sprites I’ve got are colorful! They’re retro! People seem to like them! And they don’t animate.

But I went ahead and gave it a go. I used the farmer set on this page.

Here’s how it turned out.

Note that farmers now face the direction they walk in and have a two-frame walk cycle (the sprite set has an eight-frame walk cycle in each direction, but I only implemented two as a test).

Short of suckeri…er, finding another artist willing to do an eight-way walk cycle for me for free, this is the only way I’ll get animated sprites into the game. What do you guys think?


PIX

One of the reasons I haven’t been posting updates on Planitia is because I’ve had this weird graphical bug that I haven’t been able to get rid of. How bad is it? Well…here, see for yourself:

Huh...the paint's run.  But I used Krylon!

Note that some of the houses are drawing just fine, while others are drawing as green-and-brown smears. It’s not awful, but it’s like a pimple on an otherwise attractive face – it’s all you notice.

Now, it’s obvious what is happening – the houses that aren’t drawing right are losing their texture coordinates. The renderer no longer draws the entire texture over the house but just a single pixel from the texture – thus, the solid green and brown colors. This happens if all texture coordinates for the mesh are set to 0, 0.

But it’s not obvious why that’s happening. The hardest bugs to debug are the ones that only happen some of the time and DirectX’s infamous undebuggability just makes it worse. So after several evenings of playing around with DirectX’s render states to absolutely no effect I finally just gave up and moved on to other stuff. I knew I’d have to come back and fix this bug eventually and I wasn’t looking forward to it.

And this morning I decided to take another shot at it. My renderer supports two sets of texture coordinates but the second set of coordinates isn’t set on this mesh…perhaps it was picking up the second set accidentally? Let’s turn the second set off completely. Damn! That still doesn’t fix it! How about if we specify the same set of coordinates for the second set as the first? Holy smoke, that still doesn’t fix it…

Now, at work I’ve been working on my first renderer in a production environment. It’s for a Kaplan SAT program. I’m working on the PC version and I was having trouble with a cartoon shader I was writing. Searching “debug vertex shaders” brought up several recommendations to “just use PIX”.

PIX? What’s that?

It’s the official DirectX debugging tool. It’s included with the DirectX SDK. And I had no idea it existed. Mostly because nobody told me. (Baleful glare at all my programmer friends.)

With PIX I was able to figure out what was wrong with my shader at work, so I decided to use it to try to fix my bug on Planitia.

PIX is pretty easy to use. You start by creating a new experiment:

Point the Program path field to the executable you want to debug, then choose one of the four options below it. Options 1 and 4 provide the most data, but if you’re just debugging something it’s probably too much (it’s much more useful if you’re optimizing). I like option 2, where PIX takes a “snapshot” of what DirectX is doing whenever you press F12.

Click “Start Experiment” and your program will run. PIX will add some text to show you that it is functioning properly:

Now it’s running. To debug my problem I panned the camera over to a house that wasn’t drawing correctly and hit F12.

Now when I exit the program PIX brings up the results of the experiment.

Now we’ve got a TON of information about what DirectX was doing during the frame we captured. Let’s look at the Events window…

And expand Frame 270.

We now have a list of every. Single. Freakin’. Thing DirectX did during that frame. DirectX is inscrutable no more!

Not only do we have the list of commands, but the Details window shows exactly what that command drew:

So let’s step through the list of draw commands…ah, here’s the first house it drew. This house was drawn correctly (except that since it wasn’t on the screen, it wasn’t actually drawn at all, as shown by the Viewport window). Notice the columns that show the texture coordinates for the house.

Let’s keep stepping…wait, what the hell?

A problem drawing a point sprite list? Why is it drawing a point sprite list? There aren’t any point sprites in the scene! Wait a minute, I’ll bet…

Yep. The very next thing it tries to draw is the broken house. Notice that the texture coordinates are now missing.

And now I know what the problem is. I was calling Draw() on a point sprite system that didn’t actually draw any point sprites. This put the renderer into “point sprite mode” – and point sprites don’t have any texture coordinates. Now, sometimes the renderer would fix itself on the next draw call – and sometimes it wouldn’t, and the house would be drawn with no texture coordinates.

The fix: change this code:

To this code:

Time taken: ten minutes.

Minor lesson learned: I shouldn’t call DrawPrimitive() if I don’t actually have any primitives to draw.

Major lesson learned: I should use PIX – and I shouldn’t ever complain again about DirectX being undebuggable.


“No. There Is Another.”

It’s not just me! I’m not alone! The thing I like most about this is that he’s taking a completely different tack. He’s doing as straight a remake as possible, whereas I, in my Yankee arrogance, have decided to actually try to improve on the original game.

I can’t wait to play it.


The Post Which Has No Content But Makes Grandiose Promises About Future Content

Posting’s been kind of light recently…I haven’t had that much to talk about. Mostly because the gaming scene is very console-heavy right now and I don’t own any of the current generation of consoles so…I haven’t played anything new in a while.

But I have been working on Planitia and I hopefully will have a new version for you guys to try out real soon. What’s the holdup? Well…

Okay, so I’ve got all the god powers implemented in a very basic fashion. But I haven’t yet upgraded the AI to be able to deal with them yet, so it’s now trivial to beat the computer. But I do need to get started tweaking and balancing the god powers. What to do?

The answer? Well…add multiplayer.

‘Sright. I’ve been working hard on the multiplayer version of Planitia and I’m hoping to have it ready to test by the end of May at the latest. If I can get enough people interested, it should be pretty easy to get the god powers balanced. I’ll then write an AI for the single-player version that can deal with the player’s power set.

But that’s not the only thing I want to do. I also want to start doing at least one ten-minute video a month – either a video blog, a spotlight on an existing game, or something more involved like a Let’s Play. In fact, there are two games I’m seriously thinking of Let’s Playing – System Shock 2 and Starflight.

So there you have it! I’ve got absolutely nothing for you, but I might in the future! Isn’t that great?!