Tagged: gamedev

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.

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.

[This is a crosspost from the Ludum Dare competition blog.  You can download my entry here.]

This was probably the best Ludum Dare weekend I’ve had.  My game was more than just a tech demo or an ‘unfinished’ idea.  Of course, they never are truly complete after 48 hours time; there is always something else that can be tweaked or added.  When all was said and done, however, my entry was a playable game.

Background

The theme was not one that I had put much thought into before it was announced so I really had zero ideas at Go time.  One thing that kept popping into my head was the Kroz series of games by Apogee software back in the late 80’s/early 90’s.  They’re all pretty much the same engine with a new collection of levels, but one was called Caverns of Kroz.  The object of the game is to take your hero through twenty or thirty levels to find or capture some relic.  Along the way you had to run, whip or out-maneuver swarms of monsters and solve puzzles.  I had always thought those games were neat, and it would be interesting to try and ‘recreate’ some of that nostaliga.  Caverns of Kroz didn’t have anything special that made it more caverny than the rest in the series, but I thought I could do better with actual graphics instead of ASCII art.

Kingdom of Kroz

Kingdom of Kroz

20090830_202424867

LoneStranger's Caverns

(more…)

The 13th Ludum Dare 48hr Game Programming competition starts this Friday, so it’s time to get the tools in order so there is less fussing when time is running short.  Also, my wife and I have been invited to Thanksgiving, The Sequel this Friday, so I won’t be home when the topic is announced.  I’ll try to check in to LD.com with my phone so I can at least start planning things out in my head.

So let’s take a look at what I’ll be using… (more…)

The next full fledged LD competition is still months away, but I was thinking the other day about concepts and ideas that I’d like to try.  If the theme is right next time, perhaps I’ll use one of these.

‘tabletop’ wargame – Something along the lines of Axis & Allies.  Simple combat and strategy.  Perhaps even as simple as the old Global War bbs game would be doable in 48 hours.  Global War was troops only, while Axis & Allies has many unit types. 

Economic/Military strategy – Like Nobunaga’s Ambition.  Might have to simplify the combat a lot in order to get it done in 48 hours.  It also would be difficult to balance and tweak the economics.

play by email game – There was a game a few years back where your Kung Fu fighter fought against another person’s Kung Fu fighter.  You would challenge them by sending them an email and then it would play the match, and send the results back to you and the main server.  After awhile you would level up.  It got kinda weird when you had multiple challenges out and leveled up after one of them, but I’m sure there is a way to work around it.

sidescroller – I’ve always sorta wanted to make one of these, but never really got around to trying it.  When I was in 3rd grade, my friends and I used to make video games–on paper–and it would be neat to actually do it.  I think I have one or two of these sheets back at my folks’ house, so next time I’m there I’ll grab them.

Driving game – I think if you break it down to the basics, and stick to simple features, you could do a driving game.  Wouldn’t want to overdo the physics.  I’m thinking a lot more like Outrun than Gran Turismo.

Sports – It would be neat to come up with some kind of new sports game that could be simple enough for a 48 hour compo… and also fun.  Combine two sports or come up with a new one. 

Any types of games you’d like to prototype if you had a chance and a compatible theme?

It’s time again.  Seems like just a short bit ago I was working on LD48 #11, and maybe it was.  The contests are on a much better schedule now which should help in participation. 

I’ve been keeping myself busy working on a reborn and re-imagined project from back in ’03.  I’ll probably release more info on that when I have something good to show off.  If we get a compatible theme, perhaps some of the work on LD48_12 can be reassigned afterward to my other project.  Honestly, working on that project the past week has kept my skills and mind frame in the perfect place for the LD48.

Last time around I had to take time out from the alotted 48 hours to attend a baseball game.  I won’t have that problem this year, though I am in the mood for a good egg and bacon breakfast at a local joint Saturday morning.  I hope to remember to take a picture of that for the food compo.

This time around isn’t going to be much different than last time.  I’m going to use mostly the same tools as before:

  • Java 6 SDK
  • Eclipse 3.3.2 IDE
  • Photoshop CS2
  • HP OfficeJet 6450 All-In-One for scanning doodles
  • No Fear Energy Drink (Go Boris Said #60!)
  • Everlasting Gobstoppers
  • mIRC for chattery
  • Killer Game Programming in Java and the base code I used from last compo.

The only thing we need now is a theme!

Good luck, and see you in 1 day, 9 hours and 48 minutes!

BlockOut v0.LD48_11 (4/20/08)I managed to cobble together a mildly playable version of my game in time for the end of the Ludum Dare 48 Game Development  competition this weekend. 

It’s a concept that I had been toying with this past week, jotting down some ideas and refining it along the way.  Quite simply, it’e the game Breakout, only with a twist.  In regular Breakout, you move the paddle back and forth on the bottom to keep the ball from falling off the screen.  At the same time, you are trying to use the ball to destroy all the bricks on the screen.  In my game the computer plays the part of the paddle and you instead try to defend a goal at the top of the screen by placing bricks. 

It’s a neat idea, but I by no means was able to implement all my ideas.  The number one thing that was lacking is multiple types of bricks.  This version only has two: normal and 2X Hit.  As you can probably guess, normal takes one hit to be destroyed and 2X Hit takes two.  I wanted to add more bricks that did weird and interesting things when the ball hit it, like explode or eat it. 

You build your wall of bricks by buying them from money you’ve earned while playing.  So far, the only two ways you can earn money is to play, where you get one credit every so many seconds, or when the computer misses the ball with the paddle and it goes off the bottom of the screen.  Eventually you’ll be able to get money by doing other things.

One thing that doesn’t seem to work very well is the collision.  The ball seems to react well when it hits the top or the bottom of the bricks, but if it hits the side of two bricks, it can sometimes bounce in a way that causes it to go ‘inside’ the wall.  I have a few ideas on fixing that but I didn’t have enough time to implement them.

The AI could be improved, letting it think ahead instead of having it just react to the current position of the ball.  If I project the location it will be at when it gets to the bottom, I could have the paddle waiting for it.

There are no skill levels implemented.  Smarter AI, less money and multiple bouncing balls would make it more challenging and could be set to differing degrees.

I also didn’t do any sounds for it, as the compo requires that all resources be generated within the 48 hours and my recording soundcard is not quite working.  I will create some for the post-compo version of the game.  Same for music.

I tested it on the Sun JVM 1.6.0, though it should work on on JVM 1.5.0.  It will not work on the JVM 1.4.2, as it requires System.nanoTime() that was introduced in JVM 1.5.0.

I programmed it in Eclipse 3.3.2, and used Photoshop for the graphics.

You can download the game here or the source code here.

[update: changed the above link to the .zip file.  The jar just wasn’t handling some class-pathing stuff well and I don’t have time to troubleshoot it right now.]