Category Archives: lpc

The Liberated Pixel Cup! – Dev Blog 2

It’s been a slow start, but hopefully things will start to move a bit faster. I am on vacation for the week and I have managed to get some work done.

I spent several days trying to figure out the best way to represent Actors on the world maps where the player can walk around. The Actors walk one tile at a time, fitting to the grid, rather than having “free” movement where Actors can move by any increment. It is much easier to implement free movement (which is what I’ve done in the past) than tile movement. I re-wrote the code that handles all of this several times before I found an implementation that was clean and functional enough.

In this screenshot there are several randomly spawned Actors that have walked to random places on the map. They do this by using the A* pathfinding algorithm I talked about in the previous post. There is an Action class that actually performs the walking animation. This Action is smart enough to re-route upon collision with another Actor.

The player can touch/click on a map tile to walk a path to it. For desktop users or certain Android devices, the D-pad can also be used to move the player around on a tile-by-tile basis.

I have also started work on an interaction and dialog system. In the screenshot, the text box shown is a result of the player interacting with the sign on the building. Right now the text box only displays one string of text, multiple strings and maybe even branching dialog paths still need to be done. Item chests are on the to-do list as well. Hopefully I can get them done soon.

From the blog David Thompson » WSU CS by davexunit and used with permission of the author. All other rights reserved by the author.

The Liberated Pixel Cup! – Dev Blog 1

Image

The time is finally upon us. The art portion of the Liberated Pixel Cup has reached its deadline, which means that the programming portion of the contest has begun! The competition is a month long in which us code monkeys need to use the art assets that were generated to make the best possible game that we can. Since this pixel cup is “liberated”, all of the source code will be available under the GPLv3.

I am working with someone that I only through IRC (#liberatedpixelcup on Freenode) with the nickname of fr33mind. We will be making a Pokemon inspired game where you control monsters to use in combat. The actual gameplay details will get fleshed out more as the competition goes forward.

We are using libGDX to make the game. LibGDX is a fantastic Java library that allows us to write a game that runs on the desktop (GNU/Linux, Mac, Windows) and on Android devices with very little platform specific code.

Above is a screenshot of my experiments with libGDX. Here you see a path of ghosts that was generated by my implementation of the A* pathfinding algorithm. It took a long time to wrap my head around it but it is a crucial element to the game considering that users will move across the map not only with arrow keys, but by touching/clicking areas on the map (my Android phone has no D-pad). This makes decent pathfinding a must have so I wanted to try to get it out of the way early. The code performs well on the desktop but for some reason takes about 3 seconds to run on my Android phone, which is a serious problem. My choice of data structures or too much memory allocation could be the problem and I need to investigate who the culprit is. I’m using a PriorityQueue and a HashMap to maintain lists, and a Pool (in libGDX) to minimize memory allocation, yet the problem persists.

I’m going to try to keep this development blog going over the course of the month with screenshot updates. Let’s see if I can manage to actually do that.

UPDATE:
Turns out the performance problem was because of how I was drawing the path on screen and NOT the algorithm itself. I have since abstracted away the things that are dependent upon a specific tile map implementation and have a rather generic set of classes to use for pathfinding.

From the blog David Thompson » WSU CS by davexunit and used with permission of the author. All other rights reserved by the author.