QB64 Pac-Man Clone
#31
(01-06-2023, 05:44 AM)TerryRitchie Wrote:
(01-06-2023, 03:46 AM)madscijr Wrote:
(01-06-2023, 02:46 AM)TerryRitchie Wrote: Yes, I agree, a level editor would be cool. However, games that do support level editors are built with that functionality in mind before a line of code is even written. Unfortunately I didn't design the game with an editor in mind. It would take much more than a simple modification I'm afraid. I would need to rewrite the entire maze handling routine to accommodate it. I suppose a generic maze generator and handler could be designed that would allow graphics of all the various pac-man iterations to be plugged into (or evern custom graphics). But then there's the issue with movement too. Pac-man looks simple enough at the surface but underneath pac-man has a very sophisticated movement algorithm. You can literally slide pac-man around corners at 7 different points at intersections. The original programmers of pac-man were quite ingenious with its design as I found out while emulating it.

Wow, I always thought the game had good feel, but I never knew how it was implemented. 

I'm not intimately acquainted with the code like you, but when I think about it, it seems that any maze is just a combination of the same limited set of turns and intersections. There are only so many directions Pac Man can go, so even with 7 different points each, any maze can probably be broken down into the same root "tileset", no?

The maze in pac-man is deceptive. Each pellet is actually contained in an 8x8 box and these 8x8 boxes are chained together to form paths. The maze itself is 16x16 but the characters running around in the maze are only concerned with those 8x8 boxes. Once a character enters an 8x8 box it then keep track of it's position within the box (0 through 7). Once position 8, or position -1, is reached it leaves that box and moves to the next one. That is why ghosts can seem to partially cover pac-man but still not kill him. It gives the player that sense of "yikes, it almost got me" when in reality the two characters were in separate 8x8 boxes.

The reason pac-man can slide around corners in 7 different positions is due to the nature of these 8x8 boxes. If pac-man is at an intersection the player can decide to turn at any time within the first 3 or 4 points, depending on direction, and the sooner the turn the bigger slide around a corner pac-man gets. It's a brilliant tactic that allows pac-man to speed up a bit around corners to evade ghosts. The ghosts are not allowed to slide but must wait until they reach the center of an 8x8 box to turn. This is the reason the maze borders are all rounded off, so the pac-man sprite does not cover them while sliding.

I have lots of maze generating code. You can view a really good algorithm in my Super Mega Bug game that generates random braided mazes of any size. Rounded corners and sliding needs special coding and sliding would require a maze generator that can create rounded corners. Doable but much more work.

You have a Vectrex! How cool is that! I remember seeing these for sale when I was kid and wanted one so bad.

I have a decent maze generating algorithm, which I used in a couple games (they were on the old qb64.org site, I need to re-upload all my programs here!). 

But I was thinking of a human-edited mazes - I think tweaking it to work with a maze editor has challenges but I have faith in your abilities, LOL! 

I do have a Vectrex! As a kid the only way I could play one was to go to Sears and play the display model! So finally, as an adult with a "real job" and ebay, I was able to procure my very own at a decent price, woohoo! I also accumulated the Atari Video Music (2 of 'em!), various Atari/Sears Pong home consoles, Atari Video Pinball, Coleco Telstar Combat, and an Apple IIe platinum system. I ended up selling most of that stuff - no room! But I kept the Vectrex - it's just too cool to get rid of! I still have my C64 & Atari 2600 too! (Alas I sold my childhood TI99/4A, but not before transferring all my BASIC creations to PC!)
Reply
#32
Hi Terry

Yes it is too fine and very close to original cabinet that I was playing from when I was child.
Good sound, optimus graphic level, smart movements of shadows.

THANK YOU TO SHARE IT
Reply
#33
(12-26-2022, 08:10 PM)TerryRitchie Wrote: Finally! A working version I can share. This version is as about as close as you can get to the original without using MAME and ROM images.

I've been writing (and rewriting) this for 2 months now. There is still one known bug I need to track down. Sometimes the ghosts trapped in the ghost house will stop bobbing up and down. It doesn't affect game play and very rarely happens (which is why I'm having trouble tracking it down). I'll eventually find the bug and post an update, but in the meantime I need to take a break from it.

The ZIP file contains all the files needed (23 of them). The game creates a file when first executed called "pm.sav" that is two lines long and contains the options settings and high score.

Have fun! Waaka Waaka Waaka ...

What a beautifully implemented version of Pacman in terms of the game itself and the actual underlying code. I wish I'd taken the time to look through something like this before making my first QB64pe project last week! Option _Explicit alone would have been a godsend! I've been declaring variables I needed on a non-local scope as shared at root level - I hadn't realised you only need to add shared locally in subs that required access. That's a much neater approach. I'll have a proper look through before embarking on my next project. Thanks for taking the time to make the code so well documented!
Reply
#34
(01-09-2023, 10:12 AM)RokCoder Wrote:
(12-26-2022, 08:10 PM)TerryRitchie Wrote: Finally! A working version I can share. This version is as about as close as you can get to the original without using MAME and ROM images.

I've been writing (and rewriting) this for 2 months now. There is still one known bug I need to track down. Sometimes the ghosts trapped in the ghost house will stop bobbing up and down. It doesn't affect game play and very rarely happens (which is why I'm having trouble tracking it down). I'll eventually find the bug and post an update, but in the meantime I need to take a break from it.

The ZIP file contains all the files needed (23 of them). The game creates a file when first executed called "pm.sav" that is two lines long and contains the options settings and high score.

Have fun! Waaka Waaka Waaka ...

What a beautifully implemented version of Pacman in terms of the game itself and the actual underlying code. I wish I'd taken the time to look through something like this before making my first QB64pe project last week! Option _Explicit alone would have been a godsend! I've been declaring variables I needed on a non-local scope as shared at root level - I hadn't realised you only need to add shared locally in subs that required access. That's a much neater approach. I'll have a proper look through before embarking on my next project. Thanks for taking the time to make the code so well documented!

Yes, OPTION _EXPLICIT is something I never program without.

I learned that documentation was just as important as the code when I used to dabble in x86 Assembler. It's a habit that I've kept ever since. It not only helps others to understand the code I write but a nice reminder for myself. Sometimes I look at code I wrote years ago and wonder, "What was I thinking here?" LOL

Thank you for the kind words as well Smile

Terry
Reply
#35
Hi Terry,

This is an awesome clone!  It feels like the original.

I have a question regarding this code... What guidelines would I be required to uphold with if I wanted to modify this code and share the compiled executable freely among others? I could easily have fun building off this code to derive into somthing totaly different. 

I would also include the original source code along with the modified source code. I am even willing to privately provide you a copy of what I am doing and make sure your ok with it prior to my given it out. 

among the changes added would be different mazes (both in size and pattern), more monsters (quantity and types), and some of the pellets themselves would move.

Thanks
- RedAfro
Reply
#36
Ah another Pac-Man fan! and probably a Terry Ritchie one too Smile

Welcome to the forum @RedAfro-LIVE
b = b + ...
Reply
#37
(02-03-2023, 07:49 PM)RedAfro-LIVE Wrote: I have a question regarding this code... What guidelines would I be required to uphold with if I wanted to modify this code and share the compiled executable freely among others? I could easily have fun building off this code to derive into something totaly different. 

I would also include the original source code along with the modified source code. I am even willing to privately provide you a copy of what I am doing and make sure your ok with it prior to my given it out. 

Welcome to the forums. It should be OK as long as Terry is properly credited for being the original author of the program, and you make this visible in your distribution such as a "README" file that, sadly, most people don't read anyways.

"Privately" sounds too strong LOL. PM within this forum should be enough.
Reply
#38
(02-03-2023, 10:08 PM)mnrvovrfc Wrote:
(02-03-2023, 07:49 PM)RedAfro-LIVE Wrote: I have a question regarding this code... What guidelines would I be required to uphold with if I wanted to modify this code and share the compiled executable freely among others? I could easily have fun building off this code to derive into something totally different. 

I would also include the original source code along with the modified source code. I am even willing to privately provide you a copy of what I am doing and make sure your ok with it prior to my given it out. 

Welcome to the forums. It should be OK as long as Terry is properly credited for being the original author of the program, and you make this visible in your distribution such as a "README" file that, sadly, most people don't read anyways.

"Privately" sounds too strong LOL. PM within this forum should be enough.

Cool, & thank you for the 'Welcome to the forums'.

I am a huge fan of keeping credit to the originators. It would totally rock having both Terry and 'QB64-Phoenix' being recognized.

Maybe I should elaborate on what I'm planning incase this approach changes anyone's opinion...

I made a miniature arcade cabinet, (has a 10 in screen), using spare parts and I had intended to send it to a YouTube'er anonymously with a custom Pac-Man game I hatched out that uses characters found in the RecRoom online community; setup to boot straightway into the game so that it mimics being a standalone device.

This idea of keeping it anonymous was found to be unfavorable. So I restrategized and this I what I now have in mind. I wish to keep the miniature arcade cabinet as a standalone / boot directly into the game device (so that it has that authentic feel). So now this is my plan:
  • Scrap my usage of my original code (as I failed to notate my code adequately so it is unusable to others unfortunately). & Terry made the BEST clone of Pac-Man that I ever came across, way better than what I had done.
  • Use the original miniature arcade cabinet as planed.
  • Clarification statement that both the hardware and software are not to be sold or traded in any sort of raffle.
  • Include a USB stick contaning the original ZIP version made by Terry with links to the 'QB64-Phoenix' & with simple instructions of how to download QB64-Phoenix directly from the source.
  • Include my modified source version of the program (with adequate notations of what I did in the code) on that same USB stick.
  • Include my email for further questions.
  • Include a statement explaining the value of directly downloading QB64p and building the EXE to assure no malware / various are being planted. 

Thus, this person would be doing an unboxing video on YouTube and seeing this setup for the first time upon that unboxing.

Something I should point out; I do not sell any of the items that are involved in this project, no will I be getting any affiliated kickback / commercialization kickback. I like doing a lot of 'MAKE:' and 'how-to' type of things wile staying off the radar. likewise, if I drop a name or used someone else's resource then I both like to cite the source and unofficially make sure the source is not irritated with my reusing or adaptation of their materials. The miniature arcade cabinet was assembled compleatly from parts that people anonymously donated to me. The only part I will be paying for is the shipping cost.

I will certainly post a follow-up here regarding what I do. At a minimal I wanted to change the Pac-Man character to be as the icon of the YouTube'r and change the red monster so that it has an afro and retro-sunglasses. 

funny fact, the ghost in Pac-Man are not ghost; in the original PuckMan game they where identified as monsters. 

- RedAfro
Reply
#39
(02-03-2023, 08:17 PM)bplus Wrote: Ah another Pac-Man fan! and probably a Terry Ritchie one too Smile

Welcome to the forum @RedAfro-LIVE

Terry Ritchie totally ROCK's! His clone of Pac-Man is the best I have ever played. 

I am a child of the 70's, 100% love the early arcade games! I recall Pac-Man rolling into a local shop (named 'The New Fantasy Shop' just down the street from where I lived in North/West side of Chicago).

Also love that the phoenix his emerged; I was so sad when I look like QB64 has disappeared!

Thanks for the welcome to the forum Wink
- RedAfro
Reply
#40
(02-06-2023, 01:47 PM)RedAfro-LIVE Wrote: funny fact, the ghost in Pac-Man are not ghost; in the original PuckMan game they where identified as monsters. 

- RedAfro

Puckman (the original version of Pac-Man, before its name was changed) was created in Japan where they evil doers were called "yokai".  Yokai is one of those words which doesn't translate 100% to English,and can be considered to reference any of the spooky things that go bump in the night.  Boogeymen, ghosts, demons, ogres, trolls, and goblins... All are yokai.

It's a lot like how they define anime -- anything animated is basically anime.  Mickey Mouse and Bugs Bunny are anime according to the Japanese usage of the term, while for us they're called "cartoons".  We somehow consider anime to be more mature cartoons with some stylistic differences, but they don't make that distinction.

So Puckman's foes could've been ghosts, demons, or monsters -- all would've been a true translation of "yokai".  Wink
Reply




Users browsing this thread: 3 Guest(s)