MZGM2021.BAS - GW-BASIC, 2021 refactor: feature rich maze game
Due to recently looking at my many iterations of maze generators, and noticing the "maze game" versions were very trivial additions, not really meant for consumption, I thought I'd refactor the code into a proper game.
This version includes the following:
- various zoom levels, so you can see what's going on
- zoom levels also provide difficulty levels, and shorter games
- changed the high score system to record scores for each level
- used the LINE command with B (box) F (fill) settings to draw larger pixels. This unfortunately slows down the full resolution maze generation tremendously, since we are using LINE(x,y)-(x,y),BF instead of PSET, but also using GOSUB calls for each PSET and POINT which involves setting parameter variables each time.
- using 320x200 16-color Tandy mode (instead of 160x200 CGA), as I had not known how to CLEAR 32768 bytes of memory for this when I originally made CMP20GAM.BAS (20 for WIDTH 20, for 160x200 mode)
- fixing usability; PC-BASIC emulator runs too fast, so the little pixel moves so fast you cannot navigate T or Plus sections. Therefore, I check diagonals as well, and you can control like Pac-Man, where the diagonal happily guides you horizontally and vertically at the same time.
- I made the places you visited dark gray, which is a nice touch, to help you win.
- Due to diagonal movement fix, I didn't want the places visited to miss the corner pixels, so my quick hack is to render a 3x3 section.
Generation Visuals improvements allows for your choice:
- full generation, showing path create, and back trace.
- back trace only (this is the coolest; it feels magical how it just all fits at the end)
- path generate only (to be erased during back trace)
- no visuals; meaning you only see the maze at the very end
After playing the game for real with the smaller mazes, I noticed several playability issues which I fixed:
- a single path generator creates snake like paths, with little forks, making the path trivial to solve, even for large mazes; since the only options for forks are short-lived paths that are trivial to dismiss. Therefore, I made the generator multi-path like I first did with CMPLXM20.BAS.
- the randomness of the path direction was flawed; at the bottom of the screen, it almost always chooses left, when it could go up as well. Why? Because of the 4 possible random directions, only left and up are available, but if right or down is chosen, it clockwise checks the rest, finding left is available first. Solution is to choose random permutation of the indexes of the four directions, so they are checked in random order.
- Multi-path generation often gets into races with different paths, where each path is running horizontally every increment for the other to do the same, neither can change direction; like a TRON cycle match! The fix is to give paths a TTL (time to live) before it gives up its CPU share, like co-operative multi-tasking. This allows one path to zoom ahead and do its thing, to avoid the races.
- When a path's TTL expires, it's not really dead, so TTL is the wrong term. It just lets another path go. Instead of iterating through all paths incrementally, I choose a random path. This is to help the random nature of the generation.
Conclusion:
The mazes are very hard to solve now! You can easily go down the wrong path that feels right, only to be proven wrong. I got lucky in the easier mazes, but you can see in the harder ones, I had no chance to luckily find the win by sheer intuition.
My playlists:
--------------------
- Voxel: https://youtu.be/watch?v=XCVWEuhCCDM&list=PLjnbT4UISq0bQF1g85tE9jTrKfEtdRYlY
- Road: https://youtu.be/watch?v=ck5ALX11YU4&list=PLjnbT4UISq0bnfd1RC3M4PgTgkmhlkikV
- Ray Casting 3D: https://youtu.be/watch?v=zjswXUTMP2o&list=PLjnbT4UISq0YcFtRFjFQqK0g6ONNCtrvY
- Side-Scroll Shmup: https://youtu.be/watch?v=fF4X8zN-Raw&list=PLjnbT4UISq0Y_7IAN_zUzxgZnfhXxo_0Q
- MonoGame Tutorial: https://youtube.com/watch?v=WW1dJnfXWb0&list=PLjnbT4UISq0adw__Y9B2eXA0LL35TyORU
My websites:
---------------------
- my GitHub: https://github.com/JDoucette
- my company: http://xona.com
- my Blog: http://thefirstpixel.com
Other Videos By Jason Doucette
Other Statistics
Pac-Man Statistics For Jason Doucette
At this time, Jason Doucette has 508 views for Pac-Man spread across 2 videos. Less than an hour worth of Pac-Man videos were uploaded to his channel, making up less than 0.68% of the total overall content on Jason Doucette's YouTube channel.