Platformer Day 2.5: Aliens!

alien-1

I’ve made a bit more progress and have added a little green alien which chases after the player, and is currently learning how to climb up walls (trickier than I thought it would be). The alien is more adorable than I was originally going for, but it’ll do for a start.

Next up:

  • another type of alien
  • a reasonable map to run around in
  • better AI for the lil flesh eating beasties

Leave a Comment

New Project: 7 Day Platformer

My new project is purposefully a short one. I recently learned about the flixel library for making games in Adobe Flex (it’s like Flash, but just code), and thought it would be a fun way to learn a bit about Flex and Actionscript 3.  I haven’t used Actionscript since I played with Flash about 6 years ago, and I definitely like the nature of building Flex applications a lot better than working in Flash.  The flixel library is also very cool — it is a super simple library mainly for building platformer type games, although the code is clean enough that people have modified it for a lot of other cool things (a particularly cool example).

platformer-1My hope is that I can use flixel to build my own platformer in 7 (not necessarily consecutive) days.  I’m also counting days where I only spend a short amount of time on the project as half days, since otherwise I’d be too tempted to ignore my real work in favor of playing around with this stuff all the time.

So far I am 1.5 days into the project, and I’ve learned enough of the basics to get my little spaceman hero running around the screen. I wasted more time than necessary trying to get some of the animations to line up properly (the original art is from here, and appears to be public domain, although the IP behind the character is almost certainly copyrighted…).  I’m trying to remind myself that if I want to make something remotely playable in 7 days worth of work, then I need to focus on the big features, not whether the player’s plasma rifle jiggles up and down a pixel while running.

Remaining Features:

  • Randomly generated or handmade maps
  • Shooting*
  • Voracious aliens

* someday I’d like to make a non-violent game, but I honestly haven’t figured out how to do that yet

Leave a Comment

Half a year’s worth of RPG design

Like any good blogger, it’s been quite a while since I’ve updated here. The reason is that I fell into a common trap for aspiring game developers – I tried building a game that was way too big. Every advice article on game development tells you to make small, simple games like puzzlers or basic arcade games. Unfortunately, when I think about building games, I tend to envision grand scale sandbox worlds full of adventure, so my “small” game was just going to be a open world role playing game with infinite replayability and all sorts of other cool stuff.

Iso Combat

I’m also heavily inspired by artwork, so when I saw some cool looking isomorphic style game screen shots, I thought I would try to build a game like that. I actually spent quite a lot of time trying to build a generic turn based combat framework first, but soon discovered that having concrete visuals for my game gave me a lot more motivation. In the end though, the movement on the isometric grid became a pain because I was using a weird coordinate system.  I also realized the project was just way too complex to ever get finished, and I didn’t actually have any great ideas about how to make turn based fantasy RPG combat particularly fun.

To make movement simpler, I switched to a top down perspective, and drew some inspiration from the Roguelike variety of games. I read that roguelikes are one of the few types of games where a single developer is capable of producing a full game. This is generally due to the fact that these games use simple ASCII display characters instead of real pixel art, but I ignored that fact and figured I’d see what I could build.

twrl1 twrl2

twrl3 twrl4

It started out pretty simple, and it helped that I had a nice tileset to start with. It took a bit of work to make the tiles display properly (it automatically figures out where to draw each type of wall), but the result looked quite nice. Next I added a few monsters to walk around (luckily Slick has built-in A* that made this very easy).  Then I decided it looked too much like you were walking around through a well lit mall, so I added some lighting… much better! Finally, I added a stats and inventory screen which is actually more or less usable.

I quite like how the game looks as you wander around through dark corridors, but to make this into a full fledged game will still take a lot more work. I started reading up on procedurally generated dungeons, since the idea of building all the game maps myself makes the task even more intimidating. I’ve tried the BSP based dungeon generation technique described here a bit, but haven’t found something I really like yet.

These have been a fun pair of projects, and I’ve learned a ton from both of them. For me, I don’t really build games with a goal of completing them, but instead with the goal of learning some interesting things along the way. It’s a great creative outlet.

But, I am trying to learn one important lesson from all this work — it really is best to try a SMALL game design concept!

So I’m already starting my next project which will take this lesson to heart… perhaps in another six months I will have learned the important lesson of “sticking with a project until you complete it”….

Leave a Comment

Space Combat Revisited

I played around a bit with my space combat demo the other day and found that it was actually a lot more fun than I had remembered.  Trying to shoot at the enemy isn’t very exciting, but just flying around can be quite entertaining. I’ve been trying to think a little more about ways to make the game more fun and realy take advantage of the good parts of the game.

What is fun:

  • Weaving in and out of enemy projectiles
  • The smoothly zooming camera system

Not so much fun:

  • Repeatedly shooting at an enemy while it sits there and shoots you
  • Losing the sense of speed (mainly happens when there are no planets within your field of view)

Here’s what I think might be fun

  • Change from 1v1 duels to having lots of small enemies trying to stop you as you race towards some goal
  • Have asteroids or some other obstacles frequently in your way to give both a better sense of speed and more difficulty
  • Have periodic 1v1 boss fights that require you to target the boss’ weak points and recognize its attack pattern

I’m not entirely sure how these fit together, but it could make sense if the idea is that you are making some last ditch effort to break through some enemy defenses to reach their main capitol ship. I’m mainly worried about the programming aspects of implementing these ideas — the primary reason I wanted to make a space game was to be able to avoid complicated things like collision detection and fancy AI!

So I’m not sure how this will work out, but the ideas have inspired me to start working on the code which otherwise had been abandoned for about 6 months…

Comments (1)

Eclipse Debugging Error: ClassNotFoundException

I just hit a really annoying (sort of) bug in Eclipse. I could not debug any of my projects because they immediately stopped with a call stack like the following:

terrain.TerrainApp at localhost:49827   
    Thread [main] (Suspended (exception ClassNotFoundException))   
        ClassLoader.findBootstrapClass(String) line: not available [native method]   
        Launcher$ExtClassLoader(ClassLoader).findBootstrapClass0(String) line: not available   
        Launcher$ExtClassLoader(ClassLoader).loadClass(String, boolean) line: not available   
        Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: not available   
        Launcher$AppClassLoader.loadClass(String, boolean) line: not available   
        Launcher$AppClassLoader(ClassLoader).loadClass(String) line: not available   
        Launcher$AppClassLoader(ClassLoader).loadClassInternal(String) line: not available

I found people with similar issues on various message boards, but no solutions.

Then I figured out that if I kept hitting continue (to go past the breakpoint) it would eventually reach my actual application. Along the way though, java was triggering ClassNotFoundExceptions for every single class referenced in my code, which was causing Eclipse to break. It turns out that these ClassNotFoundExceptions are normal behavior – they are supposed to happen for every new class, but having eclipse set a breakpoint for each one is definitely not!

To solve the problem, I had to open up the breakpoint window and disable the breakpoint “ClassNotFoundException: caught and uncaught”  — I have no idea how this breakpoint got set in the first place, I certainly didn’t do it!

So now I can finally debug my programs without relying on tons of print statements… that should help my progress.

Comments (24)

Mini Tutorial: Making Java Webstarts

Here is a quick an easy tutorial for making a Java Webstart version of a Slick based game with the help of Eclipse. A more thorough wiki on the subject is available here, and an older and I think slightly out of date document is here.

Create a Jar file

First, right-click on your project and select “Export…”

Second, select a Java – Jar File.

Third, choose “Export generated classes and resources”, and put checkmarks next to any folders in your project which contain either source files or resources (images, sounds, etc). Fill in a name for the exported jar file, and hit Next.

Fourth, (optional) select the “Save description…” box and put in a place to save your export properties. This will allow you to easily export your jar file again later when you want to update your webstart.

Create a JNLP file

Fifth, we create a .jnlp file. This provides the meta information about your project like where it is located on the web, and what other libraries it requires. In Eclipse, choose to create a new File, and name it yourproject.jnlp.

Sixth, fill in the file with this template (borrowed from the Slick wiki)

<?xml version="1.0" encoding="utf-8"?>
<jnlp
  spec="1.0+"
  codebase="http://www.mydomain.com/games"
  href="mygame.jnlp">
  <information>
    <title>My Game</title>
    <vendor>My Vendor Name</vendor>
    <homepage href="http://www.mydomain.com"/>
    <description>My Game</description>
    <description kind="short">My Game</description>
    <icon href="icon.gif"/>
  </information>
  <resources>
    <j2se href="http://java.sun.com/products/autodl/j2se" version="1.4+" max-heap-size="128m"/>
    <jar href="mygame.jar"/>
    <extension href="http://slick.cokeandcode.com/demos/slick.jnlp" version="0.4"/>
  </resources>
  <application-desc main-class="MyMainStartupClass"/>
</jnlp>

Seventh, replace the generic info with the specifics of your project. In particular, you must specify:

  • codebase: the URL for the directory where your .jnlp and .jar files will eventually be stored
  • href: the name of the .jnlp file you just created

The title and homepage you can fill in as you wish.  In the <resources> section you can specify if your code requires a specific version of Java. The second line <jar href=”mygame.jar”/>, should be replaced with the name of the .jar file you made way back in step 3. Finally, the <application-desc main-class=”MyMainStartupClass”/> should specify the class in your project with the “main” method.

Send it to the web

You have now created the two files you need.  All that remains is to upload the .jar and .jnlp files to your webserver.  Be sure that you place the files into the same exact directory that you specified in the .jnlp file!

Tenth (sorry we skipped a few numbers), open up the URL of your .jnlp file and play your game!

What if it doesn’t work?!

A few things can go wrong.  Most comonly, you don’t set a path or file name right for either the .jnlp, .jar, or main class. Double check those first. Also, keep in mind that you cannot just change a local version of the .jnlp file on your desktop and double click it — you must upload the changed file to the server to make the changes have any effect.

If going to the .jnlp URL just results in showing you the text inside of the file, then you need to tweak some settings on your web server so it understands that web clients don’t want to read XML, they want to play your game! A couple of solutions to this are available here. Most likely you can fix the problem by adding these lines to a .htaccess file in the directory with your .jnlp:

AddType application/x-java-jnlp-file .jnlp

Hope that helps!

Leave a Comment

Isometric Terrain Generator

I’ve been trying to learn about automatic terrain generation and different types of tile maps.  Luckily, I stumbled on a great tutorial about generating nice random hilly terrain, as well as a few tutorials on rendering tilemaps both from overhead and isometric views.

I decided to put my new knowledge to work to make a simple heightmap generator combined with a tile viewer. Currently my tiles are just filled in squares, but I think it gives a nice feeling so far. It supports both an overhead view and an isometric perspective. The isometric view is generated by some simple transforms on the overhead one.  I’m hoping to write up the details of how to make this work later.

You can try it out here.

Controls:

  • <space> generates a new random set of terrain
  • <I> toggles between an overhead and isometric view

Resources

Leave a Comment

Pixel Art

I’ve been doing something completely different for a bit.  I’m taking a break from space ships to work on medieval fantasy world adventure sprites. This started when I stumbled on to the Free Pixel Project, which has become a collaborative effort to make a bunch of simple RPG-style sprites based on characters from a web comic (or so I gather).

Nobody had worked on the sprite sheet for a while, so I spent some time fixing the position of the sprites and filling in a few more animations.

Changes:

  • Standardized offset for all sprites. Now both forward and back facing sprites are 2 pixels above the bottom border.
  • Added walking up and down animations for the bald, dwarf looking dude.
  • Gave better haircuts to all the guys who used to have really short hair from the back.

Here is the top part of the updated sheet (Click for the full version):

And if it is of any use to anyone, here is a photoshop .psd file with the characters and background split into different layers. This makes it a lot easier to move them around and extract the ones you want.

For reference, the file I started with was this one.

Licensing: I relinquish all rights to the original creators, which released it as Creative Commons.

Comments (1)

Space Combat Test – A Failed Experiment

A while back I finished a very simple test for the combat planned for my game. Unfortunately, I’ve become (mostly) convinced that it’s not really going to be the feel that I’d like.

You can test it out here.

Use the arrow keys to turn and accelerate and space to fire.  You can restart with R and quit with escape.

I feel like the fast paced combat is too fast and hard to control in any interesting way.  Here are some possible ways to improve it:

  • Make lots of small weak enemies – If they can’t do too much damage, then it can be fun to zip around and watch them all explode.  This isn’t really the direction I want my combat to go though.
  • Reduce rate of fire significantly – Adding more strategy to aiming would probably require a change to a WASD+mouse control scheme. This would give the player a lot more precision in where they are shooting (although it does make the control scheme more complicated).
  • Add obstacles – Currently there are planets floating around which have no real purpose other than to give you a better sense of movement.  If these were asteroids that needed to be dodged, or could be used for cat and mouse style fights it would be more interesting. Unfortunately, this requires much more intelligent AI.
  • Add shields and colliding missles – Allow the player to deflect shots by pressing a key or to shoot down approaching missles.  If the player only has a limited amount of energy that is used for either shooting or shielding, this could be interesting.

There were a few more ideas suggested on the forum where I initially posted this.

In the end, I’ve decided to make a fairly large change and switch from realtime combat to a turn based system. My hope is to make the game more RPG-ish where the player has a small squad of ships (the “party”) each of which may have different specializations (“classes”).  I’m going to try a combat system along the lines of Final Fantasy first (not that I have much experience with the game).  Hopefully there will be enough options available to the player at each turn that it will be sufficiently interesting.  In any case, the RPG elements of leveling up your captain and improving your ships’ loadouts should add some extra interest.

Leave a Comment

Space Pirates! – The Gameplan

The Idea

You are the captain of a small space craft. You must head out into the galaxy in search of fame and forture. To this end, you can capture hostile ships, trade goods between planets, and explore uncharted territories. Will you help expand the empire of your own race, or will you be mercenary pirate, plundering any ship foolish enough to cross your path? Something along the lines of Sid Meier’s Pirates, but with space suits and funny looking aliens.

Progress so far

  • Parallax starfield gives nice 3d movement effect
  • Ships move/rotate with proper physics
  • Keyboard controls player ship
  • Ships can shoot lasers
  • Seeker AI that follows player and shoots when close enough

Milestone 0.5 – Basic Combat Test Cases

  • Enemy ships attack, die, and respawn
  • Player can take damage (should respawn after death)

The first step will be to figure out whether combat like this can be fun, or whether I need bigger/more/different ships of some sort. Drawing inspiration from the ship to ship combat in the original Pirates is tricky, since that combat is very slow.  It seems silly to just have big ships sit next to each other and shoot, so we need something a little more interesting.  To start, I am testing small ship dog fights which require a lot more movement. At this point they look cool, but I’m not sure if there is any real strategy or enough fun.

Leave a Comment