Archive for August, 2011


August 14th, 2011 No comments

So after approximately 3 weeks I finished Pac-Man with a fairly relaxed programming schedule. It comes with its fair share of bugs but overall it works well. It doesn’t include features such as fruit and other little features but the core components work. You can eat dots, you can be eaten, you can eat ghosts, ghosts chase you etc. There’s even a nice little easy way to add new levels although you’re likely to break it if it isn’t done right. If you decide to get adventurous and modify or add new levels using the format shown in the example 3 levels be sure to delete the accompanying _nodes.txt file so it’s rebuilt. Unfortunately I didn’t really get up to doing this automatically. The source is included for those that are interested. The game uses a modified framework of SFML that’s specifically designed for my Uni’s purposes so there are a few functions in the program that you may not be familiar with if you do decide to sift through the code. Anyway, that’s it, enjoy.


Categories: Me, Programming Tags:


August 10th, 2011 No comments

Categories: Me, Programming Tags:


August 5th, 2011 No comments

Now that my Pac-man assessment is due next week (as well as a whole lot of other assessment over the next two weeks) I’m starting to focus more and more on finishing Pac-man. It’s definitely getting there, with the only hard part here being to get the ghosts that I’ve added to follow the paths. After spending a solid 4 hours fixing Ghost #3 from mysteriously crashing the game using a cheap workaround, I got most of it working. The only problem that remains is that ghosts are having some serious issues getting stuck in corner. Hopefully I can get this sorted out within a week while also completing some UML diagrams for another subject.

Categories: Me, Programming Tags:

Expanding on Pathfinding

August 1st, 2011 No comments

With just under two weeks left to finish Pacman, I’m spending a bit more time on the game itself. Right now I actually have most of it done, including probably the most complex component which is the path finding. What I did today, besides getting collision detection and movement for the player as Pacman working, was making some changes to pathfinding.

There are four ghosts (not yet done), each that have their own individual route to the player. As the operation is fairly expensive, it’s calculated every two seconds. You can see in the picture that the red and yellow line meet somewhat behind the Pac-Man character, which was during a two second interval.

There are four coloured lines; red, white, yellow and green. While white is not actually visible in the above picture, it was drawn over by the red line, following the same path. The original game featured somewhat more intelligent AI, but for assessment purposes creating an illusion of intelligence is sufficient, which I’m doing here.

The method of this isn’t exactly the most efficient, as I’m simply checking which of the four paths it is each time I calculate, and depending on this path I disable every 10th, 25th or 30th node so that an alternative route is calculated, while still keeping the route relatively short.

My next task will be to add the ghosts and have them chasing a vector of positions that form a path. Then eventually when everything is working alright, I’ll make power pills do something more useful, maybe a cherry and some fancy 8-bit sounds.

One thing I’m worried about with pathfinding is that when the player transitions from the left or right side of the screen to the other end, which might confuse the ghosts into taking the long way around. Either way I don’t believe this is something I’m being marked on anyway.

Categories: Me, Programming Tags: , , , ,