Log In  

by GPI
Cart #picman-1 | 2021-10-02 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA


It is a Pac-Man close, so simple use the direction-buttons to control Pic-Man.



You control Pic and your goal is to eat all pills to win the maze.

Don't touch the ghosts, they will kill you.

When you eat a power pill you become strong enough to eat the ghosts.

In every maze two fruit will appear in the middle of the maze, don't miss them.

Every 1000,2000,4000,... points you get a extra live.

Behind The Scenes

I watched URL Game Maker's Toolkit and was amazed, how "complex" the ai of the ghost are. Since Pic-Man was my first PICO8-Project I decide to re-program Pac-Man. And so many problem started.
First problem, the maze, with a 8x8 tile size it is simple to big for the 128x128 screen. 6x6 would fit, but the map-system is not flexible enough. And so I remembered, that on the old classic c64 you often used the print-command. And again a new problem, how to design the font and how to store it? So hours later a created a URL CharSet Editor and this problem was solved. So the maze is on the screen, now place the pills. First I tried to place the pill exact like the original, but it doesn't work, since my maze is compacter. So i placed more pills and between the "tiles". First I used sprites to draw the pills-dot, in other systems it is nearly always better to use a sprite/texture instead of drawing direct. Big mistake, it will consume around 90% of the virtual cpu - so I changed it to pset()-commands and now I only consume around 50%.
Next step: The main character. Not difficult, he simple runs in tiles and can only change the direction on every tile. The first version couldn't go backwards, but because in the first levels Pic-Man is faster then the Ghost, I changed this. Also the Original could do this. To draw Pic-Man I used 4 sprites, since I only draw a quarter of Pic-Man and use the flip options of the spr-command.
I wanted as less sprites as possible.
The ghost AI was also many try and errors. My ghost react a little different from the original, they have similar behave, but the ghost go more randomized. Also one Ghost really like the fruits. One Problem was, that it could happen, that two ghosts are run exact the same way and nearly the exact same position. So now when two ghost touch each other and go to the same direction, I forced to change one to choose a different direction at the next possible tile. Same as Pic-Man, the ghost are 4 Sprites. Two for the top, one for the bottom (because of the wave-animation) and the eyes.
So now how to create the title-screen. I don't find that the original looks nice, so I searched for artwork. And the next problem - how can I got a picture to a PICO8-rom? Again hours later a new tool was born: URL GFXedit. I used only the the shared part of the spritesheet to save the graphic for the title screen. My plan was to use more artwork and replace the shared part. At the end I only add a game over screen, because I run out of space.
So next big problem Music. I'm not a musician and have no idea of music work. I don't like the original wakka-wakka sound of Pac-Man, I like more the Pac-Mania-Music, but how transfer this to PICO8? Midi-files would maybe a solution, but PICO8 can't open it and I have no idea, how the midi-files work. By accident I found MuseScore 3 and the possibility to export to musicxml, a text-based format. So again hours later a wrote a little program to convert the musicxml to pico8 (Sorry unpublished at the moment, because it miss any interface). I'm not really happy with it, but it work.
In the first version I only add one Level, the original one. But since I draw 12 Fruits, I want more than one level. This was first a problem, because I added the pill-position as static data, now I must phrase the level-data to generate the Borders, add the pills, where the fruit appears and where the ghosts and Pic-Man starts. You can edit the mazes in the source-code and more, if you like.
Since the music used much more than 64 sfx-sounds, I placed the sound-date in the sourcecode. I have optimized the data-format (first one was a big hex-string [[0000a0e01002]], second improve the format [[,,a0,e0,10,2]] and the third uses a special-char-format, so it used nearly everywhere only one char per byte. BTW. one song is too long, it has more than 64 sfx. When the first part is finished, I poke new sfx and music-data in the memory and play part 2.
I had planed to add a third song, but he doesn't sound good and I had again a Problem: over 100% compression. Sadly I must delete the first tab of the code - a big comment with the global variables and what they do.
Now the project is complete - It missed the Intermission from the original, but I have no place any more. I also don't have a good idea to add new ones...
And finally I add a volume-control. It live-patch the sfx-data to reduce the volume.

Very long text - did someone read it complete?


Used Tools

URL CharSet Editor
MuseScore 3
Corel PaintShop Pro X7

Used resources

URL Pac-Man Wiki - Pac-Man Gallery
URL Pac-Man Maze Generation
URL Pac-Man by MineWarz
URL Pac Man Death by YaketyGrass
URL Block Town / Sequenced by: Oedipus / Originally Composed by: Ben Daglish
URL Pacman's Park / Sequenced by: Oedipus / Originally Composed by: Ben Daglish

P#98065 2021-09-30 22:02 ( Edited 2021-10-02 19:11)

:: dw817

A very nice rendition. Love the added music. Gold star.

The original ghosts if I remember correctly though ran a hair faster than Pac-Man. It was up to intelligent path choosing to get all the dots and avoid the ghosts as clearly Pac-Man was slower than them prior to being eatable.

And Pac-Man could never outrun them in a flat out footrace except by crossing the bridge at either side of the screen - where the ghosts were slightly sluggish both entering and exiting the bridge.


P#98072 2021-10-01 03:00
:: GPI


In the original on the first levels, the ghost a little bit slower than Pac-Man.

Ok, maybe my Ghost are at the beginning a little to slow - and a bug - they become relative slower than pacman from level 1-12... I adjust it now a little bit... Then the ghost should be at the same speed on level 12

And I add a level-select. You can now can start in the level you reached last time.

P#98131 2021-10-02 19:14

I miss the sounds when munching pills or eating fruit or ghosts. The game needs this feedback to make it more satisfying.

P#98143 2021-10-03 06:56
:: GPI

hmmm a little bit a problem - the soundtrack up to 4 voices...

P#98522 2021-10-11 21:27

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2021-10-20 14:01:29 | 0.011s | Q:17