Log In  
BBS > Lexaloffle Community Superblog
This is a combined feed of all Lexaloffle user blogs. For Lexaloffle-related news, see @zep's blog.

All | Following | PICO-8 | Voxatron | General

Cart #shark_attack-3 | 2022-05-10 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

P#111621 2022-05-10 17:32 ( Edited 2022-05-10 17:53)

Cart #speedsnake_ai-9 | 2022-05-11 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6

This is an implementation of an algorithm that plays snake very well. It's based on a path through all board cells and calculated shortcuts to get more efficiency.

Controls:
X - show/hide the path

Menu items:
ALG - controls which variant of the algorithm is used.
SPEED - Snake's speed, lower = faster.
SNAKE - Change snake visualisation.

The path was generated based on a Hilbert curve. It would work with any path that goes through all board cells, but the Hilbert curve has some nice properties and looks.

I have implemented two variants of this algorithm here, togglable in the menu. "Tail" algorithm tends to follow it's tail very closely when it can't get directly to food. "Blocky" algorithm curls on itself until it has a clear path to food resulting in big patches of snake body later in the game. I believe "Tail" is more efficient than "Blocky".

Algorithm explanation:

General idea

If there is a path through all cells of the board the snake can just follow it forever. It will reach all the food and grow to the maximum size. It will be quite slow though, having to go through an average of half of the board's area to reach every food. It can be made quicker in the early game by making some shortcuts.

Path preparation

The path is described as a 16x16 grid of cells. Each cell stores coordinates of the next cell on the path. They are also assigned consecutive numbers from 0 to 255 according to their order on the path. Each cell will also store some metadata during the algorithm execution.

What shortcuts are allowed?

Obviously only shortcuts that get the snake closer to its goal should be used. In addition, to ensure safety, every shortcut should bring the snake closer to its goal on the path, meaning that every cell of path between the snake and its goal remains empty, and the path between the snake and its goal only decreases. A reasonable approach is to make steps that skip over as big parts of the path as possible, but that isn't efficient on a Hilbert curve path because sometimes following the path can lead to a larger skip than just taking every possible shortcut.

The goals

Another thing is deciding what the snake's goal is. If the snake always went straight for the food it would quickly run into itself and die. In order to ensure its safety it must never overtake its own tail on the path. This means that if the path is clear between the food and snake's head it can target the food, but if it isn't it has to find some other target while waiting for its tail to get out of the way. The 'Tail' algorithm the snake will target the cell right behind its tail (according to the path). This way it's trying to go as far as possible so it has a good start when the path to the food is finally clear. If the 'Blocky' setting is ON the snake will just follow the path until there's a clear way from it to the food and only use the shortcuts for getting to food.

The Algorithm

Each frame the best cell to move to is calculated from the snake's head. Cells are scored like this (lower is better):

  1. If the cell already has a score metadata stored return that score.
  2. If the cell is at the goal, score is 0. Save the score as metadata and return 0.
  3. Set best score to 2000 (arbitrary big value more than the cells on the board).
  4. For each neighbouring cell do:
    a. It it's not between the currently evaluated cell and the goal on the path, ignore it.
    b. Otherwise, get it's score using this algorithm.
    c. If it's smaller then the current best score update the best score.
  5. This cell's score is best score + 1.
  6. Save it as metadata of this cell, and return it.

All cells adjacent to the snake's head that are further along the path are evaluated and the smallest one is chosen. Remember, the goal doesn't have to allways be the food, and the path should always be clear between the head and the goal, so choose your goals carefully!

Complexity and final regards

This algorithm has O(n) time complexity where n is the distance from the head to the goal, which is never bigger than the size of the board, so I would call that a good one. PICO-8 can process it at 60FPS for a 16x16 board. It also has O(n) space complexity where n is the size of the board, which is the same as the game itself.

My explanations tend to be all over the place, so if you are confused about anything feel free to ask!

Inspired by: Code Bullet (YT)

P#111610 2022-05-10 13:32 ( Edited 2022-05-11 08:01)

Post game requests here for https://www.lexaloffle.com/bbs/?tid=47699

if possible put:

CATEGORY (ONLY ONE):
game
tweetcart
tool

game name
author
any tags you feel apply (multiple tags are fine)
cart ID

(if enough jam games are put here, a jam category will be added)

P#111611 2022-05-10 11:56 ( Edited 2022-05-13 13:50)
P#111608 2022-05-10 09:44 ( Edited 2022-05-10 09:48)

Cart #dragdropv1-0 | 2022-05-10 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Simple mouse drag and drop code snippet.

P#111593 2022-05-10 01:34 ( Edited 2022-05-10 01:35)

Tscherno Jump 1.0

Follow the arrows! Dodge the cats! Avoid the Sawtraps! This game is bloody - bloody diffcult!

Cart #yuyitewaho-1 | 2022-05-09 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
5

Tscherno Jump is a demake of a game that unfortunately never saw the light of day, by @Asebist and me.

You only need one button, Tscherno and his clones will automatically follow the arrows on the ground, except if you want to jump over them or need to jump an obstacle. Try and figure out the fastest way through the levels!

How to play?

  • press X/O to start running, arrows change your direction
  • collect all coins in a level to finish
  • run into cherries to spawn two clones besides you
  • sometimes you need to lose clones strategically to remove obstacles
  • only one Tscherno needs to survice to score
  • try and beat your best times in speedrun mode

play it on itch

What is in the box?

  • 36 challenging levels
  • multiple obstacles and types of arrows to tickle your braincells
  • speedrun mode
  • level editor (save ~144 maps)

Is it truly done yet?

well, probably not, it needs:

  • more levels and a shallower learning curve
  • feedback feedback feedback

How to use the Level Editor?

  • press "ENTER" and select "NEW MAP" or "OPEN EDITOR"
    use the ARROW KEYS to move the edit cursor
    press "M" to add an object
    press "N" to delete an object
    use ARROW LEFT / RIGHT to choose an object to place
    use ARROW UP / DOWN to change direction or subtype of object
    press "M" to place the object or "N" to cancel
  • press "TAB" to save the current level to a string
    in the code you can add this string to the levels table or send it to me to add it to the final version of the game if you built something cool :)
  • press "ENTER" and select "CLOSE EDITOR" to save the map for the session
    you will "testplay" this map immediately
  • press "ENTER" and select "SELECT MAP" to play the map again later
    new maps get added to the end of the levellist

Feedback and help are much appreciated

if you´ve got levels you want to submit, please go ahead and share your level string
also if you want to support this game with proper music, it would be much appreciated
other than that, every feedback helps as well :)

P#111580 2022-05-09 21:05 ( Edited 2022-05-09 21:06)

As some of you know, I was making some PNP mods for the community and I did enjoy making them. It was fun interacting with the FNF and PNP community until crap happened. If you don't know, there have been lots of FNF dramas and people doing some VERY illegal stuff in the community. I will not go into detail about what happened as it is pretty offensive. If you want to know what has happened, go and watch FNF news videos.

Because of this, I decided to not make any more content for this community because of how toxic it is because they clearly don't deserve anything.

I have also been cyberbullied and harassed in the forums, that is another reason why I stopped. I may have made a bad cart, but I didn't deserve ANY of that.

Hopefully, this will teach you angry Twitter users a lesson, and I hope you understand this decision.

P#111575 2022-05-09 19:43 ( Edited 2022-05-09 19:44)

Cart #themepark-1 | 2022-05-10 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
12

Controls

Arrows: Move cursor around the screen.

x: Select tool/menu/option.

z: Return to previous menu.

How to play

Take an empty field and turn it into the next big Theme Park!

Select the Tools to access the build menu. Start by placing paths, shops and your first ride. Watch out for the cost of the buildings to be sure to not run out of money. Guests will be attracted to your park over time and spend money at each of your rides and shops. Be sure to keep them happy by providing them with rides, food and toilets.

As you save more money, better rides become available for you to build. Try to build them all and keep track of your park records.

Tips:

Happy guests will attract more visitors.
Guests will lose happiness if they are hungry or need the toilet, so be sure to spread these around your park.

Background

My second completed project for the Pico 8!

This started as a test for myself to build an efficient pathfinding algorithm for use in Pico 8. The test started with just paths and up to 2500 guests walking to different parts of a maze.

This is the first time I had struggled with the token limit and towards the end I was really squeezing extra space out of my code to finish the project, and more squeezing can be done still I am sure!

I had a lot of fun building this project, and although it is not very long, I hope you can have fun playing it too!

Credits

Game created by Joseph

@JosephMakesGame

P#111559 2022-05-09 14:00 ( Edited 2022-05-10 11:18)

The manual describes layers, the optional last argument to map(), like so:

> LAYERS is a bitfield. When given, only sprites with matching sprite flags are drawn. For example, when LAYERS is 0x5, only sprites with flag 0 and 2 are drawn.

To me, this example indicates that only sprites with both flags set should be drawn. However, testing shows that sprites with either flag set will be drawn.

Cart #pederick_mapflagtest-0 | 2022-05-09 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

If this is as intended, can the manual be updated to say "or" rather than "and"? Something like this:

> LAYERS is a bitfield. When given, only sprites with at least one matching sprite flag are drawn. For example, when LAYERS is 0x5, only sprites with flag 0 or 2 are drawn.

P#111550 2022-05-09 12:36

Notice

You won't be able to use all the colors and wall kick skill in the start of the game. Also, the teleporter (mouse) is used to debug, it's not a part of the game.

Hope you enjoy.

Cart #cc2-3 | 2022-05-13 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

P#111552 2022-05-09 12:23 ( Edited 2022-05-13 13:03)

Cart #kareriropo-0 | 2022-05-09 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

P#111538 2022-05-09 05:06

Cart #matamunapa-0 | 2022-05-09 | Code ▽ | Embed ▽ | No License

P#111536 2022-05-09 02:37

Cart #gb_momday_22-2 | 2022-05-08 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

VER 0: Initial release
VER 1: Fixed shading under left M
VER 2: Date said 2020, changed to 2022

P#111532 2022-05-08 21:57 ( Edited 2022-05-08 23:27)

Cart #pico_splore_os-1 | 2022-05-10 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6

Hi everyone. This is a remake of
https://www.lexaloffle.com/bbs/?tid=46049

a few sprites borrowed from (https://www.lexaloffle.com/bbs/?pid=111394#p)

Features:
-select games, tweetcarts or toold
-filter by any number of tags
-filter instead by author
-mouse controls (switch to keyboard in menu)
-probably many bugs
(if no games fit, the list of games will just be the full list)

if you want to see a game added, post it here
https://www.lexaloffle.com/bbs/?tid=47759

P#111393 2022-05-08 21:39 ( Edited 2022-05-10 21:36)

Cart #picoconwaylife-0 | 2022-05-08 | Code ▽ | Embed ▽ | No License

Simple implementation of Conway's game of life
Click to set square alive
X - run simulation
Z - clear grid

P#111522 2022-05-08 20:43

Cart #kobold_compulsion_matrix-0 | 2022-05-08 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
7

CW: Mind control subtext, disorienting imagery. (pulsing, strobing, you name it) Some mildly suggestive language.

This is a Rubik's cube that is also a slot machine that is also a roulette wheel that is also an endless runner. It's probably not a TF trigger. That would be ridiculous.

P#111521 2022-05-08 19:17 ( Edited 2022-05-08 19:35)

I was exporting a sound for testing and I just did

export .wav

And this made the file ".wav" which is great and all.. But on mac files starting with . are hidden..
So I'm not sure if this is a issue or not but I had to check if it existed with a ls -a
And I guess I'll go delete .wav and .png that are just sitting around...
(Oh! and also forgot to mention since pico takes this . hidden stuff for .DS_Store and such into account I couldn't find it with ls either.)

P#111520 2022-05-08 19:03 ( Edited 2022-05-08 19:09)

Cart #dunjon-0 | 2022-05-08 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

P#111516 2022-05-08 17:20 ( Edited 2022-05-15 00:05)

Cart #matrix_screen-0 | 2022-05-08 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6

This is not a game, it's more just a vfx test and my "Hello World" to the bbs

This is a little project I worked on for a couple hours. It uses @Krystman particle effects function as a base but everything else was made by me. I learned a lot of things while making this, like how to use the chr() function.

Thanks for checking this out.

P#111507 2022-05-08 13:31

Cart #jiwumutigi-1 | 2022-05-08 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
Hello this is my first game and the lasers just don't do what they're meant to

Instead of firing one at a time they just come out in a stream

I'm doing the magpi spaceshooter tutorial and I've looked at the code for it and it is the same as my code

I really need help

thanks

[#Drone to Home v0.1#]

P#111506 2022-05-08 12:53 ( Edited 2022-05-08 13:01)
View Older Posts
Follow Lexaloffle:        
Generated 2022-05-24 02:12:50 | 0.157s | Q:94