Salomonsson.se
May 17 2015

Iterating level design part 2 - Starting over

After spending two more nights trying to improve my 2.5d game, and not getting anywhere at all, I decided to let it rest for a while, and try to improve one of my older games instead. My choice fell on my Ludum Dare 30-entry “Trapped Between Worlds”, which meant I had to dust off my old Haxe skills once again. But it went quite smooth. The code is in surprisingly good condition regarding that I wrote most of the game in 48 hours..

I have to admit I like Haxe an aweful lot! And I realize after tonight that I still do.

You can read about how I customized the Haxepunk framework for this entry here

So the first thing I did was cleaning up the hub-level. The part where you get transported between the different levels, and where you buy updates with the money you’ve collected. I wanted to make this level much bigger and more interesting. I started by adding water and a village. Since I’m working on level design here I don’t really care much about graphics at this stage.

Village with NPC can be found here

If you walk to the left instead you will enter the forrest area, where I added a new enemy. Your regular spider that drops down from the top.

Invisible cobweb at the moment

I will keep posting updates on the progress. No playable demo this time.

May 09 2015

Iterating level design - Part 1

Keys and padlocks

So, for the last Ludum Dare contest I used parts of the code from my 2.5d platformer seen below (the code to turn the camera around corners), and during 48 hours I tried to make a decent game out of it.

The game felt like it was really, really great for the first one and a half day, until I started implementing the levels (late as usual). Then it quickly fell apart as a very linear, and actually quite boring experience!

This is something I’ve felt before. That the level design becomes my weak spot. So what do you do with your weak spots? You try to make them go away. With practice and hard work. It might also help with a lot of patience, curiosity, study and the help of good friends!

So here comes part 1 of my re-implementation of that game!

(Links are in the bottom of the post)

READ MORE >>
Apr 21 2015

Ludum Dare 32: Caffeine Rush

Theme: Unconventional Weapon

Everyone loves cubes, right?

http://ludumdare.com/compo/ludum-dare-32/?action=preview&uid=2393

I am a developer who prefers two dimensions. Two dimensions means safety for me.

But sometimes we need a challenge, and I decided beforehand that I would try to make something in 3d this time. I have to say that I’m quite pleased, even though I ended up locking the movement to two axis anyway (so I guess you could call it 2.5 dimension), but I’m quite pleased with how you can play with depth to create a visually interesting maze like in the screenshot above.

READ MORE >>
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 10 2015

C++ and openGL... creating a window

Took a short break from the Unity project to go into C++land. Decided I wanted to play around a little with some C++ and openGL.

I wanted to develop on my Linux partition (why make it easy for yourself?) but make the code cross platform so I’ll still be able to run it on my windows machine. I decided I wanted to use glfw for all the window, input and timer hassle. It seems light weight, and it is used in this tutorial by my colleague at Isotop (he named the blog series “I’m not a smart man” for some reason. Trust me that it is very far from being true!)

So, did it go smooth? Not at all. I’ve spent a bit over three days trying to figure out how in *#¤% you manage to tell Code::Blocks how to find and link the libraries I want to use. I’ve covered it in a blog post, mostly for my own convenience. Probably full of incorrectness.

Well, now I have a spinning triangle in a window. Time to make something more interesting!

Mar 10 2015

C++ and openGL - Part 2

Continued with the C++ project. Noticed that the sample code for my triangle was in the older glBegin…glEnd format and changed it to the new opengl 3 standard with shaders, only to get a totally black window. Turned out you need to add the following code to enable opengl 3 and core profile:

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

Which gave me a triangle once more.

The rest of the evening was spent re-reading about matrix operations, and the Model-View-Projection matrices. It was a long time since I last played around with this. You quickly forget if you do not keep working with it.

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.

Feb 02 2015

handmade tommy part 1

Since the Christmas Holidays I’ve started watching the fairly new stream Handmade Hero, where we get to follow Casey Muratori, as he builds a game in C, from scratch, without any libraries, and streaming and explaining every single line of code that he writes.

I’ve been struggling with C++ for a while now, but it’s very difficult to find answers when you get into a situation where you need help with a specific problem. There are endless ways of solving the same problem in C and C++, and very often you will get contradictionary or incomplete solutions. And a lot of times people just answering “You shouldn’t do it like that” and then nothing more.

So I enjoy this video stream very much. Casey explains every single line of code he writes. And also sometimes explain other ways to solve a task, and why he prefers the one or the other. He also tackles some very advanced topics, like how to structure your code to get a good foundation for platform independance. And he does it very elegantly.

The stuff he teaches is not something you wouldn’t easily find in any text book, and corresponds to years experience, so I highly recommend watching.

At this point I’ve watched Episode 13, and coded up to episode 5. I Haven’t anything more interesting to show right now than a simple window, with a simple animated buffer (rendered in software) in Windows. All I have to show for it right now is a simple Screenshot.

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