Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

cel7

A tiny grid-based game framework · By rxi

How to create single file game

A topic by rskgames created Jul 13, 2020 Views: 880 Replies: 5
Viewing posts 1 to 5

Please let me know how to do the following mentioned in the framework page. "Your game file(s) can be appended to the end of the executable to create a self-contained single-file game."

Developer(+1)

On windows:

type cel7.exe game_file.c7 > game.exe

on linux:

cat cel7 game_file.c7 > game

Thank you. 

Do you have any plan to do a write-up about the implementation of this feature like the others in https://rxi.github.io/

Developer(+5)

This particular feature doesn't merit a write-up due to its simplicity, it's achieved by the following:

  1. When application is built a null byte (0x00) is written to the end of the executable
  2. When the application is run it opens its own executable and scans for the last null byte in the file. If there is anything after the last null byte it's assumed to be a program and is read in, otherwise the files listed by the commandline arguments are read

This exact approach only works with text as we're assured the file we're appending to the executable won't contain a null byte of its own

An executable opening itself, never would have thought of that. Thanks for sharing the technique.