Doodle is the game engine for Sketchy Maze written in Go. https://www.sketchymaze.com/
Go to file
Noah Petherbridge 4851730ccf Fix RLE Encoding Off-by-One Errors [PTO]
Levels can now be converted to RLE encoded chunk accessors and be re-saved
continuously without any loss of information.

Off-by-one errors resolved:

* The rle.NewGrid() was adding a +1 everywhere making the 2D grids have 129
  elements to a side for a 128 chunk size.
* In rle.Decompress() the cursor value and translation to X,Y coordinates is
  fixed to avoid a pixel going missing at the end of the first row (128,0)
* The abs.X-- hack in UnmarshalBinary is no longer needed to prevent the
  chunks from scooting a pixel to the right on every save.

Doodad tool updates:

* Remove unused CLI flags in `doodad resave` (actors, chunks, script,
  attachment, verbose) and add a `--output` flag to save to a different file
  name to the original.
* Update `doodad show` to allow debugging of RLE compressed chunks:
    * CLI flag `--chunk=1,2` to specify a single chunk coordinate to debug
    * CLI flag `--visualize-rle` will Visualize() RLE compressed chunks in
      their 2D grid form in your terminal window (VERY noisy for large
      levels! Use the --chunk option to narrow to one chunk).

Bug fixes and misc changes:

* Chunk.Usage() to return a better percentage of chunk utilization.
* Chunker.ChunkFromZipfile() was split out into two functions:
    * RawChunkFromZipfile retrieves the raw bytes of the chunk as well as the
      file extension discovered (.bin or .json) so the caller can interpret
      the bytes correctly.
    * ChunkFromZipfile calls the former function and then depending on file
      extension, unmarshals from binary or json.
    * The Raw function enables the `doodad show` command to debug and visualize
      the raw contents of the RLE compressed chunks.
* Updated the Visualize() function for the RLE encoder: instead of converting
  palette indexes to hex (0-F) which would begin causing problems for palette
  indexes above 16 (as they would use two+ characters), indexes are mapped to
  a wider range of symbols (0-9A-Z) and roll over if you have more than 36
  colors on your level. This at least keeps the Visualize() grid an easy to
  read 128x128 characters in your terminal.
2024-05-24 13:54:41 -07:00
assets Update savegame format, Allow out-of-bounds camera 2023-03-07 21:55:10 -08:00
cmd Fix RLE Encoding Off-by-One Errors [PTO] 2024-05-24 13:54:41 -07:00
docker Rename Go module 2022-09-24 15:17:25 -07:00
docs Scripting: Bring Self API up to Actor API parity 2024-04-26 22:34:13 -07:00
etc Update Linux launcher for mobile compatibility 2022-07-04 10:22:15 -07:00
lib Rename Go module 2022-09-24 15:17:25 -07:00
pkg Fix RLE Encoding Off-by-One Errors [PTO] 2024-05-24 13:54:41 -07:00
scripts Fix blockers for v0.14.0 release 2024-05-05 15:59:56 -07:00
types Save and restore maps as JSON files 2018-06-17 10:31:44 -07:00
wasm Dust off WASM build support 2023-12-08 21:52:34 -08:00
winres Winres config 2023-12-21 20:17:49 -08:00
.dockerignore Editor: Allow using doodad settings buttons in Pan Tool 2022-12-08 20:03:53 -08:00
.editorconfig Initial commit 2017-10-26 18:03:11 -07:00
.gitignore Editor: Allow using doodad settings buttons in Pan Tool 2022-12-08 20:03:53 -08:00
appimage.sh Dockerfile, AppImage Release 2022-12-08 19:15:48 -08:00
bootstrap.py Fix bootstrap.py script 2024-04-18 23:07:25 -07:00
Building.md WIP Doodle++ 2024-04-18 20:23:07 -07:00
Changes.md Prepare v1.14.0 for release 2024-05-04 18:26:32 -07:00
Debug Notes.md Add JS + History to Shell, Add Main Scene 2018-07-25 19:38:54 -07:00
debug-af.sh Choice of palette when creating a new level 2021-06-05 20:51:20 -07:00
Dockerfile Update Go dependencies 2023-12-21 21:09:25 -08:00
go.mod Log game output to disk, update deps for 1.14.0 2024-05-04 19:32:40 -07:00
go.sum Log game output to disk, update deps for 1.14.0 2024-05-04 19:32:40 -07:00
Ideas.md Add Switches, Fire/Water Collision and Play Menu 2019-07-06 18:30:03 -07:00
kirsle.env Draw Actors Embedded in Levels in Edit Mode 2018-10-19 13:32:25 -07:00
LICENSE.md Open Source Release 2022-09-24 16:17:30 -07:00
Makefile Remove deprecated go build -i flag for Windows 2024-05-05 16:49:11 -07:00
mp2json.py WIP: MsgPack stubs, Level Filesystem Module 2019-05-06 12:41:46 -07:00
Open Source Licenses.md Prepare v0.11.0 for release (+ fixes) 2022-02-20 17:48:07 -08:00
README.md Scripting: Bring Self API up to Actor API parity 2024-04-26 22:34:13 -07:00
requirements.txt AppImage Support 2022-04-25 21:31:46 -07:00
TODO.md Better Ellipse Drawing Algorithm 2019-07-16 18:27:00 -07:00

Sketchy Maze

Homepage: https://www.sketchymaze.com

Sketchy Maze is a drawing-based maze game.

The game is themed around hand-drawn, side-scrolling platformer type mazes. You can draw your own levels using freehand and basic drawing tools, color in some fire or water, and drag in pre-made "Doodads" like buttons, keys and doors to add some interaction to your level.

This is a very early pre-release version of the game. Expect bugs and slowness but get a general gist of what the game is about.

This alpha release of the game comes with some example levels built-in for playing or editing and a handful of built-in Doodads.

See the Guidebook included with this game for good user-facing documentation or online at https://www.sketchymaze.com/guidebook

Features

(Eventually), the high-level, user-facing features for the game are:

  • Draw your own levels freehand and then play them like a 2D platformer game.
  • In Adventure Mode you can play through a series of official example levels that ship with the game.
  • In Edit Mode you can draw a map freehand-style and lay down physical geometry, and mark which lines are solid or which ones behave like fire.
  • Drag and drop Doodads like buttons, doors and keys into your level and link them together so that buttons open doors and levers activate devices.
  • In Play Mode you can play your level as a 2D platformer game where you collect keys, watch out for enemies, and solve puzzles to get to the exit.
  • Easily Share your custom maps with friends.

Mod-friendly

(Eventually) all these features will support custom content in the game:

  • Users can create Custom Doodads to extend the game with a scripting language like JavaScript. The sprites and animations are edited in-game in Edit Mode, but the scripting is done in your text editor.
  • In Edit Mode you can drag custom doodads into your maps.
  • To Share your maps, you can choose to bundle the custom doodads inside your map file itself, so that other players can play the map without needing to install the doodads separately.
  • If you receive a map with custom doodads, you can install the doodads into your copy of the game and use them in your own maps.

Developer Documentation

In case you are reading this from the game's open source repository, take a look in the docs/ folder or the *.md files in the root of the repository.

Some to start with:

Keybindings

Global Keybindings:

Escape
  Close the developer console if open, without running any commands.
  Exit the program otherwise.

Enter
  Open and close the developer console, and run commands while the
  console is open.

F3
  Toggle the Debug Overlay.

F4
  Toggle debug collision hitboxes.

In Play Mode:

Cursor Keys
  Move the player around.
"E" Key
  Edit the map you're currently playing if you came from Edit Mode.

In Edit Mode:

Cursor Keys
  Scroll the view of the map around.
"P" Key
  Playtest the current map you're working on.
"F" Key
  Switch to the Pencil (Freehand) Tool
"L" Key
  Switch to the Line Tool
"R" Key
  Switch to the Rectangle Tool
Ctrl-Z
  Undo
Ctrl-Y
  Redo

Gamepad Controls

The game supports Xbox and Nintendo style game controllers. The button bindings are not yet customizable, except to choose between the "X Style" or "N Style" for A/B and X/Y button mappings.

Gamepad controls very depending on two modes the game can be in:

Mouse Mode

The Gamepad emulates a mouse cursor in this mode.

  • The left analog stick moves a cursor around the screen.
  • The right analog stick scrolls the level (title screen and editor)
  • A or X button simulates a Left-click
  • B or Y button simulates a Right-click
  • L1 (left shoulder) emulates a Middle-click
  • L2 (left trigger) closes the top-most window in the editor mode (like the Backspace key).

Gameplay Mode

When playing a level, the controls are as follows:

  • The left analog stick and the D-Pad will move the player character.
  • A or X button to "Use" objects such as Warp Doors.
  • B or Y button to "Jump"
  • R1 (right shoulder) toggles between Mouse Mode and Gameplay Mode.

You can use the R1 button to access Mouse Mode to interact with the menus or click on the "Edit Level" button.

Note: characters with antigravity (such as the Bird) can move in all four directions but characters with gravity only move left and right and have the dedicated "Jump" button. This differs from regular keyboard controls where the Up arrow is to Jump.

Developer Console

Press Enter at any time to open the developer console. The console provides commands and advanced functionality, and is also where cheat codes can be entered.

Commands supported:

close
  Exit to the game's title screen.

new
  Show the "New Level" screen to start editing a new map.

save [filename]
  Save the current map in Edit Mode. The filename is required
  if the map has not been saved yet.

edit [filename]
  Open a map or doodad in Edit Mode.

play [filename]
  Open a map in Play Mode.

echo <text>
  Flash a message to the console.

alert <text>
  Test an alert box modal with a custom message.

clear
  Clear the console output history.

exit
quit
  Close the developer console.

boolProp <property> <true/false>
  Toggle certain boolean settings in the game. Most of these
  are debugging related. `boolProp list` shows the available
  props.

eval <expression>
$ <expression>
  Execute a line of JavaScript code in the console. Several
  of the game's core data types are available here; `d` is
  the master game struct; d.Scene is the pointer to the
  current scene. d.Scene.UI.Canvas may point to the level edit
  canvas in Editor Mode. Object.keys() can enumerate public
  functions and variables.

repl
  Enters an interactive JavaScript shell, where the console
  stays open and pre-fills a $ prompt for subsequent commands.

The JavaScript console is a feature for advanced users and was used while developing the game. Cool things you can do with it may be documented elsewhere.

Cheat Codes

The following cheats can be entered into the developer console.

Play Mode:

  • import antigravity
    • This disables the effects of gravity for the player character. Arrow keys can freely move the player in any direction.
  • ghost mode
    • This disables collision detection for the player character so that you can pass through walls and solid doodads. Combine with antigravity or else you'll fall to the bottom of the map!
  • give all keys
    • Adds all four colored keys to the player's inventory.
  • drop all items
    • Clears the player's inventory of all items.

Experimental:

  • unleash the beast
    • Removes the 60 FPS frame rate lock, allowing the game to run as quickly as your hardware permits.
  • don't edit and drive
    • Allows editing the level while you're playing it: you can click and drag new pixels with the freehand pencil tool.
  • scroll scroll scroll your boat
    • Enables Editor Mode scrolling (with the arrow keys) while playing a level. The player character must always remain on screen though so you can't scroll too far away.

Unsupported shell commands (here be dragons):

  • reload: reloads the current 'scene' within the game engine, using the existing scene's data. If playing a level this will start the level over. If editing a level this will reload the editor, but your recent unsaved changes should be left intact.
  • guitest: loads the GUI Test scene within the game. This was where I was testing UI widgets early on; not well maintained; the close command can get you out of it.

Environment Variables

To enable certain debug features or customize some aspects of the game, run it with environment variables like the following:

# Draw a semi-transparent yellow background over all level chunks
$ DEBUG_CHUNK_COLOR=FFFF0066 ./doodle

# Set a window size for the application
# (equivalent to: doodle --window 1024x768)
$ DOODLE_W=1024 DOODLE_H=768 ./doodle

# Turn on lots of fun debug features.
$ DEBUG_CANVAS_LABEL=1 DEBUG_CHUNK_COLOR=FFFF00AA \
  DEBUG_CANVAS_BORDER=FF0 ./doodle

Supported variables include:

  • DOODLE_W and DOODLE_H set the width and height of the application window. Equivalent to the --window command-line option.
  • D_SCROLL_SPEED (int): tune the canvas scrolling speed. Default might be around 8 or so.
  • D_DOODAD_SIZE (int): default size for newly created doodads
  • D_SHELL_BG (color): set the background color of the developer console
  • D_SHELL_FG (color): text color for the developer console
  • D_SHELL_PC (color): color for the shell prompt text
  • D_SHELL_LN (int): set the number of lines of output history the console will show. This dictates how 'tall' it rises from the bottom of the screen. Large values will cover the entire screen with console whenever the shell is open.
  • D_SHELL_FS (int): set the font size for the developer shell. Default is about 16. This also affects the size of "flashed" text that appears at the bottom of the screen.
  • DEBUG_CHUNK_COLOR (color): set a background color over each chunk of drawing (level or doodad). A solid color will completely block out the wallpaper; semitransparent is best.
  • DEBUG_CANVAS_BORDER (color): the game will draw an insert colored border around every "Canvas" widget (drawing) on the screen. The level itself is a Canvas and every individual Doodad or actor in the level is its own Canvas.
  • DEBUG_CANVAS_LABEL (bool): draws a text label over every Canvas widget on the screen, showing its name or Actor ID and some properties, such as Level Position (LP) and World Position (WP) of actors within a level. LP is their placement in the level file and WP is their actual position now (in case it moves).

Author

The doodle engine for Sketchy Maze is released as open source software under the terms of the GNU General Public License. The assets to the game, including its default doodads and levels, are licensed separately from the doodle engine. Any third party fork of the doodle engine MUST NOT include any official artwork from Sketchy Maze.

Doodle Engine for Sketchy Maze
Copyright (C) 2022  Noah Petherbridge

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.