Skip to content

joyrider3774/crisp-game-lib-portable-32blit

Repository files navigation

Crisp Game Lib Portable 32Blit (SDK)

This is the Crisp Game Library Portable made by abagames, ported to 32blit SDK so it can run on 32blit, picosystem, picovision, ... It is based on my SDL Port containing the extra games.

Game Features

  • Extra additional games along the original / default games
  • Expanded Menu system to allow headings and more than 16 games listed.
  • Mouse simulation for mouse games
  • Saves Hiscores per game
  • Switch Between Lores and Hires mode

Instructions

You can Select a game from the game list and launch it with the A Button. Upon start of game it will show a small textual info about how to control the game but may not be easy readable in lowres mode. When you want to play another game and return to the games list press Y When you want to switch between lowres / hires mode, for example if a game has slowdowns press X to switch the the mode and restart the current game.

Lores / Hires Mode

Not all the games will run fullspeed, especially on the picosystem for this reason the pico system will by default run the games in low res mode but you can change this by pressing X Button once in a game so that the game will restart in the other mode. The mode is remembered when running other games from the games list but you'll have to renable your choice after a restart. I also don't know if the 32blit would be capable of running all the games fullspeed as i don't own a 32blit.

Notable games that are taxing are:

  • R Wheel
  • B Blast
  • BS Fish (when the fish swaps to little fishes)
  • B Cannon (when there are lots of small balls)
  • D Fight (when there are lots of enemies of the screen)

There may be more so you'll have to test and see what plays best, at any time during a game you can switch modes.

Controls

Button Action
DPAD Move up/down in games list, Move mouse purple dot mouse cursor
A Main Action, can be hold + release or push
Y Back To Games List
B Move One Game Down in Games List otherwise same as A
X Switch between hires / lores mode

Credits

Crisp Game Library Portable is made by abagames, it contained 16 original games, i ported extra games from the original Javascript version of the library by using claude.ai and manual editing and game testing for originally the SDL Port, these are included in this port as well

The sound implementation was made by Obono from the M5Stack Basic port

The Game "Image" inside the blit file was initially by created by, Sai from funkey discord, for the funkey version of the library


ORIGINAL README


Minimal C-lang library for creating classic arcade-like mini-games running on devices and browsers. Re-implemented version of crisp-game-lib for smaller devices. You can play sample games in your browser.

Target devices

Sample game codes and reference

How to write your own game

  1. Copy game_Template.c to game[your game name].c

  2. Comment out other games in menuGameList.c and add void addGame[your game name](); and addGame[your game name]()

    ...(snip)...
    void addGameReflector();
    void addGame[your game name]();
    
    void addGames() {
      /*addGameThunder();
      ...(snip)...
      addGameReflector();*/
      addGame[your game name]();
    }
    
  3. Write your own game in game[your game name].c and rename void addGame_Template() { to void addGame[your game name]() {

  4. Build for browser and debug

  5. Once the game is complete, revert other games that were commented out in menuGameList.c and build it for other devices

Build for [target device]

M5StickCPlus, M5Stack, PyBadge

  1. Install LovyanGFX library

  2. Create cglp[target device]/ directory (e.g. cglpM5StickCPlus/)

  3. Copy cglp[target device].ino, ./src/lib/* and ./src/games/* files to the directory

  4. Verify and upload cglp[target device].ino with Arduino IDE

Playdate

  1. Copy ./src/cglpPlaydate directory

  2. Create cglpPlaydate/build directory

  3. Move to cglpPlaydate/build directory and cmake ..

  4. Open crisp-game-lib-portable.sln with Visual Studio

  5. Build the solution (see Building for the Simulator using Visual Studio)

  6. See also Building for the Playdate using NMake

Arduboy

Note: Some features are limited due to device resource limitations.

ESP32-2432S028R

ESPboy

SDL

Browser

  1. Install Emscripten

  2. Run dev npm script to start the dev server and watch js files

  3. Run dev_c npm script to watch c files and build wasm files

How to operate

Back to the game selection menu

  • Hold down the A button and press the B button (M5StickCPlus, M5Stack)
  • Press the SELECT button (PyBadge)
  • Press A, B, Up and Right buttons simultaneously (Playdate)
  • Press the X key while holding down the up and down arrow keys (Browser)

Toggle sound on/off

  • Press the B button (M5StickCPlus)
  • Press the C Button (M5Stack)
  • Press the START button (PyBadge)
  • Press the Z key while holding down the up and down arrow keys (Browser)

Key assignment on browser

  • (A) X key, (B) Z key, (left/right/up/down) arrow keys

How to port the library to other devices

The source codes for library and games are written device-independent. Besides, you need to implement device-dependent code for the following functions:

  • Device initialization function (e.g. setup() in Arduino) that calls initGame()

  • Frame update function (e.g. loop() in Arduino) that calls setButtonState() and updateFrame()

    • The state of the button press must be notified to the library with the setButtonState()
  • Drawing and audio processing functions that are defined in machineDependent.h

    • md_getAudioTime() function should return the audio timer value in seconds
    • md_playTone(float freq, float duration, float when) function should play a tone with freq frequency, duration length (in seconds) and staring from when seconds on the audio timer
    • md_drawCharacter(unsigned char grid[CHARACTER_HEIGHT][CHARACTER_WIDTH][3], float x, float y, int hash) function should draw the pixel art defined by grid[y][x][r, g, b] at position (x, y). Since hash will be the same for the same pixel art, you can cache pixel art images using hash as an index and avoid redrawing the same image

Sample device-dependent codes are cglpM5StickCPlus.ino and cglpPyBadge.ino.

Porting games from crisp-game-lib using an AI chatbot

You can use an AI chatbot to port game source code for crisp-game-lib to crisp-game-lib-portable. By providing the prompt and set of files to the chatbot, you can obtain the code ported to the C language. I have tried this using Claude 3 Opus, but it is expected to work to some extent with other LLMs as well. The ported code is not perfect, so it needs to be manually checked and corrected.

About

crisp game lib portable for 32blit sdk (32blit, picosystem, picovision, ...)

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors