Drawing is now optimised in two ways:
1) Center of hexagone are pre-computed once, drawing use that.
2) No wall is ever redraw a second time
Comments and suggestions are welcome.
This is a random maze generator, but the maze have hexagone "cell".
There is no game, no goal, it is just a demo.
To make it a bit more interesting, I provide an interface to modify the size and "shape" of the grid. By shape I mean non perfect hexagone that are taller in one or two directions.
Everything is draw with line and no sprite are used.
There is a lot of math to find the best scale and compute what lines to draw.
It is also unperfect because of the rounding, maybe I should work out to only work with integer to avoid the rounding side effect.
Once optimised I will need to see if it would be workable to draw the map in 30 fps to use that in game.
Please test and give me your comment.
Or better, also check the code and give me your comment.
This is my first program for the Pico-8.
It is also my first piece of LUA code.
So far it is not really a game as there is no goal, no score, no nothing.
If you want to play, you can set your goal to reach the 4 corners of the maze (you start from the center).
Once you succeed, relaunch the game for another maze.
It is mostly a programming experiment in maze/labyrinth generation based on the book:
"Mazes for Programmers / Code Your Own Twisty Little Passages by Jamis Buck."
I did not reuse the code or data structure from the book as it is all in Ruby.
Only the algorithme description were reused, but still an interesting entry level programming book.
The game program does the following:
- Create an full of wall 32*32 maze
- Randomly carve a perfect maze without bias with the Aldous Broder algorithm (that is without bias but slow)
- Display the full maze on screen using my sprite based display function
- Wait for the C or X key
- Display a map based maze with a player in the center
- Let you travel the maze with the arrow key, scrolling as necessary the map keeping you in the center when possible
The code is more or less documented and the size of the maze can be modified in the code.
The maze carving algorithm can be switched to the binary tree algorithm.
I would love to have feedback on this to know in witch direction I should go for further evolution of this WIP
PS: This code was initially completely written on a Pocket C.H.I.P. (sometime with the help of a BT keyboard).
v01 = Initial release without cart image.
v0.1.1 = Updated with a cart image, no known code change.
- a Pocket C.H.I.P. that came with Pico8.
- a C.H.I.P. Console kit that came with Pico8.
- a copy of Pico8 for Raspberry Pi that came with a #CodeTogether! action.
So all in all, I have 3 legal copies of Pico8, but it is unclear if I have a licence.
And if I have a licence, how can I claim it to download a Mac (or PC) version?
If I don't have a licence or those are system specific licence, then, am I suppose to acquire yet another one to be able to download the Mac/PC version?