Log In  
Follow
Saffith

Cart #object_system_demo-1 | 2019-09-11 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
9

This is an example of constructing and storing maps in a way that is efficient in terms of both bytes and tiles.

The map in this demo takes only 98 bytes and 26 tiles (not counting the player sprite). That's about 2.4% of the dedicated map space or 1.2% of the total map space. As implemented here, the decoding and map functions - the main things you'd actually need in a game - take 666 tokens. It's meant more as an example than a library, but it's usable as it is, and you're welcome to do so. There's plenty of room for optimization, but I didn't want to make it too hard to read.

The first points of interest are the encode() and decode() functions, which allow you to write and read arbitrary numbers of bits. These makes it trivial to serialize data with a minimum of waste.

[ Continue Reading.. ]

9
7 comments



On Linux, pressing Windows+R draws garbage on the screen and seems to run the cart twice at once. I haven't observed anything more serious resulting from this so far.

0 comments



x=x+shl(
  1,
  y
)

Works fine.

x+=shl(
  1,
  y
)

Syntax error: unclosed (

x+=shl(1,
  y
)

Syntax error: unexpected symbol near ')'

1
5 comments



Yep, that's what it's called. Sorry.

My first P8 game. Just a simple, straightforward platformer. Three worlds of three levels each. There's no story or anything (I barely managed an ending, and not just because of the token limit).

Cart #54395 | 2018-07-25 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
125

If anyone wants them, the unminified game, map editor, and other stuff are available here. They're pretty messy, but feel free to do whatever with them. Just be aware that most things "save" via printh. Not a great way to do things, but it worked out.

125
25 comments