December 2012

Collision Infraction

So I’ve spent the past week or so working tirelessly on trying to fix the collision detection as far as slopes and one-way platforms go; I feel like I’ve finally done it.

Step 1: The original algorithm had an invisible “sensor line” that rode underneath the player, sensing what sort of terrain he was on.  Unfortunately, any time he jumped up into a one-way, his collision would turn on and he’d teleport to the top of it.
Step 2:  I added two more sensor points right around the player’s knees.  Now, only when one of them was in the air, but the foot sensor was on land would it turn collision on.  This time, though, he would sometimes be falling so fast that his sensors wouldn’t register the surface of something, and he’d end up stuck in the block.
Step 3:  I added another sensor line underneath the first one, which solved the falling problem, but now I noticed he wouldn’t pick up on slopes that weren’t very steep.
Step 4:  I changed the placement of the extra sensor line and the sensor points so that the faster he was falling, the further away from the player they’d be looking for information.  But I started seeing some really weird inconsistencies that had something to do with the test for downward motion.
Step 5:  I got rid of the sensor points (which had become sensor boobs in my code) and changed the extra sensor line to be vertical instead of horizontal, so that it started around his knees, and stretched down to a length that was proportional to his speed.  I created a whole new set of subroutines that would calculate an intersection between this line and the surface of the one-way platform.  But now if you’re standing at the edge of something it wouldn’t notice.
Step 6:  I changed the vertical-line-sensor into a vertical rectangle that stretches downward based off of speed, and rearranged some if-statements.  After a couple of minor tweaks to make sure that he wouldn’t flash to a standing animation as he passed upwards through a one-way platform, I think I’ve finally got everything working the way it’s supposed to.
Step 7:  Right before posting this and uploading a new build, I decided to do one more run-through, and noticed that still, about one out of every twenty times, he’d fall right through platforms.  I spent about three more days adding all sorts of visual tests before I decided to just scrap the code I’d been using to detect intersections (that I’d gotten off of a messageboard) and write my own routine.  It worked perfect on the first try.  Lesson Learned: Just suck it up and do it yourself; don’t try and cut corner’s by reusing other people’s code.

So, back to the level redesign.  In the meantime, I’m going to upload a build with all the collision detection debugging still on; I want you guys to play through it and try to break it.  See if you can find any inconsistencies, or anything that would look better differently.  You can’t get across that little water mill (yeah, that’s what that brown box by the white box at the water is supposed to be) because the rest of the level is dreadfully not done yet.

Debug Legend:
Green lines are collision boundaries
Pink lines are intersection calculations to the platform surface
Any failed intersection attempt is shown by a blue line and a cyan rectangle to show where the sensor rectangle was.
Red line at his feet is the original sensor line.
Red lines to the left and right are wall sensors.
Translucent red box is the stretching sensor rectangle.
The player will turn pink when he stands on top of a one-way platform.
The current one-way object being tested turns translucent blue
All slopes are also one-way

It looks messy, but this was the only way I could see exactly what the engine was doing behind the scenes.   Now that I’ve got it all working, I’ll comment it out (because deleting it feels like a surefire way to jinx myself) and continue work on the level redesign, which shouldn’t take me too much longer.

Slow going

So I went through and started the level redesign, which uncovered many ridiculously huge flaws in the physics.  Mostly ladders, slopes, and one-way platforms.  I got the ladders tweaked; now instead of being able to move left and right on a ladder, it locks you to the center of it.  If you stand near a ladder and press up, if you’re not right at the center, it walks you towards the center and then puts you on the ladder (just like in Braid).  I also noticed that any time you were on a one-way and jumped to another one-way (even if it was the same one, i.e. jumping in place) you’d pass right through the second one as if it weren’t there.  I spent days working on that, and it wasn’t until I sat down with a guy from work and worked it out with pen and paper that I finally got it working.  Still not satisfied, I decided that I wanted all slopes to also be one-way (so if you walk or jump up through the bottom, you’ll land on the top).  And that’s what I’m still fighting with now, and why there hasn’t been in update in over two weeks.
Along with all that, I’ve joined the rest of the world in the “looking for a job” game.  I’ve nearly finished my military contract, and I’d like to have something to jump right into when I’m done.  I’ll take a pizza delivery job if it comes to it, but I’d prefer to have something relevant to my skills and that will look good on a resume.  I’ve had numerous phone calls, phone interviews, and real-world interviews with head-hunters over the last couple weeks.  The time of the year isn’t exactly working in my favor- nobody really wants to make anything happen until after the new year, but I still have to put work into it now.  Whenever I get some down time I lad the game back up, but usually after half an hour or so, I’m so frustrated with it that I give up and find something else to do.
Speaking of something else, I’ve got a couple links for you:

PC AI sucks at Civilization, reads manual, starts kicking ass
Legal Assistance for Game Developers
OUYA software development kit

The first one is a good read, the next two won’t be that interesting unless you’re something of a developer yourself.

I suppose that’s it for now.  I’ll keep slogging away and hopefully I can make enough progress for a new build soon.

The Name of the Game

I’ve been at work for the past week and a half or so, and while being underway is always an unpleasant experience, there were a couple mitigating factors:

1)  I made a bunch of progress on the game
2)  It was my last underway, my last steaming watch, and my last shore-power-hookup
That’s right ladies and gents, in less than 4 weeks my terminal leave will kick in, and I’ll be a free man once more.
Which should give me lots of time to continue working on my game.
I used my time at work to polish off a couple issues, troubleshoot some problems with the dialogue boxes, and finish up the behavior for the final boss.  Procedurally, the first level is complete.  I still want to go back and tweak the design, and there are still three more tiny bugs I want to chase down.  In the meantime, feel free to play through.  I want some feedback!
Also, to make it easier to playtest, I left in some debug features:
The numbers 1 through 4 on the keyboard will load the first through fourth checkpoints, so if you want to fight the boss, you don’t have to play through the entire level to get there.
The number 5 will actually warp you right to the boss chamber, though it won’t work correctly if you haven’t loaded the fourth checkpoint first.
Hitting “G” will turn on god mode.  You won’t notice any visual difference, but the player now takes no damage, and instead deals 1000 damage with every attack.  When fighting the final boss, it no longer takes four tosses into the fire to burn the armor off.
And to recap (since I don’t have the “controls” menu working yet”) Q and E will swap weapons, F will use health drinks, and the space bar will advance dialogue (it used to be clicking with the mouse, but I changed it).  Movement is WASD or the arrow keys.  Left click with the mouse to attack, and right click to cycle weapons.  (I’m considering taking the Q and E out; let me know what you think).
Also, about the first phase of the boss fight, it isn’t very obvious the way it’s animated now, so I added an energy bar below the boss’s health bar to show the state of his armor.  In the final version, his sprite will change to show him wearing less and less armor as you burn it off.  I may or may not leave the armor bar up there; I haven’t decided.
One thing I have decided on is the name of the game:  Waking Dream.  You’ll notice that I now have a domain name (godaddy was running a special, and I also had a coupon that knocked off another good chunk of the price).  For now, the domain redirects to the blogspot, but hopefully I’ll have a more legit webpage to put up sometime after the new year.
It feels so good to see everything coming together.  This has been a long time coming.