Category: dev

I had originally planned on collaborating with a friend on the Ludum Dare 26 Jam, however, plans started to fall apart Friday morning when my sister went into labor. Long story short, the baby was born later that evening, and along with other family commitments, took up most of the weekend.

On Sunday I was finally able to sit down and start working on something. My mind kept going back to some sample code I had given a FlashPunk user in Afternet’s #flashpunkers earlier in the week. He was asking for pointers on a drag mechanic and I was able to offer a little help. This sample code was still sitting in my initial basecode project in FlashDevelop and I just started going with the seeds of a simple idea.

I wanted a game where the player had to think fast, but didn’t have multiple types of actions to perform. The Drag mechanic is simple, and everyone who uses computers should be familiar with it. I also didn’t want to have to explain the rules to the player. I wanted them to be able to discover the rules with visual and audible hints. I decided that simply moving objects into a target would be adequate to satisfy those two pieces.

1367290572442

So I worked on Sunday night and before long had the basic functionality down. There were some overlap issues that I had to figure out due to me forgetting that I was centering the origin, but that was probably the only thing that was a pain. After more work on Monday night, it was ready to turn in. I ended up with a progression of levels that started simple and ended up fairly frantic. I knew I was going to be dinged by some voters if I completely avoided instructions, so I put a little blurb on the webpage about discovering it as well as adding a hint to the end game screen if you didn’t make it past the first level or the first level with multiple colored targets. I hoped this would be enough to keep people from being frustrated or downvoting me because they couldn’t understand it.

(I have to say that with the Minimalism theme it is hard to balance the polish. I decided that not only is my gameplay going to stick with one basic action, but the graphics would be minimalism with simple shapes. However, I know someone is going to downgrade the graphics because there are so many more entries that are fantastic graphically. Should they be voted higher because it looks better? Or should the simple graphics games be voted higher because they are following the theme? I don’t know, there are many entries where I can’t for the life of me figure out what is being interpreted as minimal but will probably score high because they are good.)

Here is a video of myself playing the game. Reviewers have apparently done a good job scoring higher.

I think the fact I kept the gameplay simple but had something challenging and fun was great. I was focused on that without having to prepare and test other mechanics. The progression of difficulty was simple and changed things around while still keeping that simple dragging mechanic.

I would have liked a high-score option that reported to my webpage or Twitter, or at the very least kept your own personal high score offline. I didn’t get a chance to do that before the time limit. I also had to skip the sound/music toggle which would have been a nice polite addition.

I had the same thought that showed up in many LD comments: It would be fun on mobile. I would like to explore this. I think I’d have to change the underlying code for handling the dragging to support two at a time, because I know that would be intuitive on a device.

Check it out here.

Earlier this month I submitted my “finished” One Game A Month entry for February, Shooting Gallery. It’s a simple game where you use the mouse to aim the reticle over the targets and fire on them. The object is to destroy them/get the most points before time runs out.

The idea behind the shooting game is that I can use what I’ve accomplished and learned here in another game idea later on in the year. I’m not completely satisfied with what I have, so I will have to reevaluate what I have when the time comes.

You can find it here.

For February, I am doing a simple shooting gallery game, similar to the ones you can find in carnivals and arcades. I am a lot further behind than I expected to be at this point in the month. I was hoping to be pretty much done with the basics and have a game ready to go, even if it looked crude. That would give me the rest of the month to do the polish and artwork.

Shooting Gallery, no frills.

Shooting Gallery, no frills.

 

As it is now, I am close to having an unpolished game, but not quite. I still need to finish the game wrapper, including the main menu and the endgame stipulations. Most of my time was spend getting the pseudo-3D implemented correctly (with a slight linear algebra refresher) and nail down some design restrictions. I have to balance what I need now, for February, and what I want to have it do for the other game that will eventually grow over this one.

One of the problems is that FlashPunk is a 2D framework, while I need to think in 3D for a few things. I may end up having to write my own moveTowards and such if I have entities move in three dimensions. I’m still figuring out how I will implement special entities–I have a factory, but it might just be a helper class. Still trying to put the pieces together in my head. I am realizing that some of the functionality I want would be better suited with a scripting language of some sort, but that is beyond a two-week deadline, I think.

Anyhow, the plan is to build a couple of hard-coded galleries and package this thing up to go, hopefully a few days early, and begin to think about March.

Now that I have released January’s game to the wild, it is time to begin thinking about my next game. As the month went on, I decided that I did not want to finish my LD48 #24 game from last August where the theme was evolution. I like the game, and I made a lot of neat additions to it, but I think in the end it’s just not going to be fun for very long. The aliens had a bunch of different traits and as you killed them the ones that were most successful in surviving and damaging your ship had their traits passed on to the next round. The problem is that there isn’t much strategy with the player. They click and shoot. Click and shoot. Eventually the aliens would become harder but the strategy remains the same. However, if there were multiple different approaches the player could use to defeat the aliens, they would be forced to try something new as the difficulty ramped up until they found something that worked better. This, in turn, would cause a different set of traits to bubble up to the top and start the difficulty increasing again. The way that game is now, it would need some major remodeling and a rethink of one of the basic rules I had when I started, a static firing location. It makes more sense to start over, and I am not ready for that.

I worked throughout the month on LS-MAN bouncing around to each of the different aspects of development. Coding of many features, but also graphics, sound and UI. This meant that the game grew in many different directions, at roughly the same time. On one hand, when I got bored I just changed gears. On the other hand, it took me until week three to really have a playable game. I have read #1GAM father Crister Kaitila’s ‘McFunkypants Method‘ and think that for February I will try to follow them. The one I want to attempt primarily is to get a simple working game completed in the first week using only placeholders for art and sound. This would mean that I have the rest of the month to add all the cool features and polish.

One of the other tips is the “save points” where you have what you could consider a deliverable. The first deliverable is the working game with placeholders. Not overly exciting, but it’s a game. As you add features you’ll come up with other save points. These make for great moments to tuck the game away in a safe place. Should everything crash and burn, you’ll have something to fall back upon.

I have an idea for a game to be completed later this year, but it is probably too much work for one month. I was trying to figure out how to break it into pieces and realized that I could implement one aspect of the game now as it’s own stand-alone game and use this module later when I work on the game with the bigger picture. February is also a short month, so something with less work would be a plus.

hunter

My drawing of Glob, top right, and Glub, bottom left. All the rest is my son drawing his own versions. Also, people with big feet.

One part of may January game that I really enjoyed was showing my four and a half year old son my progress. He would constantly want to see the game run and watch the creatures explore the maze while LS-MAN gulped the pellets. I drew some concept art for the creatures; he looked at them and did his own versions. It was easier to get him ready for school on days when I had something new to show him, like a newly animated creature or pellets. I thought it might be neat to make something that he could play, so for this month’s game I will likely be making a shooting gallery, not unlike those found in older arcades, carnivals and boardwalks. He’s really good with intuitive touchscreen UI, but this is the desktop so simple point and click with the mouse would be a great introduction. This would then become one aspect of a future game.

First stop, however, is to set up source control that I lost when I upgraded machines. I also want to yank out some of the utility classes that I have created over the past couple years into their own library so I can continue to add to it as the year goes on. I just updated FlashDevelop from 4.0.2 RC2 to 4.2.4 and so far so good!

The game started as an entry to the Ludum Dare competition over a month ago with the theme “You Are The Villain.” I completed a reverse-Pacman game where you controlled the ghosts in order to trap Pacman and keep him from gobbling up your pellets. There was very little AI in it. I have a couple pathfinding classes that it uses to pick the path from the ghost to the player’s cursor, so most of my time had gone into creating the pathfollowing code and trying to get that correct.

For One Game A Month, I continued to work on it. I revamped the graphics so I would not get into intellectual property trouble should I chose to sell it and renamed it LS-MAN. I refactored many parts related to the size of the cells and gameboard, rewrote the pathfollowing code, implemented a potential field to use for AI, surrounded the game with a main menu and end conditions, and generally tried to add polish.

I did a lot of this all at the same time, which was nice because I could do something else if I got bored. Unfortunately, it also made it take longer to get a playable game since I was putting things in that weren’t necessary for the minimum threshold where you can call it a game.

What Went Right

The pathfinding was a class that came from Untold Entertainment. I had used it before in some unreleased side project and it worked well, so I grabbed it again for this. It was easy to drop in and modify for my needs. There is a Node class that contains a lot of the implementation specific stuff. I ended up using the Nodes to hold most of my data for the map.

For the invader’s AI, I learned about potential fields from AIGameDev.com. It’s a method used in real-time-strategy where the goals and threats have positive and negative effect, respectively, and those values are radiated outward. This was a very CPU intensive step. I was using the Nodes from the pathfinding to hold the potential data and it was something that needed to be recreated often. If not, LS-MAN would be using stale data to decide his path and make a wrong move. It didn’t run too bad in Release mode, but the delay was noticeable every second or so and any delay would be unacceptable. There ended up being two solutions for this and they go hand in hand.

The first fix was to change how the pathfinding algorithm went about finding the nearby nodes. The pathfinding connected node function searched every node in the grid to see if it fit the requirement of being one away either horizontally or vertically. Regardless, pathfinding is really fast but we also know it’s not searching very many nodes in most cases to find a path, so this excessive connected node function wasn’t a huge deal.  However, the potential field calculation searches _every_ node which means every node’s neighbors are requested. And since there are multiple sources of the field, certain nodes could be recalculated and set multiple times. This was just not going to work.  I had made changes to the connected node function to enable the wrapping off the edge of the screen, so I felt that searching every single node to see if it was connected was not really that bad as long as we didn’t have to do it a lot. We do have an advantage–once loaded, the map doesn’t change. Therefore we could actually do the (relatively) slow calculation at map load time and store the result on the Node object. Now whenever potential field calculation or pathfinding needed to know what was nearby, it was returned quickly. This reduced the number of CPU cycles per frame a huge amount, but we still had a delay every few frames as it waited for the field calculation to complete.

The second solution was to refactor the potential field calculation so that it wasn’t doing it all at once. Since the default algorithm has you storing the to-be-calculated nodes in a queue, it was easy to add a state machine to it and iterate through that queue over multiple frames. Whereas before it was looping until the queue was over, my implementation would now also quit the loop if a certain amount of time had passed. In my case, it would only do up to 5ms per frame and then stop, letting the rest of the game continue, and pick up where it left off the next turn. Once it completed a batch, the old values were replaced by the new values, and the cycle started over again. Now when LS-MAN reached an intersection, he would look at the potential field values for each path and take the one with the highest value. This would lead him to pellets and away from the creatures trying to get him.

1359781263750

Debug mode screenshot showing the positive potential field of the pellets and the negative field given off by the creatures. Blue is a positive field, red is a negative field. Black is nothing. Upper left corner of each node is the actual value.

Super pellets were a different matter. In order to give LS-MAN some kind of above-minimal survival instinct, I had the pellets give off a large positive potential when LS-MAN was within a certain distance of a creature. This results in the appearance of him seeking a pellet when he knows he’s being actively chased. In order to keep the pellets around longer, I actually have them give off a negative field which should dissuade LS-MAN from choosing that path when no creatures are around and instead have him continue eating regular pellets.

In my original LD48 implementation, people said it was hard to select the ghosts. I took that critique and added keypresses that would select individual creatures, as well as adding buttons to the screen. If I eventually port to a touchscreen format, these buttons would be perfect.

I used OGMOv2 to create the levels. I really enjoy being able to rapidly create even though I only had two for the released game.

What Went Wrong

Not really wrong per-se, but it would have been nice to have had a working game earlier. I did spend the middle of the month focusing mostly on pathfollowing, even rewriting the code at one point, but I also spent a long time tracking down bugs that the game ended up ‘shipping’ with anyway. I should have noted that they were not show-stoppers much earlier and went on to finish aspects that would make it that much closer to a game.

I’m not really happy with the scoring. I knew time and the number of pellets should be the gauge, but I never had time to come up with a score based on those two values.

As time went on the code became more difficult to manage. I think it was because the board was lumped in with the main world code. They are tightly connected, which is fine, but I think pulling out the board stuff into it’s own class would have kept the code neater and probably easier to navigate.

I gave each creature different levels of ability to give them somewhat of a personality, but I’m not really happy with the level of balance. I never really got any external playtesting so I don’t know how they feel for everyone else.

Looking Forward

I would love to add high scores and new levels at some point. If I end up writing the server code to store scores, I would certainly add something that reports back.

Bonus Reading

Long after the point of no return I found this gem of a post at GameInternals.com. Since the goal of LS-MAN is different from traditional Pacman, the AI didn’t carry over much, if any, however I if I had seen it earlier I might have picked up the method of board construction and makeup for my own instead of using a static grid size for everything. I recommend reading, especially if you like simple implementations that result in the appearance of a more complicated intelligence.

LS-MAN_go_gr

It’s not perfect, and there certainly are bugs to be found (especially with the path-following code) but it’s well-done enough for me to call it a finished game. It’s a game with a beginning, a middle and an end. I think this is a great success.

1359762968716

Screenshot of the Classic level of LS-MAN.

LS-MAN is a reverse-Pacman game where you control the creatures in the maze and attempt to stop the invader from stealing all the treasure pellets. The object is to do in as fast a time with the least amount of pellets eaten as possible. You control the creatures with the mouse and can select them by either clicking directly on them, on their button or hitting keys 1 through 4 on the keyboard. Then you use the mouse to select their destination. The creatures all have different personalities, and as such, have different levels of focus and attention span, as well as speed of travel. You will notice that some of them will ignore further commands for a short time after being given a command, and also at some point forget where they were going and return to roaming the maze. When LS-MAN eats a special super pellet, he becomes Super LS-MAN and can, for a limited duration, neutralize your creatures and remove them from the maze. Be careful when directing a creature to the player near a super pellet.

Go check out my January game, LS-MAN!

I am signed up for the One Game A Month challenge. The goal is to create 12 games, one a month, for the entirety of 2013. I know I will never be able to do that, but my goal is something that I think I can do: finish three games. The plan is to finish the last two Ludum Dare entries, from compos 24 (Evolution) and 25 (You Are The Villain). The first is my space shooter with the working name ‘Those Stupid Aliens.’ I will probably have to change the name, as I am reminded often by my four year old that ‘stupid’ is a bad word. The other is my reverse Pacman entry where you control the ghosts to trap the invader from stealing your pellets. The third game… well, I’ll reveal that later on if things work out well with the first two.

I will tackle LS-MAN first, as that code is the most familiar to me at this point. If I’m lucky, I’ll be able to get it done before the end of the month and get a head start on the other for February.

My Ludum Dare Jam entry is Those Stupid Aliens. It’s a top-down space shooter.

The player is firing from a capital ship at the bottom of the screen. It has just gone through a battle, defeating the enemy battleship, stranding hundreds of aliens. As a result of the battle, it only has enough shields to withstand five hits. Your technicians are routing power and fixing subsystems, but they are tired. When you defeat a wave of enemies, it builds up the morale of the crew and they repair one point worth of shield. And that brings us to Those Stupid Aliens, and your job, as one of the last remaining gunners.

Using the mouse to guide the targeting reticule, and the left mouse button to fire, your goal is to shoot the alien ships that appear. They will show up in groups and express different characteristics based on the makeup of their internal properties. As the game goes on, the successful aliens will have their internal properties inserted into the gene pool, and the next waves will be created from this information. Eventually, you should see ‘smarter’ aliens which are more difficult to defeat.

 

(more…)

The latest in the Ludum Dare 48 Hour competitions is less than a week away! Time to get out that base code and wait, right?

WRONG! There is so much for you to get ready and practice. You could be doing any of these:

  • Draw some sprites for a random animation, either directly in a bitmap editor or on paper and scan them.
  • Polish that basecode to fix that thing you found last compo that really bugged you.
  • Install GIMP or Audacity or other development related application and practice how to use it.
  • Pull out your microphone and record yourself and other sounds around the house to create a song in Audacity.
  • Create a Towlr.
  • Think of witty motivational posters.
  • Rip CDs to MP3s and create a great 48hr in-the-zone coding playlist.
  • Stock up on food for the weekend.
  • Clean and organize your desk.
  • If you are feeling adventurous, take your first steps with that new language.
  • Vote!
  • Spend some quality time with the family so they know you still love them when you ignore them over the weekend.

Whatever you do, please share it with us on Ludum Dare! And also, no matter how much or what it is that you do, you’re a winner in this pre-compo competition!

Of course, none of these things will actually be used in the LD competition since that is against the rules (except the basecode) however they can’t keep you from using the skills you just learned!

Like a broken record, my Java basecode for the Ludum Dare 48 Hour Game Programming Competition #16 is largely the same as the past two three four five competitions. I haven’t made any changes to it since the last compo, despite saying that I wanted to. Recently I have been dabbling with C++ again, though I don’t feel that I’d manage very well using it in a compo at this time.

Download it here.

Goals are pretty much repeating what I said last time:

  • Keep the same art style as last time.  I sketched things out on paper and scanned them in so I could colorize.  Keeping with bold colors and gradients is probably what I’ll do.
  • KISS – Keep It Simple, Stupid!  Making something too complex is just a recipe for a headache at 1pm on Sunday afternoon.
  • Make useful additions to the basecode that can be used in later competitions.  The screenshot stuff is an example of something I did previously that helps out a lot.
  • Finish most of the work by Saturday night so I can spend Sunday polishing.
  • Don’t run into dumb problems that eat up eight hours.

Tools in use:

  • Java 6 SDK (though last time I included a version for JDK 5)
  • Eclipse IDE
  • Photoshop, maybe some Illustrator
  • DrPetter’s sfxr for sound effects
  • Audition, if I can get it to play well with my sound card
  • HP OfficeJet 6450 All-In-One for scanning doodles
  • No Fear Energy Drink Sugar Free (Hopefully Boris Said and Carter Racing will run some Sprint Cup this year)
  • Everlasting Gobstoppers
  • mIRC for chattery
  • Killer Game Programming in Java and the base code I mentioned above.

Can’t wait to see what the theme is.  Hope it’s a fun one!