Friday, July 12, 2013

Win / Lose messages displaying


I struggled to get texturing working, and I'm not sure it's even really fully working - all that black space in the screenshot above is probably supposed to be transparent.

Still, there's now a clear win and loss message, which is good.

Thursday, July 11, 2013

Now with less bumping


That screenshot is from a debug build with shooting turned off - ordinarily, tanks wouldn't crowd around like that and let you live.

I've added in a test to see if the place the tank wants to move is "free", and if it is, complete the move. If it isn't, and the tank is patrolling, the tank just selects the next patrol point, which seems OK for simple patrolling. If the tank is pursuing you, then there's some hacky code that gets the tank to jockey away from the colliding objects. 

I think real pathfinding would make both of these better, but as it is, having tanks that don't poke through each other is an improvement.

Next up:
  • collision: projectile/object - will actually be really easy, and will make static objects tactically interesting to duck behind.
  • pathfinding - will make enemy tanks a lot smarter
  • HUD - radar, damage display

Wednesday, July 10, 2013

Now with extra Pew Pew and Game Over


http://bigdicegames.com/BZone/bzone.html

I did some work last night, laying the foundations of making the tanks know better than to drive through stuff. I created an object registry singleton object, which will hold tanks and obstacles, and will be useful for querying to see if the new location is actually obstructed.

I'll also want the AI to be smart about being able to drive around obstacles and tanks. I'm planning to do a simple ray-circle intersection and steer tangent to any intersecting circles. Should be good enough for sparse environments.

I realized that there's a lot of work there to do, so I switched gears to what was then low-hanging fruit: making the AI tanks react to the player. With the object registry, tanks can ask what other things are nearby, and if any of them are player tanks. (I still like the idea of a buddy tank, so player-allied tanks are a thing I'm thinking of, even if the player isn't actually in control of the tank).

I added two behaviors - pursuit and engage. At a certain radius (50 feet, currently), the tanks will detect the player tank. (Bad radar in the enemy tanks, I guess.) They'll turn toward the player and then drive until they get to the engagement range. If they're still turned toward the player, and they haven't shot in the last 3 seconds, they'll shoot.

Simple enough, but enough to be challenging. You can't race in to a bunch of tanks now without repercussion; evading one shot is possible, evading several is hard.

With win and lose conditions, I consider this a complete game. There's quite a lot left to do:

  • sounds - sound effects make a big difference.
  • collision - tanks should collide with each other, tanks should collide with static objects. Projectiles should collide with static objects.
  • pathfinding - enemy tanks should be able to drive around static objects.
  • HUD - the "heads up display", containing a radar map of nearby enemies and a display of tank damage
  • positional damage - maybe it isn't one shot, one kill, maybe you can take a few hits to a side before dying.
  • game modes - win/loss, title screen, mission overview
  • buddy tank - stay on target!
  • better model lighting - at some point, I'll calculate the normals at each vertex and use that for coloring. The tanks will probably look better.

Tuesday, July 9, 2013

Bugfixes, Model Rendering Work



One thing I've got a lot of value from is breaking of weekend-scoped pieces of development, so that you can show off your progress to your coworkers on Monday morning. Some games have more weekend-sized pieces than others, but I think the ones that can be broken up that way are easier to maintain progress on as you move along.

With "One Game a Month" there aren't a lot of weekends per game, so that idea has to be modified some - either smaller chunks, or smaller games.

I told some coworkers about Zone of Battle: Tank Patrol yesterday, and almost all of them had problems loading it. Weird. Now, I had only tested on Linux/Chrome, which isn't representative of all OS/browser combinations out there, but even some Linux/Chrome coworkers couldn't load it. They were able to give me some valuable debug output.

So, recently done:

  • Tank movement - I got this in yesterday morning. There's arrow key steering for simple control, or tank steering, if that's your thing.
  • Some obvious browser bugs fixed - no guarantees about your browser, but I'm guessing more people will be able to play it now.
  • Projectiles launching from the muzzle - this was a small change, but it makes a big difference in the feel of the projectiles.
  • Static objects in the world - I made a cone and two sizes of cubes. They don't block tanks or projectiles, they're just visual, but they make the tanks feel like they're in a space, rather than just floating around onscreen.
And the top of the TODO list:
  • collisions - between tanks and objects, between tanks and tanks
  • enemy tanks shooting at you - this will be the last important piece of gameplay. It will probably change the feel of the game substantially, requiring tuning speeds and scales, but that's a great place to be.
  • HUD - radar, score, damage display

Sunday, July 7, 2013

Now with steering


A small update here, with a few improvements, which feel at once like nothing much, but also a big deal.


  • player tank onscreen - the camera's hovering over the tank, giving that first person view that you remember from, say, "Doom". Or "Wolfenstein 3D". Do you remember the old MUSE game "Castle Wolfenstein"? I have vivid memories of completing "Beyond Castle Wolfenstein". Oh, look, http://www.oldskool.org/pc/BCW/faq.html
  • steering, finally - the left and right arrow keys rotate the tank right and left. 
With the addition of tanks not driving into each other, and actually shooting at the player, I could wrap up the basic bits of gameplay in short order. However, here's the top of my TODO list:
  • obstacles - adding in stuff to drive around will make things feel more solid. Right now, there are just a bunch of tanks in this formless void.
  • skycube - I'm actually thinking this will be a cylinder. I was thinking of a cone for a while, but a cylinder is just fine - a really simple heightfield going around the map with a zigzaggy mountain line. That makes two sawtooth cylinders, one in dark blue, for the mountains, and one in light blue, for the sky. Easy. And, once this is in, the tanks will seem more anchored, as well.
  • player movement revisited - I would like to have the independent left and right tread stuff working, to give that tank drive feel, and 8-way steering. It won't be hard, it'll just mean getting around to doing it.
  • projectile spawning position - the projectiles launch from the center of the tank, not from the muzzle of the gun. Converting the muzzle position into a world position is a simple application of the model->world matrix, which I have, or I can create.

Tank Battle: precursors

Clearly, the game I'm building has lineage that traces back to the early arcades. And there's some pretty heavy influence going back to combat sims on home computers. I remember playing a submarine simulator on an acquaintance's Mac years and years ago. I don't recall the name of the simulator - GATO is about the right timeframe, but Wikipedia says it wasn't a Mac game. Maybe Sub Battle Simulator?


Of course, there was Seawolf, which was an arcade game, but I'm not considering that an influence.

The arcade game I had in mind, of course is Battlezone, the 1980 vector shooter. The KLOV page has some good footage of the game being played, and several features that I haven't got around to implementing yet, like:
  • sound effects - player movement
  • sound effects - new enemy in range
  • HUD - targeting reticle that "locks on" to a target
  • half-height obstacles - block movement, do not block shots
Thinking back, I think that I spent the July 4th weekend of 1994 tinkering around with making a Battlezone clone, using C (C++?), Visual Studio, and Fastgraph. I didn't get a lot done that weekend, but I did get a parallax background displayed. That seemed like a lot back then. 19 years later, I've looped around, and done what, back then, was the hard stuff. Maybe this week, I'll get the skydome working. I suspect I still have the hard drive with the assets and code for that stuff, but they wouldn't be useful, even if I could spin the drives up and get the data off - that stuff was probably 8-bit, and designed for a 640x480 display, at the highest. So, I'll start from scratch, and make something that visually works with my current implementation, and that'll be good.

Over this weekend, and mostly coming from a different context, I've been thinking about Malcolm Gladwell's claim that you need to spend ten thousand hours doing something to become good at it. I don't know how many hours I've put into game development in the past 19 years - if I count 40 hours a week, working for 14 years in the industry, that easily knocks me over thirty thousand hours, but I hesitate to count all of that. Still, going back to Battlezone, and thinking of what I accomplished when i was much younger, compared to what I did this weekend, even with a bunch of other stuff going on, I'm clearly much more productive.

Oh, and it's a lot easier to make games today than it was two decades ago. Back then, Mode X was black magic.





You Win!


For the first half of the year, my One Game A Month games have been non-violent affairs, no shooting, no cudgeling, no stabbing. I guess that run ends today, as you see two projectiles (laser beams? plasma bolts? Something bullet-y) in the above screenshot.

I imagine that most of the remaining games will have some sort of shooting gameplay involved, but maybe these are robot tanks, if that helps your own personal violence meter. No animated blood.

I'm also pretty pleased to have those projectiles in, because it means that I have a "pipeline" to bring models into my game. I was just joking today about how I wouldn't need to make any more 3d models for the rest of the year, as tank games are a rich vein that I can mine for at least a few games over the next several months. Well, I made a projectile in Blender today (I took the cube that you start with, and scaled it to be long in the X dimension and skinny in Y and Z), and used my converter script, and it pretty much just worked.

Back when I was working in game middleware, and certainly on hobbyist forums and mailing lists that I followed, there was talk about "what belongs in a game engine?", and my opinion was "whatever you reused when you made your second game". There's a certain amount of snark there, saying that if you haven't finished two games, stop waxing philosophical and just make games. And I'm OK with that. But I'm sticking with the literal sense, too - that an engine is just a series of tools, and if you're not using your tools, throw them out, and if the tools are any good, they'll be reusable. Anybody can hack together a one-time solution.

So, with the advent of that projectile, my model converter script has become a real tool. And the code in the game that handles rendering and model loading seems to work. I think it could be simpler, but that's under the hood tinkering to do later. Maybe next month.

If you go to http://bigdicegames.com/BZone/bzone.html now, you can hit the space bar to shoot projectiles. If you time it well, you can shoot tanks. One hit, one kill. No explosions, no fountains of blood, no fanfare. If you're lucky, the tanks will have patrol routes that cross your line of fire. If not, well, reload.

And this marks one of those milestones, sort of - I detect when you've killed all the tanks, and I print a message to the JavaScript console saying "You Win". So, that's always a good sign. Having success and/or failure conditions makes the game a game. Otherwise, it's maybe an interactive simulation. Something. I'm hedging this even more than usual today because I've got a bigger scope in mind for this game.


Zone of Battle : Tank Patrol Game Concept

In ZoB:TP, you command a tank that can drive around a battlefield of the future. Your tank has a forward-facing cannon, capable of shooting deadly laser beams. The enemy has similar weapons and is intent on destroying you.

The structure of the game consists of a series of patrol missions, where the player is given a series of patrol locations to visit. At some of these locations, there will be enemy tanks to destroy. If the player returns to base safely, that mission will be considered a success.

Helping the player will be a second tank, who will accept simple orders:
  • engage at will
  • attack my target
  • hold fire
  • form on me
  • retreat
In-game UI will include a radar display to locate friendly and enemy tanks. There will be a map screen that the player can pull up that indicates the patrol route by pressing 'M'.

The player can activate autopilot by pressing 'A', which will navigate the players towards the first waypoint that hasn't been checked off their list. The autopilot disengages within a certain distance of the waypoint, and also disengages if enemies are within range.



Ok, that's the design sketch; I think I can get most of that done before the end of the month. And, even if I don't go all the way, I've got most of the pieces of a simpler version of that, which gives me slack, in case I get distracted and do something else in my spare time.

TODO:
  • player steering - because I'm getting tired of enemy tanks driving up to my line of fire and then driving away.
  • player movement - depending on how I'm feeling, I might implement tank controls, or maybe just simple WASD navigation. YINM, maybe, with Y/N controlling the left track, and I/M controlling the right track. I'll see how that feels.
  • player tank on screen - I'm planning on a "chaseplane" view, which can be tricky to get right. I may do something simple, like have the camera always be pinned to the same position relative to the back of the player tank.
  • visual effects: explosions - there needs to be something visual when a tank blows up.
  • sound effects: explosions - also, sound. Sound adds a lot, it turns out.
  • sound effects: projectile firing - it won't be me saying "pew, pew" into the microphone, I promise.
  • game modes - lose mode that takes you back to the start screen. A start screen. A map view.
Lots of stuff to work on, nothing actually too hard. Lots of stuff not on that list, those are just the interesting stuff at the top of the list.