2D platformer (Boxman)

I started doing a 2d platformer and decided to share some thoughts of the development here. We are using Libgdx and aim for desktop and Android.

The latest screenshot:

Latest video:

MWrFUOIHpr4

Something else:

0IWoWuarjhE

What are you supposed to do? :clue:

I’ve just recently started to make the game, so there isn’t much to do yet. Right now you can just jump around and so. I haven’t even made the map editor yet, although I also try to add some kind of procedural map creation to this.

Edit: Right now I’m trying to make collisions work 100% accurately.

Problems:
a) Moving box on top of another moving box is not working all the time (sliding away)
b) Leaning against an object on the left seems to put you 1 pixel inside that object.
c) Some other problems I’ve not identified yet.

I made the game area a bit bigger, 600x300. I also fixed one bug on physics, but you may still go inside walls sometimes. The problem might be, that if the position of the object is corrected, I don’t go through all the other objects to make sure it doesn’t affect them. I need to start polishing the code and then figure it out.

I made a randomly created path so there would be a bigger area to test the game, and noticed, that at some point drawing starts to bug a bit. I think it might be when the x-position goes negative.

Edit: use + and - to change the size of the character.

Nice! Seems to have potential. This reminds me of how mine started out (insert nostalgic smiley here) http://www.java-gaming.org/topics/bounce-2d-platformer-w-destructable-terrain/27023/view.html

Thanks, and wow! :smiley: Seems like you have put a lot more effort to your game. I’m trying to keep this small(ish), so I would actually finish the project at some point, and make it polished. I started this out as a “quick work sample” to my website, but it just keeps getting bigger (as they always do).

Two main things I’m considering right now are multiplayer and procedural map generation. Especially multiplayer is something I’ve never done, so it could be a real problem… And that’s probably the reason I should do it.

I made the highness of the jump depend on how long the player presses the up button. I don’t know if it’s better than before, but I like the idea of being able to control the jump better.

I should refactore the physics and collision detection part of the engine. Too many magic numbers, and the code isn’t well structured.

Edit: Now you can also jump from the walls. Just lean to the wall (press to the side) and then jump. This can be done only once per jump (the character needs to be grounded in between).

I also noticed that when playing in browser, the game doesn’t look as smooth as when using the Eclipse Applet viewer. Anyone got any thoughts on that?

I’ve been trying to port this to Android, but something is not working as I think it should. Without any heavyweight things I get around 17fps, and with everything (especially physics) on, the game freezes to < 1 fps. Apparently I’m doing something very, very wrong.

I’ve added a way to “attack” by pressing down when the character is jumping.

Looks like hardware acceleration is not an easy task achieve with plain Java. I want to make this game without any external libraries which makes it hard to get smooth drawing… I’ll need to get back to this later.

I think new graphics are pretty (Teemu did those). :stuck_out_tongue:

https://lh6.googleusercontent.com/-Cy2Z3y8iqZU/UMbu-0NswtI/AAAAAAAACNg/AWL6fhpyitw/s620/2012.12.11%20Boxman.png

The graphics look very nice. What program do you use? (I use Paint.NET for pixel-art, and gimp for making backgrounds) :slight_smile:

Teemu did mock-ups with Google Drawing. I usually use Paint.NET for everything I need to do (which isn’t much or sophisticated). The drawing in the game is currently just filled rectangles - the intention is to change tile size depending on the screen size.

Looks like I got the hardware acceleration to work after all. It would be nice to hear how smooth the game feels if someone has tested the Applet? You can also open the Java console while playing to see if the hardware acceleration works on your machine.

Edit: I’ve added one video (quite poor quality): http://www.youtube.com/watch?v=sTBJmiiL7Wo&feature=plcp

A small update. Rendering is now done in a separate thread which could make things smoother… But somehow something is still missing. You can compare the old and new implementations:

Old:
http://arttu.louhigames.com/game

New:
http://louhigames.com/2dplatformer/

The new one doesn’t look as good because it has smaller blocks. I’ll figure out a way to draw them more nicely.

All feedback is welcome as well as tips on how to make the game run smoothly.

I added a bit longer tether to the camera and now this

http://louhigames.com/2dplatformer/

version looks “good” I think.

Content would be nice.

I’ve added digging and building, and simple sounds.

Arrow key + x => digging.
c + arrow key => building.

Seems to be buggy and may crash. Deleting objects probably causes some nullpointers.

Jar also works as standalone:
http://louhigames.com/2dplatformer/

If your OS is Windows, you can use Microsoft Expression Encoder for screen recording.

It has amazing performance even with high quality recordings.

And it’s free for the full version.

http://www.microsoft.com/en-us/download/details.aspx?id=27870

That might help you get a better video.

Thanks a lot, I’ve added a better video. Didn’t get the audio though, but I’ll figure it out when I have the time.

Edit: I also fixed a bug that caused a nullpointer ex and added some delay so that you could more easily jump from the edges (certain amount of time after the falling has started when the jumping is still ok).

I want the maps to be very big, so I’ve been implementing a way to activate and deactivate blocks based on the distance from the player. The base functionality is done and surprisingly also somewhat working, but I still need to do some performance tuning. At some point I was able to play 100x100 map without the modification, and 1000x1000 with the modification, so I think it’s going to work just fine. Enjoyable programming.

Now there is line of sight too. LoS and block activation / deactivation runs in a separate thread scheduled to run in intervals.