Recent

Author Topic: Pac-Mac: a clone of the original game  (Read 4710 times)

Lulu

  • Sr. Member
  • ****
  • Posts: 405
Pac-Mac: a clone of the original game
« on: January 27, 2026, 09:13:48 pm »
Hi, I'm happy to share a version of this famous game.

You can download the code on https://github.com/Lulu04/PacMan , there is some instructions to install the needed packages: LazopenGLContext, BGRABitmap, OGLCScene and ALSound.

I found this excellent article https://pacman.holenet.info/#Chapter_2 that describes all the mechanics of the game. I tried to stay true to it. However, I did add a difficulty setting.

Use the keyboard to play the game, the keys can be changed in the options panel.

Enjoy!

Known bugs:
- When PacMac eat a ghost, its direction change to the left. I've never been able to find that bug...
- When player lose a life, sometime Blinky start to move before all other sprites.

Edit: Fred vS made a version with his UOS audio library. You can found here: https://github.com/fredvs/PacMan
« Last Edit: February 04, 2026, 01:08:59 pm by Lulu »
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

TBMan

  • Sr. Member
  • ****
  • Posts: 352
Re: Pac-Mac: a clone of the original game
« Reply #1 on: January 27, 2026, 10:30:04 pm »
Nice job! I did a version also using PTCGraph a while ago.  I like your game map better!

https://www.youtube.com/watch?v=U2J6iPwgX8o
Barry

Newest game (clone),
Missile Commander:
https://www.youtube.com/watch?v=tgKz0cxog-k

Roland57

  • Hero Member
  • *****
  • Posts: 604
    • msegui.net
Re: Pac-Mac: a clone of the original game
« Reply #2 on: January 27, 2026, 10:47:11 pm »
Compilation successful under Linux. But when I start the game, I have a message in a window, saying that pacman.cfg doesn't exist. I am forced to click on Abort, and the program ends.
My projects are on Codeberg.

fcu

  • Full Member
  • ***
  • Posts: 127
Re: Pac-Mac: a clone of the original game
« Reply #3 on: January 28, 2026, 10:20:27 am »
got error ( win32 ) :
---------------------------
Pacman: Pacman.exe - System Error
---------------------------
The program can't start because libmcfgthread-1.dll is missing from your computer. Try reinstalling the program to fix this problem.

i think its better to build soft_oal.dll with ( -static ) to avoid dll's dependency

Lulu

  • Sr. Member
  • ****
  • Posts: 405
Re: Pac-Mac: a clone of the original game
« Reply #4 on: January 28, 2026, 11:17:52 am »
@TBMan: thank you, your version is nice also.

@Rolands57: I forget to check if the config file exists before loading it... I've just commited a fix to the repository. Normally this exception will not occur any more. Thank you for the feedback!
(the config file is used to keep track of the keys and highscore)

@fcu: I'm not a guru for compiling C code... I will try to recompile the DLL on my old Windows7 32b machine. Thank you for reporting this error.
« Last Edit: January 28, 2026, 11:38:26 am by Lulu »
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

Roland57

  • Hero Member
  • *****
  • Posts: 604
    • msegui.net
Re: Pac-Mac: a clone of the original game
« Reply #5 on: January 28, 2026, 11:44:13 am »
I forget to check if the config file exists before loading it... I've just commited a fix to the repository. Normally this exception will not occur any more. Thank you for the feedback!

Yes, it works now. Thank you for the fix. But the window is very small. Is it the normal size?
My projects are on Codeberg.

Lulu

  • Sr. Member
  • ****
  • Posts: 405
Re: Pac-Mac: a clone of the original game
« Reply #6 on: January 28, 2026, 12:03:21 pm »
I forget to check if the config file exists before loading it... I've just commited a fix to the repository. Normally this exception will not occur any more. Thank you for the feedback!

Yes, it works now. Thank you for the fix. But the window is very small. Is it the normal size?
No it's smaller than normal. It's curious, I tried the game on a VM Ubuntu 20.04 and the window is maximized.
Please, in folder Units, open the file 'project_config.cfg' and comment/uncomment the lines as follow:
Code: Pascal  [Select][+][-]
  1. {$define MAXIMIZE_SCENE_ON_MONITOR}
  2. //{$define WINDOWED_MODE}  
and recompile the project. This remove the windowed mode and force the fullscreen mode. May be this will work.
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

Roland57

  • Hero Member
  • *****
  • Posts: 604
    • msegui.net
Re: Pac-Mac: a clone of the original game
« Reply #7 on: January 28, 2026, 07:35:39 pm »
This remove the windowed mode and force the fullscreen mode. May be this will work.

Yes, it works. Thank you.

Now I have another problem (sorry): nothing happens when I press keyboard arrows to change Pac-Man direction. Even when I try to redefine commands (in Options window), nothing happens when I press a key.
« Last Edit: January 28, 2026, 09:03:18 pm by Roland57 »
My projects are on Codeberg.

Lulu

  • Sr. Member
  • ****
  • Posts: 405
Re: Pac-Mac: a clone of the original game
« Reply #8 on: January 28, 2026, 08:10:05 pm »
got error ( win32 ) :
---------------------------
Pacman: Pacman.exe - System Error
---------------------------
The program can't start because libmcfgthread-1.dll is missing from your computer. Try reinstalling the program to fix this problem.

i think its better to build soft_oal.dll with ( -static ) to avoid dll's dependency
hi fcu,
I've replaced the dll by the new one downloaded from the OpenAL-Soft repository. I've checked the dependencies, and the one that cause a problem don't exists in this build. I've updated PacMan project, please download the current version, it should normally work.
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

Lulu

  • Sr. Member
  • ****
  • Posts: 405
Re: Pac-Mac: a clone of the original game
« Reply #9 on: January 28, 2026, 08:20:25 pm »
This remove the windowed mode and force the fullscreen mode. May be this will work.
*

Yes, it works. Thank you.

Now I have another problem (sorry): nothing happens when I press keyboard arrows to change Pac-Man direction. Even when I try to redefine commands (in Options window), nothing happens when I press a key.
I'm the one who's sorry for all the problems you're having with the game!
In unit form_main, open the object inspector (F11), at the top select 'FormMain: TFormMain' and check the Key Preview property. I don't know why the check is gone...
This time it should be fine. (I hope  :D)
Thank you for your patience :)
« Last Edit: January 28, 2026, 08:23:36 pm by Lulu »
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

Lulu

  • Sr. Member
  • ****
  • Posts: 405
Re: Pac-Mac: a clone of the original game
« Reply #10 on: January 28, 2026, 08:39:33 pm »
I've checked... the keyPreview check was never checked... :-[
But curiously, on Windows the keyboard event are still intercepted by the form. That's why I didn't have this bug on my Windows 10 machine.
The check is now definitely checked!
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

Roland57

  • Hero Member
  • *****
  • Posts: 604
    • msegui.net
Re: Pac-Mac: a clone of the original game
« Reply #11 on: January 29, 2026, 02:13:20 pm »
Thank you for your patience :)

You are welcome.

It works now, excepted sound. Even after I copied the SO files in executable's directory.
My projects are on Codeberg.

Fred vS

  • Hero Member
  • *****
  • Posts: 3876
    • StrumPract is the musicians best friend
Re: Pac-Mac: a clone of the original game
« Reply #12 on: January 29, 2026, 02:41:11 pm »
Very nice project Lulu!   ;D

It works now, excepted sound. Even after I copied the SO files in executable's directory.

Hello Roland.

It seems the libraries are being loaded via "external" and not dynamically using loadlib().

In this case, you need to copy the libraries to a dedicated system directory, such as /usr/lib or /usr/local/lib.

Copying the SO files to the executable's directory only works on Windows when using "external".
« Last Edit: January 29, 2026, 02:48:18 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Lulu

  • Sr. Member
  • ****
  • Posts: 405
Re: Pac-Mac: a clone of the original game
« Reply #13 on: January 29, 2026, 04:13:39 pm »
Very nice project Lulu!   ;D
Thank you :)

Hello Roland.

It seems the libraries are being loaded via "external" and not dynamically using loadlib().

In this case, you need to copy the libraries to a dedicated system directory, such as /usr/lib or /usr/local/lib.

Copying the SO files to the executable's directory only works on Windows when using "external".
The libs libopenal.so and libsndfile.so are loaded dynamically using DynLibs.
For Linux 64b machine, the game is configured to search these libs in the sub-folder "x86_64-linux".
Please don't move these files.

@Roland:
I don't know why you don't have sounds. In my virtual machine Ubuntu 20.04, I've downloaded the game from the repository and, after compilation, all works well, also the sounds.

Try the game then exit. This will normally create a log file called "alsound.log". this file is in the binary folder.
May be there is a line that describe an error from the audio system. Error message starts with [EE].
By the way, What is your Linux distro ?
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

Fred vS

  • Hero Member
  • *****
  • Posts: 3876
    • StrumPract is the musicians best friend
Re: Pac-Mac: a clone of the original game
« Reply #14 on: January 29, 2026, 04:27:30 pm »
The libs libopenal.so and libsndfile.so are loaded dynamically using DynLibs.

Ooops, sorry for the noise  :-[ ...
(And great, I am fan of DynLibs vs external).
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

 

TinyPortal © 2005-2018