Feb 21 2016

Platformer in VR - Part 5

By pressing the fire button you remove the blocks directly to the sides of you (left, right, front and back) if there is a block there.

Today was just a quick session. Need to play around a lot more with these mechanics to figure out where to go from here…

Feb 18 2016

Platformer in VR - Part 4

There were some obvious problems with my earlier progress with this project, so I had to take a step back before I could go on.

So I created a new scene, wiped all enemies from it, created a 15x15x15 grid, randomly filled it with blocks and dropped the player on top of it.
We are progressing forward again, this might be something interesting…

Nov 02 2015

Platformer in VR - Part 3

Managed to get some enemies into the game. Make sure to lean forward and look around corners to avoid surprise ambushes!

This is just a very first draft and needs a lot of work, but I really like how this is coming together.

Oct 22 2015

Platformer in VR - Part 2

Note that for this demo I’ve disabled the VR camera

So, it was pretty obvious what the next step needed to be. Particles!
I’m not really satisfied yet, but I haven’t spent a lot of time on it. It will have to do for now…
I have also rotated the directional light so the shadow falls more right below the player, so you’ll better see where he’ll land when doing a jump.

Next up: Enemies!!

Oct 20 2015

Platformer in VR - Part 1

This is how it looks through a VR Headset

I recently got to borrow an Oculus Rift DK2 from Resolution Games, and for a few couple of nights I’ve been playing around with an idea I had, that actually is starting to turn out pretty cool.

But it’s hard to get enough time with 2 months old twins that wants your attention =D

Apr 05 2015

2.5D Platformer - Part 2

I really liked the 2.5d version of the platform game I started on yesterday, so I kept polishing it a bit. And also started playing around with the level.

I really like the feel of it. You could create some really maze-like levels with this kind of set up. This could probably be turned into something pretty nice! Would be nice to add some ladders and moving platforms.

<< Click to play >>
Apr 03 2015

2.5D Platformer - Part 2

I’ve just started a Unity project at work, so even though I started off with my little c++ program I have to devote my free time to Unity for some time now. And also, since Ludum Dare 32 is only 2 weeks away, and I decided to go with unity for it, there’s even more reason to continue with Unity development yet for some time.

This one is actually one of my earliest experiments. It started out good, but I couldn’t really get it to behave just as I wanted so I put it in the dust bag. It is a good way for me to realize just how much I’ve learned since then.
My main problem was that the character was getting stuck in walls if you jumped to the side of it, and kept pressing forward. Easy enough to take care of! Just create a custom material for your platforms and modify the friction values.

Another thing I had problems with was the 3d-camera. As it’s tilted it was getting closer and closer to the charater the further he got to the right. Just because I didn’t adjust the z position. Very simple.

I started experimenting with cube texture mapping. I think tomorrow I’ll start looking into how I can write a custom shader to do it instead of modifying the UV-coordinates in the Start()-section of a script.

<< Click to play >>
Mar 05 2015

2D platform engine in unity part 11 - Wall jumping

Today I made the following new features

  • Moved the project over to the newly released Unity 5
  • Played with a particle system running as part of the background
  • Started on wall jumping feature (based on public demand), this is not all done yet though!
<< Click to play >>

Moving the project over to Unity 5 went pretty painless, unless the collider offsets were messed up on my platforms, meaning I had to adjust all of them. Luckily the level isn’t that big, which meant it only took a few minutes.
If I had turned the platforms into prefabs (which would have been the right thing to do) this operation would only have taken a few seconds.

And I’ve been playing with the though of adding some background particles. I wanted some slow/smooth/subtle background noise. Well… I don’t know what to think of it. I could have spent the entire night tweaking it. But instead I moved on to the wall jumping part.

I have to say I’m very satisfied with the gliding part (just need to add some particles while slowly sliding down the wall), but the actual jumping-part is horrible. But that’s something I’ll have to fix another nigth. Now it’s time for bed.

Mar 02 2015

2D platform engine in unity part 10 - Big level

Today, with the platforms finally fixed, I started expanding the level. I’m not sure how Unity optimizes what goes on behind the scenes, so the only way to figure out is to try it out.
Also, it’s a good way to find out what features I feel like I’m missing. Like pick-ups, or enemies that or obstacles that will hurt you.
It also gives me some room to really try out the features I already got. Like the treadmills for example.

<< Click to play >>

Mar 01 2015

2D platform engine in unity part 9 - Fixing platforms

I haven’t been coding much (on my game, that is) for the past two months. Instead I’ve spent a lot of time watching the Handmade Hero stream. It’s really fascinating and I highly recommend it, but I’ve been having some code cravings lately. So I decided to go back to my platform engine again.

Last time I coded on it I left it in a rather poor condition, with some buggy moving platforms. The problem is that the Character2dController reports to the platform that it has collided with it, and the platform keeps track of the colliding entity and reports back its change in movement to the Character2dController. But the platform only held a single instance of the colliding object, meaning it messed up if more than one entity intersected it. The problem was solved as easy as changing the variable to a list.

Something that is very useful when debugging this kind of graphical application (with several entities with different state and values) is to be able to easily read state data. For this I’ve added debug output above each Character. This debug is a stand alone component, so I could easily add it to the moving platform as well, to verify that the list of colliding GameObjects counts up and down as expected.

Apart from this bug fix there’s no new features, so I don’t provide a new build today.

Jan 15 2015

2D platform engine in unity - part 8

Last time I promised a bigger world, and starting with animations. It seems I forgot a very important feature: moving platforms!

Todays build features:
* Moving platforms (still a bit buggy)
* The moving platform to the left is a Solid platform, you hit your head if jumping on it from below
* The moving platform to the right is a Cloud platform. You can jump on it from below, and jump through it with down+jump
Give it a try

Known bugs (to be resolved):
* The platform can currently only handle one colliding object. If two or more entities touch the platform very strange behaviour will occur.
* You can fall through a platform if you fall downwards and it moves upward at larger speeds.
And as a side note: I think the game looks better with Unitys debug stuff enabled. Don’t know if you can export the web player with those enabled. I think not…
Next time: Platform bug fixes and then performance on big worlds and animations.

Dec 29 2014

custom 2D physics in unity - part 7

First of all, a disclaimer: I have decided to change the name from physics to platform engine from this point. Not sure how much more physics I will implement right now. I think from now on it’s time to focus more on trying to make this into something playable.

Todays build features the following:
* Bugfix for Treadmills reaction to player
* FPS Counter (in top left corner)
* Xbox 360 Controller support (at least on Windows), not sure if it works in web player…
* NPC:s with same physics component as player. Very simple AI controller

Give it a try

Finally the work started to pay off with decoupled physics. The input is also decoupled, meaning that I could just duplicate the player logic, remove the input script and attach a simple AI controller instead. Now we have a whole bunch of red NPC:s running and jumping around.

I think next step might be to build a larger world to be able to see if performance is doing ok in a larger setting. Otherwise I think that it’s time to start looking into graphics and animations.

Dec 27 2014

custom 2D physics in unity - part 6

Try the current build

News in this build:
* Refactored character controller system (more on that below)
* Jump button is now space bar instead of up arrow (conflicted with ladders)
* Disable gravity while on ladders (was buggy before)
* Cloud platforms are disabled while climbing ladders (can climb down through them)
* Down+Jump while standing on a cloud platform and you jump down through it
* Removed that silly fist

Been some while since I last wrote now. Been doing some other stuff than Unity (some c++, and some updates to Ripple and its level editor). But now it’s time to get back to this little project again.

Something that bothered me a lot in the past was how fast it gets messy when implementing platform mechanics. You need need to keep track of if you are jumping, falling, standing on ground, climbing, ducking, sliding, hurting, attacking. And these states gets intertwined into each other. For example: what is a valid state for a charater to jump? He should be standing on the ground – unless if he’s climbing a ladder… or if he’s hurt or dead. And if the player pressed the jump button and the character lands on the ground without releasing the button then we shouldn’t automatically jump again until the button is released and pressed again.

My very small piece of code had already started to get messy this early on, so for a few days I’ve been refactoring it into smaller, more independant and stand-alone modules. This new version is completely rewritten, and all the previous functionality has been ported. Along with a lot of bugfixes.
Still the physics feels a little weird, so some more tweaking is needed. I guess next step is to implement some simple enemies with the same character controller…

Nov 03 2014

custom 2D physics in unity - part 5

Late and tired tonight as well. Just a very short, and very unserious session tonight.
Been thinking about using Adobe Kuler (seems to have been rebranded to Adobe Color CC) to get a better palette of colors to use when working with programmer art as I currently do. The result wasn’t very impressive so I guess it needs a little bit more tweaking.

I also added a punching fist a la Alex Kidd, but the player doesn’t have anything to hit yet. And the ladders are still broken (will fix that in my next session).

Here’s a short demo of the punching fist

Oct 30 2014

custom 2D physics in unity - part 4

Started on ladders today. But it’s late and I’m really tired so I’ll have to continue some other night.
Still happy with the result so far though! This will be awesome once I’ve tweaked it enough.

Try my ladder here

Oh, and by the way: the source code for this can be found here in case you wonder how I did stuff: