Well, it’s break time again. After a long day of debugging the crazy networked asynchronousity that is my current project, taking a break to find a solution to a strange jabberd error (xml where whitespace matters is dumb, btw), and then copy-pasting individual frames of an animation into a SWF… my eyes are bleeding. Well, not quite, but I’ve been staring at the screen way too intently today.

So naturally, I don’t close them. I read Sean Howard’s design of the day (#23, the linear roguelike brawler rpg) and get to thinking about something that’s been floating around the back of my brain for a while.

I’ve wanted to write a tower defense style game for a few months now, but couldn’t ever really think up a twist that I liked.

For those who’re tuning in late, Tower Defense is a style of RTS play where you build stationary defensive towers that blast an (often) endless stream of dumb enemies that are trying to capture your base. The specifics vary, sometimes the mobs have AI, sometimes they have special features, etc… but that’s the gist of it.

Warcraft 3 provided what were probably the first true TD scenarios. They’ve since been copied hundreds of different ways. There are lots of good TD games out there now. Lots of good TD games out there written in Flash, even. Some of my favorites:

  • Flash Element TD – The first one that really grabbed my attention. Fairly straightforward, but stable and enjoyable.
  • Onslaught – Very free form. Only 3 types of offensive towers, but they can be upgraded and chained together and create an amazing variety of interesting strategies. Onslaught also has a big leaderboard that not only shows other people’s high scores… but their final tower layout so you can learn from them.
  • Desktop TD – Insanely free form. There is no track for the mobs to follow. They just sort of A* their way across the board. Very well designed and intuitive. I love the art and npc design, I love the UI. It’s also the game I find the most difficult out of the three.

So… if I am to design my own TD game (eventually to possibly maybe even be written in AS3), there are a few absolutely essential features that we need to start with:

  1. A mute button. :P
  2. SharedObject preferences. I want the game to remember that I don’t like noise. I want it to remember my name for the high score list, I want it to remember any other important UI preferences.
  3. The ability to increase the flow of mobs. Either with a simple “send next wave now” button or with a Lemmings style throttle that simply increases the rate of spawn flow.
  4. The ability to see valuable information. These games really just come down to a lot of numberchasing, so we may as well give the numberchasers a lot to work with. I want to be able to get status reports on any mob on the screen. I want to know more than just the range of my missiles, I want to know their rate of fire and their blast radius, etc…
  5. The ability to pause the game and still see this valuable information. This isn’t Tetris where getting a paused snapshot of the puzzle is cheating.
  6. Intuitive UI design. It should not require a degree in astrophysics or a magnifying glass or a cheat sheet in another browser window to figure out how to do things.
  7. Gentle learning curve. The game should be accessible to the newcomer. You should be able to just sit down and play without having ever seen another game in the genre – or without having paid much attention to the instructions if you read them at all.
  8. Depth. Finally, the game should not become boring easily. Just because it was easy to pick up and learn doesn’t mean it should be juvenile or lacking in options.

mobile world

As one way of addressing the last of these problems (depth), I like the idea of multiple stages where you have to rebuild your base from scratch after each phase – bringing a portion of your resources and your tech tree across with you. Ie, you don’t stare at the same exact layout for 200 consecutive waves… you may only have to (get to) stay on the same board for 10 waves.

Or, taking a page from the design of the day, what if the game was a running battle?

So, in stead of spending 10 waves on one board, you are playing on one continuously enormous board, but can only defend part of it at once. After every wave, your board may shift by one or two tile widths. There are plenty of thematic possibilities for this. Terraforming, plague of toxic spores/zombies/tribbles, etc… the actual theme isn’t terribly important.

When a tower you own moves off of the board, you should get a refund, say for 75% of its total cost. There would be an option to destroy units you do not want before they scroll off, but at a penalty – perhaps you only get 50% of the cost back when you sell them off impatiently. Units should not build immediately, however, and if you cancel a build before it completes, you will get a full refund.

mobile enemies

I would like the battlefield to be open to allow multiple paths for enemies who are trying to get past you. There should not be a single linear/winding/curvey path that they trudge along mindlessly. I’d like them to flow.

It would be nice if enemies were given sufficient AI to make some basic danger assessments in addition to simple shortest-path calculations. I’m thinking that the baseline AI should be standard A* style pathfinding with toggleable risk avoidance behavior for some varieties of mobs.

It would be nice if they weren’t 100% predictable. Predictable? Yes. Highly predictable once you know the rules? Certainly. But not guaranteed. It’s no fun if the mobs are too smart. But there does need to be some small amount of nondeterminism to mob behavior – at least for certain types of mobs. Some mindless drones are required and appreciated – it’s not as fun if the mobs are all smart either.

Mobs should spawn along the entire front, not just at a single predictable point. You should have to protect a broader area than a single tower can cover alone. You should be able to take advantage of choke points and ways of forcing the mobs into places that they might not otherwise willingly flow.

There should be different varieties of enemy. Their most fundamental attributes should be clearly identifiable to the player (intuitive icons would be nice). There should be multiple traits that npc’s may have in combination with each other:

  • Speed – Some mobs are naturally slow, some are naturally faster than others. Making something naturally slow might combine in interesting ways with other special traits.
  • Resistance – Some mobs are naturally resistant (or weak) to one type of damage or another. Demons might calmly walk through your flamethrower batteries without taking any damage, and mummies might go up in smoke at the mere site of them.
  • Offense – Some mobs fight back. Some mobs might have passive offense – maybe those demons have fiery auras around them that burn towers they walk past. Some might be aggressive and care more about battering down your towers than progressing across the map. Most mobs should only fight if cornered, however, and should probably just flow around towers in stead of trying to carve their way through.
  • Aversion – Some mobs do not fight back, they run away. They’re scared of fire. Not necessarily weak to it. Heck, they could be resistant or even immune. But when a fireball hits them, they run away screaming for a while ;)
  • Modes of Transport – Some mobs walk, some fly. Some should be capable of swimming. I want water on my maps. Some mobs might be capable ONLY of swimming. Maybe some mobs ‘blink’ every few steps.

There are probably a few other special attributes to add to the list. “Boss” mobs should be more interesting than just a single creep with 100x normal hp. Give them something that makes them a truly unique challenge to overcome.

mobile “towers”

This kind of take the concept of “tower” defense a bit far… but what if towers weren’t necessarily stationary? Granted, most games in the genre are about building static defenses and living with your mistakes. Allowing you to field mobile infantry starts getting much closer to a traditional RTS after all.

What I would like to see are some (not all, very few in fact) of your units having some sort of mobility themselves. They are still fire-and-forget defenses. You don’t give them orders once deployed. They have their own AI that they follow, just like any other tower, even if it is slightly more involved.

Mobile units would be chained to a central home location and will return to it if otherwise unoccupied. When the mobile unit’s anchor point scrolls off of the map, the unit unspawns just like any other “tower”.

Mobile units would have to sacrifice something in order to become mobile. The most obvious example to me is that perhaps you have a unit that has decent mobility but has terrible range. It does comparable damage to similarly priced immobile towers but has to run in between targets to kill things.

Some other uses for mobile towers might be non-offensive units that attempt to herd mobs for you (gravity guns, fear, or just maybe just physically pushing them around). Perhaps repairbots can be placed in the middle of a group of towers that they will then help maintain. Maybe one mobile unit is a glue monster that paints its entire area of influence with sticky traps that render mobs immobile for a time. Maybe a mobile unit taunts and kites creeps to keep them occupied while other towers can finish them off.

mobile objectives

Every TD game I’ve ever played has the same goal. Whack the foozles before they get to point X. Sometimes you have some time to kill them after they reach point X, but otherwise the goal is the same.

Since our viewport is moving, it doesn’t necessarily make sense that our goal should simply be to kill everything that comes onto the screen – though that’ll probably be a large portion of the game.

I like the idea of occasionally hitting special parts of the map where you have an objective to perform. These objectives may or may not be required, but I think most will be mandatory. That is, if you fail in the objective, the game is over.

The first objective type that I can think of at the moment is the acquisition and protection of some sort of third party object on the map. These might be pieces of technology that will improve your tech tree. They might be large caches of resources that will allow you to field more units. Or, they may be hostages or similar that need to be rescued and led to safety.

Other objectives might be the destruction of a large stationary target, such as an enemy base. The object could also be a dam that would flood the map below you, seriously altering the flow of mobs; or, it could be a wall that is preventing your progress.

And there you have it. My “mobile” tower defense idea in a nutshell. Maybe one day, I might even think about it again, but for now, it’s back to copy-pasting sprites ;)

I’d just like to point out that Esme’s current downtime is not my fault (18 hours and counting). Acius is the one who actually owns the account, so he’s the one who has to talk to the hosting provider about getting things back online. He’s well aware of the situation, but is apparently having problems getting in contact with hosting people to request assistance.

And the machine is down-down as far as I can tell. Binky can’t ping her (normally can), so it’s not just a case of apache and the mud going down at once. At the very least, networking is down, at the most… well, we’ve probably lost a great deal of work if that’s the case.

It’s funny, really. I killed myself this weekend working to get the mud back online – restoring from a 10-month-old backup I’d found. I started discussing mud-related topics with our playtesters again. I started cleaning up my todo list. I was all fired up to revitalize the project.

Then the mud goes down at 2pm yesterday afternoon. We had a newbie online at the time. Chalk up another player lost to faulty hardware.

The really fun part about the crash is that nobody knows why it happened. Nobody was doing anything on the machine. The mud was all but idle, just with the one newbie playing and me afking in my cave. I guess the web forums might have been seeing some activity, Sora gave me that impression. But… otherwise, nothing.

Sigh.

Maybe the machine heard our plans to decommission her in favor of moving services over to Binky and Tiff? Shrug.

Either way, this downtime confirms my intentions to move absolutely everything off of Esme as soon as humanly possible. While I’m decommissioning Esme, A’tuin is also coming down and some migration from the pair account will begin. All ancillary sites will be moving to Binky. Hopefully, I’ll finally even be able to bring Hedwig back online and make people’s old data available to them again.

DNS master, the mud, and the mud site will probably be moving to Tiff. I’d make her the DNS slave, but Binky’s already filling the role so nicely. The main simud.org mud site will be the only page hosted off of Tiffany… with the possibility of SIMud accounts allowing people some personal ~username style web hosting off of the machine. Yes, simud.org, not mud.simud.org. I’ll be attempting to eliminate that ugly splash page we’ve had up for the last several years…

Binky will be making regular backups of data to Tiff. Tiff will be making regular backups of some data back to Binky. I will be downloading some of each of these and burning them to DVD every month or so.

Tiff comes online Saturday. I hope to have some of these changes in place by Monday evening.

Well, it’s been a little less than 2 months and we haven’t killed the baby yet. Must be doing something right.

Sleeping Goofy Wandering Foot Rings!

The rightmost picture marks the first time she actually showed interest in a toy. It’s my desktop wallpaper now :P Yay for silly firsts!

Ok, this is just some quick proof of my dorkiness. WoW patch 2.1 included a change to the prospecting math where attempts are always guaranteed to yield a gem now. Having read the patch notes ahead of time, I stockpiled a bit of ore to take advantage of what I hoped would be an upgrade in the gem drop rate. I prospected over 15 stacks of ore just now, and here are the results:

155 fel iron ore (7.75 stacks)

31 fel iron dust
8 flame spessarite
8 golden draenite
6 deep peridot
6 shadow draenite
4 blood garnet
3 azure moonstone

175 adamant ore (8.75 stacks)

35 adamant dust
10 flame spessarite
7 shadow draenite
6 azure moonstone
6 blood garnet
6 golden draenite
5 deep peridot
3 talasite
2 dawnstone
2 noble topaz
1 living ruby
1 star of elune

math

The quick math shows that fel iron prospecting produced 1.13 (35/31) uncommon gems per attempt.

Adamant gave me a 1.14 (40/35) uncommon gems per attempt and 0.26 (9/35) rare gems (total of 1.4 gems per attempt). Getting two uncommon gems at once is not unusual, and getting an uncommon and a rare gem together is also not unusual (looks like what’s guaranteed in the new math is at least one uncommon gem, anything else is extra).

I also had one adamant prospecting attempt out of the 35×5 adamant that produced three gems at once (2 uncommon, one rare). This could be a case of the two different chances (14% chance for an extra uncommon gem and 26% chance for a rare gem) both rolling at the same time. The small numbers math says that there’s a ~3.5% chance of both coming up at once, which jives neatly with my experience (1/35 ~= 2.8%).

One point of interest is that the uncommon gem production seems to be roughly even now between the two ore types (roughly 4.5 uncommon gems per stack). The only difference giving adamant a higher drop rate is its production of approximately 1 rare gem per stack of ore.

The sample isn’t big enough to make any definitive statements about individual gems having higher drop rates than others but my sample at least does seem to hint that orange gems are slightly more likely to drop than average and that blue and red are less likely. The difference here is well within statistically meaningless fuzzy grey territory, however, so don’t complain if you prospect 100 stacks of ore and get all azure moonstones ;)

old math

By popular request, I have hunted down some of the old prospecting math. Kaliope has a wonderful blog on WoW crafting issues and recorded some numbers on the subject. She also has posts on mithril, thorium, and lowbie ore prospecting results before patch 2.1.

100 mithril ore (5 stacks)

20 mithril dust
11 star ruby
10 aquamarine
4 citrine
1 blue sapphire
1 large opal

70 adamant ore (3.5 stacks)

14 adamant dust
6 golden draenite
6 shadow draenite
4 deep peridot
1 azure moonstone
1 blood garnet
1 flame spessarite
1 talasite

90 thorium ore (4.5 stacks)

18 thorium dust
6 star ruby
4 large opal
2 azerothian diamond
2 blue sapphire
1 huge emerald

Her numbers use smaller sets than mine and are therefore even more prone to the vagaries of the random number deities. What she did notice was an 83% drop rate on gems from thorium (15/18), 1.35 gems per prospecting with mithril (27/20), and 1.29 gems per attempt with adamant (18/14). These numbers jive with my memories of the experience. She reported rare cases of getting 3 gems per attempt and several attempts w/o getting anything.

These are all over the charts but show two things:

  1. the results from prospecting were much more random before this recent patch
  2. rare gems really were pretty rare

Her one talasite from 3.5 stacks is a 7.1% drop rate… compared to the 26% drop rate that I noticed under the new math. The higher randomness prior to 2.1 meant it was possible to burn an entire stack of ore and get only dust. I remember very acutely a stretch of 6 adamant prospectings where I got no gems.

If her rate of ~1.3 gems per prospecting (assuming the thorium exercise was a fluke) was accurate, then the numbers are similar enough to mine to assume that no real change in the overall rate of gem production resulted from the patch… they just normalized things a bit, and I like it ;)

thottbot

It just occurred to me (4pm, May 23rd) that Thott might have some data on the subject. Turns out they do. I’ve saved a snapshot of the data before it becomes too corrupted by the changes in this patch, but the trends they show are pretty easy to spot.

36740 fel iron ore (1837 stacks)

7348 adamant dust
1235 flame spessarite
1223 deep peridot
1200 shadow draenite
1175 blood garnet
1160 azure moonstone
1143 golden draenite
72 talasite
65 dawnstone
65 noble topaz
64 living ruby
63 nightseye
54 star of elune

82700 adamant ore (4135 stacks)

16540 adamant dust
3143 flame spessarite
3262 blood garnet
3258 azure moonstone
3192 deep peridot
3153 golden draenite
3114 shadow draenite
400 talasite
394 star of elune
387 dawnstone
373 noble topaz
361 nightseye
360 living ruby

The adamant prospectings show a rate of 2.2-2.4% for each rare gem and 18.8-19.7% for each uncommon gem. Add things up and they give a 13.8% chance of getting any rare gem and 115.6% chance of getting an uncommon gem for a grand average of 1.29 gems per prospecting – confirming Kaliope’s numbers but showing that rare gems aren’t quite as rare as in her experience.

The fel iron attempts have about half the sample size, but are still quite statistically valid. Rare gems had a 0.7-1.0% chance of dropping (5.3% total) where uncommon gems had a 15.5-16.8% chance (97% total). So with fel iron, people were getting ~1.02 gems per attempt. Fel iron clearly had a lower drop rate.

So in conclusionary fashion, I will finally give a rest to this post by stating that my current guesses as to the changes to the new math:

  • Both fel iron and adamant have been given the same base chance to prospect green quality gems. This chance is probably similar to the old adamant rate of 1.15 gems per attempt.
  • Adamant rare gems look like they might have had their drop rate doubled. Clearly, making this statement from only 35 samples isn’t as accurate as it could be… but something like 0.25 rare gems per attempt sounds like a perfectly reasonable number to me – especially if I were the one pulling these numbers out of the proverbial hat when tweaking the algorithm ;)

So I find myself writing a whole bunch of AS1 recently (upgrading another old game). In this case, the project was originally done in a single ginormous FLA file. No separate assets file, no external .as files. We’ve broken lots of timeline code out into source files, but have yet to break any of the assets out. That’s my current project.

I’m actually splitting assets up into several small files and then loading them up into an invisible container clip.

When I started writing the loading code, I forgot that AS1 doesn’t have the MovieClipLoader class. That’s a Flash 7 invention. So, I got to do things the really old fashioned way, by listening to bytes loaded and all that. I figured since it is potentially a common problem (for those who wind up having to go back into the stone ages, that is), I may as well share the code with folks.

Please note that this code is a skeleton. It does not do a whole lot as it is. It just gives you a starting framework to edit to your individual application.

FakeMCL = function( parent, depth ) {
	if( !parent )
		parent = _root;
	this.parent = parent;	// parent clip of container
	this.loadQueue = [];	// queue of clips to be loaded
	this.container = null;	// clip into which all children are loaded
	this.init( depth );
};// end: "constructor"

FakeMCL.prototype.init = function( depth ) {
	if( !depth )
		depth = this.parent.getNextHighestDepth();
	// create an invisible container clip at parent._fakemcl
	this.container = this.parent.createEmptyMovieClip( "_fakemcl", depth );
	this.container._visible = false;
	trace("<fakemcl> container "+this.container+" is at depth "+depth);
}// end: init()

FakeMCL.prototype.loadMovie = function( url ) {
	this.loadQueue.push( url );
	if( !this.loadInterval ) {
		trace("<fakemcl> starting interval");
		// try to tick once every 25ms (that's once per frame at 40fps), we're
		// probably not running that fast, so it will just execute once per frame
		// NOTE: you can (and might want to) throttle this back
		this.loadInterval = setInterval( this.onInterval, 25, this );
	}// end: start interval
}// end: loadMovie()

FakeMCL.prototype.onInterval = function( mcl ) {
	// stop iterating if we're completely out of clips to load
	if( !mcl.loadQueue.length && !mcl.loadingClip ) {
		trace("<fakemcl> queue is empty");
		clearInterval( mcl.loadInterval );
		// NOTE: you might want to do something here now that the whole queue is loaded
		return;
	}// end: queue is empty
	// start loading a clip if we aren't already
	if( !mcl.loadingClip ) {
		var clipURL = mcl.loadQueue.shift();
		var instanceName = "_"+clipURL.substr( 0, clipURL.indexOf(".") );
		trace("<fakemcl> loading "+clipURL+" ("+instanceName+")");
		mcl.loadingClip = mcl.container.createEmptyMovieClip( instanceName, mcl.container.getNextHighestDepth() );
		mcl.loadingClip.loadMovie( clipURL );
		// NOTE: clip init goes here
	}// end: not loading anything
	else {
		// check status of currently loading movie
		var percentLoaded = mcl.loadingClip.getBytesLoaded() / mcl.loadingClip.getBytesTotal();
		trace("<fakemcl> loaded "+mcl.loadingClip.getBytesLoaded()+"/"+mcl.loadingClip.getBytesTotal());
		if( percentLoaded >= 1.0 && mcl.loadingClip.getBytesTotal() ) {
			// we're done loading
			trace("<fakemcl> done, "+mcl.loadingClip);
			mcl.loadingClip = null;
			// NOTE: callback for individual clip loading goes here
		}
	}// end: currently loading
}// end: onInterval()

Again, this is skeleton code and isn’t terribly useful as is. I’ve put some notes in the code where you might want to do more interesting things to adapt the durned thing to your application. Also, feel free to yoink the trace statements, they can get awful spammy ;)

This skeleton supports queuing up a whole list of swf’s for loading, but in actual use, it is probably going to be more useful for you to just load one swf at a time. Shrug.

example

Put the following code on a frame of your timeline:

#include "FakeMCL.as"

var mcl = new FakeMCL( this, 10 );
mcl.loadMovie("fish.swf");
mcl.loadMovie("bird.swf");

And hopefully, you’ll get some output like this:

<fakemcl> container _level0._fakemcl is at depth 10
<fakemcl> starting interval
<fakemcl> loading fish.swf (_fish)
<fakemcl> loaded 0/-1
<fakemcl> loaded 1465744/1465744
<fakemcl> done, _level0._fakemcl._fish
<fakemcl> loading bird.swf (_bird)
<fakemcl> loaded 1427856/1427856
<fakemcl> done, _level0._fakemcl._bird
<fakemcl> queue is empty

When all is done running, you’ve got those clips at _fakemcl._bird and _fakemcl._fish that you can toy with however you need. Chances are, you probably want to know when the loading is actually done, however. That’ll take some editing of this code. Put a stop() on the frame you call FakeMCL.loadMovie() from and then put “mcl.parent.play()” in the load complete block, etc…

A little while ago, Blizzard announced that they would be announcing their next game on May 19th. For the last few days, their home page has been a running timeline of their previous big titles (no Lost Vikings, however :P ).

Speculation has been rampant, and largely baseless. So… I figure it’s time to write down my own unfounded guesses, before the announcement actually arrives.

There are a few things that they could announce. Two things that I am pretty confident they will not, however, be announcing are 1) another MMO (ie, no World of Starcraft) or 2) Starcraft Ghost. Of course, I could be wrong… but in the first case, I doubt they have neither the personnel to support a second MMO nor the desire to detract customers away from WoW. And in the second, I believe them when they said that Ghost was on indefinite hold.

This leaves us with a few more probable possibilities.

something completely different

I strongly doubt that they will launch a completely new franchise here. Firstly, Blizzard really does have a good thing going with Warcraft, Starcraft, and Diablo. Anything else is… you might say wasted effort. They already have strong mythologies to build upon. Second, their home page is doing a countdown of these franchises. That feels more like they’re building up to a sequel than to something entirely new.

warcraft 4

This is probably the least likely option from among the real possibilities. Warcraft 3 was not terribly long ago and they’re busy telling the story of Azeroth through WoW. Their ability to do another Warcraft RTS – at least one with any meaningful plot – is severely compromised by the existence of the MMO. Regular story updates through WoW make WC4 a… most tricksy proposition.

diablo 3

While it’s probably not going to happen, I really like the idea of a new Diablo. It has the potential to be developed in direct competition with Guild Wars and Dungeon Runners. And while I enjoyed Guild Wars (and am very hopeful to see what they’re going to do with GW2), and have an old friend on the DR team… I would probably enjoy Diablo 3 more than either of them. Diablo would have better solo play than GW and would look better than DR.

And as with any other Blizzard title, It would also be very likely that the game would be released with OSX capability… and would be very easily configured to run under Wine/Cedega.

There’s also just something about the idea of seeing another good graphical roguelike by the people who did the original good graphical roguelike that makes me wish it were going to happen. Diablo3.com is owned by a group of fans with a petition for a new game. I doubt they’d be reluctant to sell the domain over when the time comes.

starcraft 2

And it is my opinion that the most likely candidate is a new Starcraft RTS. SC has been a… well, phenomenon doesn’t do it justice. The title has been obscenely successful. It is 8 years old and can be acquired for $10 in the bargain software bin of your local Walmart. Yet, people still play it. They still play Starcraft tournaments. I, myself, played it as recently as this past spring break.

The title has been long overdue a sequel, especially given their inability to bring Ghost to market. Blizzard has specified their every intention to write a sequel… they’ve just never been more specific than that.

The one thing I fear with SC2 is that it will be more like WC3 than SC or WC2. I can only hope that Blizzard realizes this… and makes SC2 a true sequel, not a completely different game that just happens to share a common setting.

update

Looks like I was right. SC2 it is. And it looks like everything I hoped it would be. Ureshii ^_^

Not that the prediction required any magical clairvoyant muscles, mind… but yeah ;)