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.

Killer seagulls

I spent the last week trapped at work, which was extremely conducive to making progress on my game.  After spending the weekend chasing down some last minute bugs (had to redo the parallax scrolling and the entire concept behind activating/deactivating enemies based off of camera position) I’m finally ready to upload another build.  There’s still a random bug I can’t pin down:  every once in a while, the left and/or right images of a dialogue box won’t delete when the dialogue is over.  I can’t reproduce it with any regularity, and I can’t think of any reason that it’s happening.  Whenever I try to make it happen, it’ll work perfectly ten times in a row, and only once I’m playing to test some other feature does it ever crop up.  If anybody sees it, can you tell me what’s going on?  Were you pressing the arrow keys at the time?  Where did you click to end the dialogue?  Which dialogue did it stick at?
I’ll also be spending the next week or so stuck at work, so I foresee finishing up the final boss, and tweaking the level design until I’m satisfied.  Hopefully I’ll get around to starting the top-down engine, too.  Once I finish with that, it’s just a matter of designing each level and enemy behavior before I’ll have a playable prototype.
This is all finally coming together rather nicely.

Particle FX

I’ve made some pretty amazing progress this last week or so, though it’s not as visible as I’d like. I learned how to use particle effects in Torque, and added them to the using-health function. I threw in some burning houses and trees, and was briefly considering reworking the fire in the molotovs, and the psychic effects, but I feel like it’d be more efficient to wait until I get to the applicable levels.
I also discovered that the player’s ability to walk up a slope instead of fly up it like a superhero was completely due to accident. I’m still not entirely sure why that piece of code gave me the results I was looking for, because once I “fixed” it, it didn’t function at all, and I had to essentially redesign the player’s collision detection for the umpteenth time.
Also, I finished the save/checkpoint code, which also required a massive redesign. Instead of using the Torque engine as a level editor, I had to create functions that spawn objects, like health-drinks, enemies, and event-boxes. They each add the object to the level, and then a reference to the object to the applicable checkpoint list. When you load from a checkpoint, you delete everything from that checkpoint list, and then re-add the applicable objects. I ran into some weird issues where it wouldn’t delete some objects, and then I realized that in Torque, you can’t have two different classes of objects defined as custom classes. For example, if I make a class called “solid,” I can’t have both StaticSprites and AnimatedSprites of that class. It explained a lot of other issues I’ve been having, and after lots of renaming, I finally have everything working the way it’s supposed to.
So now, you can pick up Sake bottles by walking over them, and use them with ‘F’ to regain some health. The usual keys control movement (though I’ve added the spacebar as an alternative to ‘W’) and the mouse still aims and swivels the player. If you walk over one of the glowing Yggdrasil trees, it saves your checkpoint, and any time you die, it reloads you there. You can also cheat and use the ‘1’ or ‘2’ keys to load the first or second checkpoints, though I haven’t gotten around to the 3rd one yet. Soon, though.
I’m trying to decide on the ‘stun’ behavior for the pitchfork. The more I use it, the more I’m fine with it the way it is (though maybe dealing a little more damage). Also, I’ve noticed a little animation hiccup when the player jumps up onto something, like jumping up stairs. I can’t reproduce it with any regularity, so I can’t pinpoint what’s causing it. Also, occasionally, the samurai will walk backwards instead of hopping backwards away from the player. I have absolutely no idea why, but it looks intentional, and doesn’t affect gameplay at all.
Next up, I suppose, is to finish the third checkpoint, create the final boss’s actions, and then make the level design the way I want it to end up “for reals.”  I also want to come up with an official name for the game- “Yggdrasil Dream” is just a working title, and it’s too hard to spell and pronounce to work as a good title.  I’m thinking “The Morning After,” “Waking Dream,” “Hypnic Jerk,” or something like that.  Any suggestions?

Whoops

I guess that last upload had a bunch of bugs in it. I remember shortly after uploading, I caught an error, so I compiled a new build and hurriedly uploaded that one.  I must have been in the middle of some other things, because there was stuff that wasn’t quite finished.  So here’s what I have so far:

Player can die now, though if you press “g” it will toggle god mode.  You won’t see anything, but trust me, it’s there.  If you die, it puts you back at the start of the level.  I’m working on checkpoints now.
The horse-kidnapping thing at the beginning is done, along with the acquisition of the katana as a new weapon.
The samurai’s health is fixed- I guess his health bar wasn’t showing up, and one hit from the katana would kill him before.  All better now.
I got rid of some misleading tiles that made it look like you couldn’t jump to certain spots.  The level will be overhauled after I’m done with the final boss and everything; for now, it’s just a rough idea of what it will look like.

Still to come:
Checkpoints of some sort.
A stun behavior for enemies hit by the pitchfork.
Health things.
Fixing the non-boss enemy attacks.  They only deal damage at the very end of the attack animation, so as long as you’re not standing right in front of them at that point, you’re safe.  Which includes just running right through them.

So, yeah.  I’m getting there.