You are not logged in.

#1 2008-11-21 22:42:55

schuay
Package Maintainer (PM)
From: Austria
Registered: 2008-08-19
Posts: 564

sdl pacman clone

while learning c++ i started writing this little game - first using allegro, then a rewrite with directx, now a quick and dirty port to linux using sdl.

* pacman clone
* skinable
* level editor included

pacman usage:

commandline arguments
--help:         show this message
--level <lvl>:  start with selected level
--skin <skin>:  start with selected skin
--editor <lvl>: start in editor mode.
                if a levelname is given the editor loads and saves to that level

ingame
esc/q:  quit
arrows: movement
space:  boost
p:      toggle pause
n:      new game
l:      switch level
s:      switch skin
e:      enter editor
w:      (in editor) save map
f:      toggle fps display
h:      view highscore

the game is in a playable state - but there is tons of room for improvement und it's not exactly userfriendly smile
an editor is included but it suffered alot during the transition from having a menubar in windows to not having a menubar in linux (couldn't find a good way to do this using sdl)

the most urgent issues would be
* improve performance on lowend pcs
* compile this for windows ( and iphone and android and windows mobile and make tons of cash smile )
* making the paths to image/config/sound files err.. a little less sensitive (atm you will get a segmentation fault if you don't start the game from the pacman root dir).. this should be very simple.
* make the level editor easier to use .. at the moment it's a pain

install:

* this is now available as a PKG called pacman_sdl in the AUR, see below for link

200811212328212960x1050if3.th.png

AUR:
http://aur.archlinux.org/packages.php?ID=28014

github:
http://github.com/schuay/pacman/tree/master
git://github.com/schuay/pacman.git

windows version:
http://github.com/schuay/pacman/downloads


if anybody likes the game, great. if somebody improves on it, awesome. if nobody cares, no harm done smile

Last edited by schuay (2009-07-19 20:31:54)

Offline

#2 2008-11-21 23:10:28

creslin
Member
Registered: 2008-10-04
Posts: 241

Re: sdl pacman clone

just tried this out.. nice job wink


ARCH|awesome3.0 powered by Pentium M 750 | 512MB DDR2-533 | Radeon X300 M
The journey is the reward.

Offline

#3 2008-11-22 00:25:07

pyther
Member
Registered: 2008-01-21
Posts: 1,395
Website

Re: sdl pacman clone

How could I go about compiling this on x86_64?


Website - Blog - arch-home
Arch User since March 2005

Offline

#4 2008-11-22 03:04:04

Ranguvar
Member
Registered: 2008-08-12
Posts: 2,549

Re: sdl pacman clone

+1 to above. Your binary is 32-bit, and there's no Makefile in sight? I see a CodeBlocks workspace file, but without CodeBlocks?

Last edited by Ranguvar (2008-11-22 03:05:22)

Offline

#5 2008-11-22 09:41:03

schuay
Package Maintainer (PM)
From: Austria
Registered: 2008-08-19
Posts: 564

Re: sdl pacman clone

edit: makefile + pkgbuild are now included in the first post

here you go.. hope it works for you, first time writing a makefile smile

CC=g++
SOURCES=Settings.cpp Pacman.cpp Main.cpp Log.cpp hScore.cpp Ghost.cpp Game.cpp Error.cpp BckgrObj.cpp BHeap.cpp App.cpp
OBJECTS=Settings.o Pacman.o Main.o Log.o hScore.o Ghost.o Game.o Error.o BckgrObj.o BHeap.o App.o
LIBS=-lSDL_ttf -lSDL_gfx
EXECUTABLE=pacman_v4

all: 
    $(CC) -c `sdl-config --cflags` $(SOURCES) 
    $(CC) `sdl-config --libs` $(LIBS)  $(OBJECTS) -o $(EXECUTABLE)

clean:
    rm -f $(OBJECTS)
    
uninstall:
    rm -f $(EXECUTABLE)

Last edited by schuay (2008-11-22 11:23:45)

Offline

#6 2008-11-22 12:19:25

xen
Member
Registered: 2008-08-17
Posts: 56

Re: sdl pacman clone

Nice work with this, maybe you should host it on a GitHub account so people can fork smile


A wannabe game-developer.
My Blog
My GitHub

Offline

#7 2008-11-23 09:45:09

schuay
Package Maintainer (PM)
From: Austria
Registered: 2008-08-19
Posts: 564

Re: sdl pacman clone

xen wrote:

Nice work with this, maybe you should host it on a GitHub account so people can fork smile

Done! The link is in the first post.

Offline

#8 2008-11-23 10:09:32

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,914
Website

Re: sdl pacman clone

omg.. i thought "huh? sdl package management?"


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

#9 2009-07-05 09:44:42

schuay
Package Maintainer (PM)
From: Austria
Registered: 2008-08-19
Posts: 564

Re: sdl pacman clone

Added to AUR at http://aur.archlinux.org/packages.php?ID=28014

Might do some more work on this soon!

( Sorry for bumping my old post smile )

Edit: Enabled sound and fixed transparency issues.

Last edited by schuay (2009-07-05 15:29:36)

Offline

#10 2009-07-10 22:30:27

Hohoho
Member
Registered: 2007-06-23
Posts: 222

Re: sdl pacman clone

Hey, nice game.
I'm writing something similar in SDL and was wondering how you did the AI for the ghosts, what kind of algorithm did you use?

Offline

#11 2009-07-11 13:00:55

djszapi
Member
From: Cambridge, United Kingdom
Registered: 2009-06-14
Posts: 1,439
Website

Re: sdl pacman clone

+1

It's really nice new revision of well-known old games, and much faster than the 3d version of it.

Thank you for everything!

Offline

#12 2009-07-11 13:28:59

schuay
Package Maintainer (PM)
From: Austria
Registered: 2008-08-19
Posts: 564

Re: sdl pacman clone

I'm glad you liked it, thanks for trying it out smile

Hohoho wrote:

I'm writing something similar in SDL and was wondering how you did the AI for the ghosts, what kind of algorithm did you use?

I wrote most of this a loong time ago and I can't remember most of the implementation details. But the source code is available here: http://github.com/schuay/pacman/tree/master
The AI is contained in Ghost.cpp, take a look at the pathCalcNormal, pathCalcVuln, and pathCalcDead functions.

Edit:
It's pretty primitive actually. During the loop, a specific location is set as the target for the ghosts. 2 of them are set to pacmans current location, the other 2 to pacmans next intersection.
Every time a ghost reaches an intersection, it has a certain chance of NOT choosing the fastest way to its target location. This chance goes down the closer it is to its target, so once a ghost is hot on your tail, there's a good possibility that it will keep chasing you instead of wandering off. Pathfinding is done with a bheap, the logic for that is partly in Ghost.cpp and the implementation of the bheap itself is in BHeap.cpp.

Last edited by schuay (2009-07-11 13:35:16)

Offline

Board footer

Powered by FluxBB