Code 15 - Top Down Shooter

I though I would go ahead and post what I am working on at the moment, currently as it stands it is just mainly working on an engine to work with.

The main reason for working on this project is to practice engine design, file input and output and try to wean myself off the habit of looking for a “do everything” library, if that makes sense.

I am currently using:

Box2D Physics Engine

Pickup Test Level

What is Code15?

Update 13/03/2014 - I have been brainstorming over the past week or so and I think I have a general idea of the story/setting, I am constantly writing down new ideas and putting them all together, here is a little teaser of the opening script for the tutorial/first level that fits in with what I have so far:


"Welcome subject, to the Code 15 Testing Facilities, please follow the instructions carefully so we can complete a medical and motor skills test.

Controls intro

Test complete, it seems you have not suffered any brain damage, congratulations you will not be euthanized today.
Let us hope that you will last, it is notoriously difficult to extract new ones from their tube without causing severe damage.

Please follow the path to the next area, please, try not to trip and die.

To be continued…

Cheesy right ^ you can probably guess where it is going.

Currently as it stands, not much! However I can describe what it WILL be so you can picture it. It will be a top down shooter/puzzle game, imagine fast paced levels with lots of things going “boom”, plenty of enemies to kill and different weapons to pickup/use.

All complete with Box2D physics, such as grenades exploding into many little bodies and damaging the environment, I aim to create semi-destructible levels, as in the boundary/walls themself will be unbreakable but anything else should be able to get destroyed.

With all this I want to implement fast paced, think on your feet puzzles, disarming bombs, collecting keys in order to progress etc etc.

Over all I have a plan, all wrote down and a design in mind. However I am keeping it SIMPLE as possible at first, I expect to have a playable level within a month (according to my time frame) with basic functionality such as collecting items, enemies etc etc.

What is currently done?

Currently I have focused on mainly coding a level loader (that I was intended to only practice with…) but last night I brain stormed and decided to make a project off it. - Done!

The level loader is simple, I could easily use Tiled but decided not to. At the moment the level loader is capable of loading a level of any size from an image file (each pixel = 1 box2d unit). That sounds boring right? Kind of is, however sort of proud that I actually managed that.

Oh and it also creates and places Star Trek doors at the appropriate locations complete with bad ass sliders and sensors! That I am proud of. Anyway…

What I am working on the now

26/02/2014 - At the moment I am working on the core engine of the game while still trying to give myself visual progression, I have implemented working sliding doors and will most likely leave it as is for now and perhaps start working on player state and control system. So lets go with that, state/player controller.
13/03/2014 - Currently working on creating some levels using what code I have so far, although the level loader is complete I am most likely going to create a class that controls the config loading, as to keep the level loader class tidy. Will also be drawing some other sprites on the side and implementing more guns and items, I also have a bad ass throwable explosive concept planned on paper
21/03/2014 - Properly coding a way to create, spawn and manage entities. Oh and I sort of need to actually create entities, I have no enemies at the moment. I am also working on a path finding demo, that allows you to create your own level of walls and doors and set an entity start point and end point, and watch them work their way across the map :slight_smile:


  • WASD - Move
  • Arrow Keys - Open respected doors
  • O - Open all doors
  • C - Close all doors

For now I present you with a Door Test Simulation:

Download - Bitbucket
Download - Dropbox

The code is currently not going to be available until I develop further.

Download is not available without logging in BitBucket.

Will provide dropbox link, also implemented some visual graphicsso it’s no longer Box2D debug stuff.

I think you need to change your profile photo :smiley:

Yours appears to be missing :stuck_out_tongue:

yes please haha

lol not :stuck_out_tongue:

this is really cool =D

Works quite nicely, the doors open just like they should be. It ran perfectly fine on linux.

One thing that didn’t work so well was pressing “W” and “D” at the same time. I couldn’t be playing a top-down game if that wasn’t possible! :smiley:
Another thing is the reactivity. It’s okay that the player takes some time to walking, but I think the effect is too slippery.

And I also agree to the profile picture. I don’t quite like it either. It’s kind of … uhh… distracting ^^

Here is a little tip for file hosting with dropbox.

If you have a link your giving out, to a folder or file, try
adding a ?dl=1 to the end of the link. It will automatically start downloading
the file(s) and not link the person to the dropbox web pade with the big button
that sais download.

Not that clicking the Download button is much of a hassle, but it is nice having it forcedownload.

I’m pretty sure most links automatically download anyway. I had a game launcher that downloaded files from Dropbox, so it obviously couldn’t click Download, but it still worked.

The movement needs tweaking, I just slapped some if statements in there to get it going.

Yeah, he is supposed to sorta speed up to a running pace then slow down quickly, needs fine tuning.

The entire thing is WAAAAYYY off being a game it is a work in progress :smiley:

@all about picture

I had one with a monkey throwing shit at the camera, could be worse…

Here is a tip for smooth movement:

public void update()
    // Do input stuffs here
    boolean key_left, key_right, key_up, key_down;

    // Add to velocity
        velocity.x += (-1);
        velocity.x += (1);
        velocity.y += (-1);
        velocity.y += (1);

    // Update position
    x += velocity.x;
    y += velocity.y;

    // Dampening the speed

    // Fine jimmt...
    if(velocity.x < 0.0001)
        velocity.x = 0;
    if(velocity.y < 0.0001)
        velocity.y = 0;

Smooth movement guaranteed. 8)

How does this make any sense, your character just constantly accelerates to inifinity.

I think that’s the point :stuck_out_tongue:

Isn’t that the question, Jimmt?sorta[sup]-ish[sup]-kinda[sup]-relevant[sup][sup]good read tho[/sup][/sup][/sup][/sup][/sup]

You will constantly be going at 90% of the speed of the last frame, so if you just tapped the button, the speed would go from 1, to .9, to .81, until one second has passed and it is only .9^60 = 0.00179701029. And that will just get smaller.

That dampening will get it down to lower than 0.00001. At that point you would not even see the movement.
If you really want, add this:

if(velocity.x < 0.0001)
    velocity.x = 0;
if(velocity.y < 0.0001)
    velocity.y = 0;

[sup][sup][sup][sup]wait, did I typo?![/sup][/sup][/sup][/sup]

@wessles, I think Jimmt meant the speed is unbounded if the button is held down.

How 'bout a logistic acceleration curve (note, completely untested, don’t know how it would look):

public void update() {

    // Add to velocity
        velocity.x -= 1;
        velocity.x += 1;
        velocity.y -= 1;
        velocity.y += 1;

    //limit the velocity
    velocity.x = MAX_VELOCITY/(1 + (MAX_VELOCITY - 1) * Math.exp(-ramp * Math.abs(velocity.x)));
    velocity.y = MAX_VELOCITY/(1 + (MAX_VELOCITY - 1) * Math.exp(-ramp * Math.abs(velocity.y)));

    // Update position
    x += velocity.x;
    y += velocity.y;

    // Dampening the speed

edit: fixed some things that didn’t make sense

Well, collision aside, isn’t that the case with most games?

Also, yes; curviness is fun as well.

No, the player may keep moving but it doesn’t keep accelerating.

Whoops! That was deceleration :P.
[sup]Actually, acceleration is only the rate at which the velocity changes, never specifying a decrease or increase.[/sup]