Framerate++

A lot of the jobs on my to-do list are variations of “Make [x] not run like shit”, so I’ve been spending a lot of time making things run a lot faster, and the overall system requirements for Black Annex a lot lower.

So one of the first things I managed to do was fix an issue paging the video buffer meaning that even when the game was running at 60fps, the screen would only update at 30fps. I didn’t even realize this was happening until I fixed it so now the game is literally running twice as smoothly as it was in the PAXAus AIS demo.

Performance MenuAfter this, I needed to seriously think about getting the game able to “Stretch to full screen”. I mean, I’ve had it working, but the “stretch” was slowing the game down massively so it would drop about 20fps when doing it. I had been just treating the screen like a rectangle and scaling it in a really basic way before blitting it to the computer screen. It was running horrible, so I started working on a way to actually map the screen to a couple of texture-mapped triangles and scale those up to the screen size instead. I ended up getting this working, so the screen is sliced into two triangles, then the two triangles are drawn back onto the screen at a new size to make the game full-screen. This turned out to be almost no slower than drawing the screen at the original size. Dealing in polygons seems to be pretty snappy, it turns out!

When I figured that out, I went back and changed almost every sprite-blitting routine to use texture-mapped triangles instead, and this sped up the game massively, especially if any form of scaling was being used on any sprite. The problem is, there’s no filtering, so I can’t smooth the screen or anything. Scaling square pixels to funny numbers can get some ugly results. I’m going to let the player run the game in any resolution they want, but they’ve got a few options on scaling. They can just go straight-up “Full screen” and just put up with any ugly pixels, or they can “Scale to nearest square pixels” which leaves some black borders at some resolutions (It will scale to 100%, 150%, 200%, 250%, etc. Keeping things fairly nice), and they can turn on “allow 25% extra scaling”, which allows 100%, 125%, 150%, 275%, etc. It’s a little uglier, but it’s up to the player to decide what they’re happy with.

A Pixel ShaderSo that’s done! Although I had at least tried to put some kind of screen filter in, it was just too slow to actually use. During that process, I did actually make a pixel shader for the game, which a lot of people though was pretty cool. It’s just a tilt-shift thing which gives everything a kind-of “Miniature” look. It will just be optional in the game as it runs like trash, but I like leaving things like that in for people to fiddle with.

But THAT lead to me deciding to work on some absolutely massive performance tweaking for the engine. I decided it was about time to actually go ahead and work on “Frame Skip”. “Frame Skip” is where you measure the time it’s taking to render the game’s graphics and, if it takes too long, turn off rendering until the game catches back up again. This results in “choppy” gameplay, instead of “slow motion” game play when things start getting too heavy for the CPU. The good thing about frame skip is that it lets people with computers just a little below requirements still play the game at the same “speed”, they just notice the game looks a tiny bit worse. It’s much less frustrating than having the game run at a snail’s pace.

I made it so Frame Skip comes on gradually, so if the game only slows down only for 1 second, it will give you a little mix of slow-motion and maybe just skip 2 frames or so. This means that if a GUI element takes a little bit too long to populate (Some of them have elements that stream from the hard drive), the GUI animation will still remain smooth instead of just jumping in. If the entire game runs slow, the frameskip will quickly go to full effect and the whole game will just be a bit jumpy.

So that’s great! The game runs way better on this Core Duo Mobility laptop I have for testing, which it was kinda unplayable on before. It still needs some tweaks but the technology is there and working so I’m super happy with that. The next item on my to-do list said “Make Pathfinding faster, a LOT faster” so I decided I really needed to finally wrestle with a* Pathfinding and make it work. Doing this in BASIC is extremely hard because you can not create arrays of arrays, and there’s no pointers either. I had to create a ton of different arrays with a bunch of arbitrary reference keeping arrays between them so they can point back and forth to each other. I also ran into a massive issue calculating the heuristic for my map because I use a horrible skewed coordinate system. A goon by the name of “testsubject” eventually figured out the math for it and I’ve had awesome success now implementing a*.

I uploaded a video showing the game running with the old pathfinding, and then I pull down a menu and change it to a* in real-time and the game instantly returns to 60fps with no frames dropping at all. Have a little read of the video description on youtube if you want a bit more detail on exactly what I’m doing in the video.

So that’s what’s new. Oh, I’m also going to E3! I won’t be exhibiting there or anything, just hanging out and hopefully meeting some cool people. I’ve never been to America before, tweet at me if you want to meet up or something.

March to PAXAus – Finale: You have been judged…

greenlightI didn’t really make it clear what I was doing in March, I just just smashing out updates every day to try to create a cohesive, playable game out of the pre-alpha version of BA Project. The reason for this was that the deadline for submitting a playable demo to the judges at PAXAus was April 10th and I really wanted to try to get something into their hands that actually “worked”.

So I spent the entire month of March smashing through as many critical features that the game needed to actually work as a whole. With that done, I hit the Alpha milestone and announced Black Annex. Around April 7th I sent the most bleeding edge build into the PAX judges after about 30mins of playtesting and two last-second fixes. (The final playtesting is shown in the video below, recorded around 3am).

For a little fun, I built a gimmicky custom intro into the PAX build which makes it appear that you’ve launched a DOS command prompt when you run the game. It just dumps you into a DOS window reading: “C:\GAMES\BLACKA~1>”, slowly, the commend prompt types out “annex.exe /paxmode”, a fake DOS/4GW runtime starts, and then a warning saying “YOU ARE SEEING THIS SCREEN BECAUSE BLACK ANNEX WAS LAUNCHED IN ‘PAX MODE’”. The moment the player pressed a key on the keyboard, the entire computer screen instantly goes black and the demo starts.

The demo had an utterly broken Main Menu that liked to randomly drop in and out if you clicked “Begin Game” too quickly, the Options menu didn’t work, and sometimes the “BLACK ANNEX” logo itself would just disappear. The only instruction given to the player was a loading-screen hint reading “Left click to make your agents walk to a location, double-click to run.”. There were five “playable” levels, but all of them were either uncompletable due to being massively unbalanced, or completed within 10 seconds of the level starting because the mission objective was way too simple. The minigun was completely broken, if you stacked three weapon abilities none of them worked, nothing made sense. The mouse cursor was an uncontrollable wreck plagued by a bug that I’ve only now fixed two weeks later and the “Mission Deploy” screen would just randomly close sometimes as soon as it opened. Loading took up to twenty seconds per level and the game ran at about 40fps on a computer made one year ago.

I can not stress enough how little sense this game made in the demo. You were dumped into a game with way too many mechanics, none of which were explained to the player and most of which barely functioned correctly anyway and expected to find, as the PAXAus submission form said “fun factor and a great gameplay experience.”.

As the creator of Black Annex, all I see when I play it is a mess of systems interacting with a bunch of unintended things happening all over the place.

The judges at PAXAus didn’t see the same thing I see. They sent me an email to let me know.
email

ais logo mediumSo now, me and five other Australian developers are going to be part of the Australian Indie Showcase at PAXAustralia 2013. We get to do a panel! So come to PAX and ask me about making a game or something.