Posts Tagged ‘Pulpcore’

Ludum dare 11: Final version

Sunday, April 20th, 2008

Well my entry is as complete as I will get it in the time allowed.

Here is a screen shot of the chaos.

Screenshot

Play the game here

Source Code
Minimalist source code

Quick run down of tools used.
Pulpcore
Applet framework.

JBox2d
Physics engine.

Eclipse IDE
IDE I used to code it.

Ludum dare 11: First release

Sunday, April 20th, 2008

I have been coding an entry to the Ludum dare 48 hour game programming competition.
The theme for LD48:11 is Minimalist.
So my entry is pretty minimalistic, just colored squares trying to crash into each other with some retro sound effects generated by this awesome application sfxr.

Here are some development screen shots.

Here is a link to my entry as it currently stands.

Instructions.
Use the arrow keys to move the blue square.
Dodge the red squares as they try to fall on you.
Red squares will turn white after staying still for a short time and are safe to touch.
Use the mouse to move the green cursor, click to fire a yellow square. The yellow square can help deflect red squares.

Testing custom loading screens with Pulpcore and Sloppy

Saturday, March 29th, 2008

Pulpcore provides a pretty good user experience with its built in loading scene. How ever there may be time where you wish to do some thing a little more interesting.

Like most thing in Pulpcore this is pretty easy to do.
In my example I have chosen to have a skull themed loading screen.

Here is the very basic steps needed to create a custom loading scene.
The first thing you need to do is extend the loading scene Pulpcore provides.

public class LoadingScene extends pulpcore.scene.LoadingScene

Next create a constructor that tells the base loading screen what asset file to load and the scene to display after loading.

public LoadingScene()
{
    super("skull.zip" , new SkullScene());
}

Next is to override the load function.
It is here that we tell the main layer to discard all of the default sprites.
I have read that you should create a timeline that animates out your scene and calls the new scene by setting the onCompletion with your custom timeline. I forgot to do this in my demo and it still worked ok. So if you find your loading scene loads but never moves on I would check out that bit.

public void load()
{
    super.load();
    getMainLayer().removeAll();
    //super.onCompletion(timeline);
 
    //Own sprites go here
}

Next override the update function to update your scene as needed.
You will need to call the super.update as well. This will get the existing asset download management code to do its thing so you can focus on drawing some thing interesting.

public void update(int elapsedTime)
{
    //Update your loading screen here
    super.update(elapsedTime);
}

So in a nutshell that is a basic custom loading scene.
After I had this all setup and running came the question of how do I test it?
Running locally my applet would load in under a second so you would only get the briefest glimpse of it.

That is when I found this cool Java app called Sloppy
Sloppy will emulate a slow connection for you. So for testing I build my applet and drop it onto my local web server.
Next I run Sloppy set the connection speed to some thing slow, point it my new Pulpcore applet and off it goes.

I have a demo of custom loading screens here
Here is a plain text link so you can try it with Sloppy if you happen to have a fast connection and would other wise miss the loading screen.
http://blog.alexjeffery.org/files/pulpcore/skulls/
You should see a black screen with some white skulls flying about and a big loading bar with a skull on it.
After that loads up the same deal but in white with pretty colors, a logo and some music that where loading during the loading scene.

Demo
Source code is here
Music credits to my friend Pimpfish

Pulpcore and JBox2d: A simple demo

Saturday, March 29th, 2008

Found a physics library called JBox2d the other day.
It is a Java port of the Box2d physics library.

The demos on the JBox2d site looked pretty interesting so I decided to see if I could get it to run with Pulpcore.
I managed to get a simple demo together fairly quickly.
It is a demo where you are able to drop a domino into a scene. You can also create new floors by right clicking 4 points in a clockwise order. IF you cross the points or drawn them out of order they will render but will not take part in the physics simulation.

Demo
Source

CakePHP session lost when using Applets or Flash

Thursday, March 27th, 2008

Recently I have been developing a website on my dev machine using the CakePHP framework. During this I ran into a problem where I could log a user in, view a Pulpcore applet and then be logged out right after viewing it.

After doing a bit of searching on the net I found the cause and the solution.

The cause:
My Pulpcore applet trying to do a request a CakePHP action from the web server to get and set the highscores.
CakePHP would check the HTTP_USER_AGENT and compare it to the one used to create the session.
When it found that they differed it would kill the session thinking it was preventing a session hijack attempt.

A solution:
In the config/core.php set the following lines
Configure::write(’Session.checkAgent’, false);
Configure::write(’Security.level’, ‘medium’);

This will stop CakePHP from regenerating a session every request and stop CakePHP from checking the user agent.
After that my Pulpcore applets where able to request actions as the logged in user fine and keep the session alive.

Pulpcore Pong

Sunday, February 17th, 2008

I wrote a quick version of Pong in Pulpcore
Hope to get some free time soon so I can write it up as a proper tutorial but I have released it into the wild now.

See the demo here
Pong source code

Fixed Time Step Game Loop Demo

Sunday, February 17th, 2008

I have been doing a little bit of reading on game loops.
I found two good articles on Fixed time step.

One on flipcode here
One on Gaffer on games here

I also made a very quick demo of a fixed time step game loop with Pulpcore.
You can find the demo here

Fixed time step demo source code

Game of life

Saturday, February 16th, 2008

Just wrote a quick game of life applet using Pulpcore.

See it here Game of life

Game of life source code

Pulpcore: Hello world tutorial

Wednesday, February 6th, 2008

A while ago I found a neat Java API called Pulpcore

Pulpcore is an API for creating games in Java as web applets while maintaining a good user experience.
It looks to be quite promising from my dabbling with it so far.
Check out the demo game Milpa to see for your self.

A weak point I can see with Pulpcore is the lack of documentation for people to get started with.
So now I will introduce a setting up a simple Hello world tutorial with the awesome Eclipse IDE.

You can find the tutorial here.

Enjoy.