Log In  
Follow
ozjerry

Cart #animdungen-0 | 2024-05-14 | Embed ▽ | License: CC4-BY-NC-SA
20

This is an animated version of a procedural dungeon generator. It was inspired by a blog post (details below), which included a number of animated demo's which I found quite hypnotic to watch. So I built this to emulate the demo. I also have a cut-down version which runs straight through and generates a full dungeon in one hit. In hindsight I should have probably built the run-through version first and then expanded it out to animate it as I think that would have made for more efficient code.
The generated 'dungeon' is a 2D array of cells, each of which has a type of either wall, passage, door or room (represented by number constants). It could potentially be translated to a simple grid of numbers representing colours or a tilemap, or used as the map for a raycasting 3D game.

[ Continue Reading.. ]

20
2 comments



Cart #puniyasaba-0 | 2024-05-08 | Embed ▽ | License: CC4-BY-NC-SA
11

Generates a random maze, then places the player in the middle of it and ensures that you're not staring straight at a blank wall. Find your way to one of the corners and it will reset with a new maze and plonk you back in the middle. Not really intended as a game, just a learning exercise for me and the hope that the code will be of use to someone with more creativity than myself:)

Controls

Arrow keys to move forward/backward and turn.
Z/X will sidestep left and right
Hitting 'P' at any time will generate a new Maze and place the player in the middle of it.

Background

This is an extension of my previous raycaster. I had to adapt the raycaster logic a bit to handle the maze walls rather than a grid based map.

[ Continue Reading.. ]

11
7 comments



Cart #picotroncaster-3 | 2024-04-16 | Embed ▽ | License: CC4-BY-NC-SA
16

Edit: updated to include a few more optimisations

This is a simple raycasting demo for Picotron. I wanted to check out the performance. It now manages 60fps most of the time thanks to optimisation suggestions by @freds72 and @Eiyeron. Rays are scaled to one third of the screen width to achieve this.

It is an implementation of the DDA algorithm, which is more efficient than a basic marching forward algorithm. The basic algorithm is included in the package if anyone is interested.

I used the extended palette to dither/darken the colour based on distance which does help to enhance the visuals.

Controls

Move using the arrow keys.
The 2D overlay map can be toggled on and off with the 'Z' key.

[ Continue Reading.. ]

16
5 comments



Ceil() function does not work correctly:

ceil(1)   -->returns 1
ceil(1.0) -->returns 2 (Error)

Same for any N.0 float. Seems to work correctly in other circumstances.

LUA math.ceil(1.0) correctly returns 1 and can therefore be used as an alternative in the meantime.

Tested with version 0.1.0e on Windows 10

(I already posted this in the 'Picotron bugs' thread, but including it here with a proper 'Bugs' tag as I couldn't work out how to add a tag to the other post)

1
0 comments



Version 0.1.0e on Windows 10

Strings cannot be indexed using var[n]. This is different to Pico-8, where strings are indexable. However, for Picotron, it may be by design as strings are not indexable in Lua itself.

a = "string"
print(a[2])

--> outputs nil (should be 't')

A workaround for the time being is to use sub(a, 2, 2)

1
0 comments