Log In  
Follow
samhocevar
Follow

I know several people already created TTF fonts, but I believe this goes slightly beyond.

This cart is a tool that vectorises the PICO-8 font and exports it to %APPDATA%/pico-8/carts/font.sfd.p8l . You can then open that file in FontForge and modify it to your will, then export it as TrueType, PostScript etc.

It should be fully forward-compatible and if Zep ever changes a glyph, then the resulting TTF file will change accordingly.

For instance, if you are lucky enough to have a PICO-8 Gold Account™ and the latest preview version with the chr() function and the kana glyphs you’ll even get Japanese support:

Here it is in action in the Windows font settings:

And here it is in a toy application:

Cart #makefont-0 | 2019-12-03 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

P#70527 2019-12-03 13:03

Cart #nothing-1 | 2019-10-12 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
9

This is the game @Niarkou and I made for Ludum Dare 45 in 72 hours.

Ludum Dare entry page · GitHub source code

A few warnings about this version:

  • the ball does nothing
  • the cave is not implemented
  • there is no reward for watering the plants
  • there is no reward for the riddle
  • there is a large empty area at the east

We want to work on the game and improve the story when the Ludum Dare voting period is over. Hope you already enjoy it as it is now, though!

P#68785 2019-10-12 10:55 ( Edited 2019-10-12 11:01)

When saving to .p8.png, PICO-8 flattens the #include directives. But it does not do that with the HTML exports, resulting in broken exports:

Is there an option I may be missing?

P#64108 2019-05-01 22:33

Cart #findingcookie-1 | 2019-04-30 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

Ludum Dare entry for this game

Grandma is on yet another quest to find her beloved Cookie and save a few other stray cats on her way.

Controls: arrows to move, Z to shoot

This is a rogue-like game project by @Niarkou and me. We started it for Ludum Dare 44 and ran out of time, but we will continue working on it!

P#64091 2019-04-30 12:50 ( Edited 2019-04-30 22:58)

It may be a side effect of fixing the peek4() CPU cycle exploit, but now all “adjusted” functions seem to cost the same as if they were standard Lua API calls.

The following program used to run at 21.6% CPU on 0.1.11f. Now on 0.1.12b it runs at 64.5% CPU!

function _draw()
  cls()
  local i = 0
  for j = 0,10000 do i = bxor(j, shl(i, 3)) end
  print(tostr(stat(1)*100).."% cpu", 2, 2)
end
P#63577 2019-04-16 14:46 ( Edited 2019-04-16 15:03)

It’s now possible to include .lua files, but PICO-8 seems to be very confused when they have CRLF line terminators, reporting syntax errors at weird locations.

Note that including .p8 files with CRLF line endings works just fine, but not if they have an UTF-8 BOM ( @Niarkou reported this a while ago: https://www.lexaloffle.com/bbs/?tid=31617). To summarise:

  • .p8 with UTF-8 BOM: fail
  • .p8 with CRLF: OK
  • .lua with UTF-8 BOM: OK
  • .lua with CRLF: fail

It’s not unusual to have CRLF line endings, even unwillingly; for instance, if I push a .lua file to Git from a Linux box (with LF line endings) then pull the file on Windows, by default it magically gets CRLF line endings. This can be configured but it may confuse users.

P#63569 2019-04-16 07:17

The function peek4() does not properly check its number of arguments, so calling it with no arguments will cost zero cycles. Combined with any other function that costs fewer cycles than its number of arguments, such as shl(), this can be exploited to reclaim CPU cycles.

Here is a function that reclaims n cycles:

function reclaim(n)
  for i=0,n/5 do
    shl(peek4(),peek4())shl(peek4(),peek4())
    shl(peek4(),peek4())shl(peek4(),peek4())
    shl(peek4(),peek4())shl(peek4(),peek4())
  end
end

I do not know to what extent this can be exploited, but here is an example.

The following program runs at 15 FPS:

function _draw()
  for y=0,127 do
   m=3+rnd()
   for x=0,127 do pset(x,y,(x+7)*m%5) end
  end
  print(stat(7).." fps",1,1,7)
end

But this one runs at 30 FPS:

function _draw()
  for y=0,127 do
   m=3+rnd()
   for x=0,127 do pset(x,y,(x+7)*m%5) end
   reclaim(200)
  end
  print(stat(7).." fps",1,1,7)
end
P#60203 2018-12-21 14:20

Cart #dancer-0 | 2018-12-21 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
8

106 frames of animation, compressed and embedded in the cart (half in the code, half in the gfx segment).

P#60202 2018-12-21 13:46

I have started measuring function costs precisely, because I like accurate things. It’s all on the wiki but not fully complete.

Here are a few funny things I already learned:

  • <code>x^.5</code> costs 16 cycles, whereas <code>sqrt(x)</code> costs 27
  • <code>x^4</code> costs 8 cycles, but <code>x*x*x*x</code> only costs 3

Some of these, such as clipped <code>circ()</code>, are pretty tricky to measure, I hope someone can help!

Edit: removed claim about shl() because that function behaves a bit differently.

P#60180 2018-12-20 18:06 ( Edited 2018-12-20 21:36)

Cart #calculator-0 | 2018-12-05 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

Just a work in progress. The parser is not perfect but it needs a lot of work.

P#59724 2018-12-05 19:01

This code does not work (unexpected symbol near 'then'):
if (x == "\\") then print(x) end

But this works OK:
bs = "\\" if (x == bs) then print(x) end

P#59713 2018-12-05 14:31

Cart #rainbow_cats-2 | 2018-12-04 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
7

Your kittens are in danger! How could they survive in such a crazy world?

You must return them home safely. Select the color of the kittens you wish to call and they will follow you everywhere.

Controls:

  • Navigation and player controls: arrows
  • Call your kittens: X
  • Validation and jump: Z or W

This is the entry for Ludum Dare 43 we made with @Niarkou.

P#59669 2018-12-04 13:08 ( Edited 2018-12-04 16:55)

Cart #59084 | 2018-11-16 | Code ▽ | Embed ▽ | No License

This is my entry for #TweetTweetJam: an unfinished shooter, in about 530 characters of code.

Left/right to move, X to shoot.

It has music and SFX and many things but no actual gameplay.

Jam entry page: https://itch.io/jam/tweettweetjam/rate/331412

P#59086 2018-11-16 18:06 ( Edited 2018-11-16 23:44)

I noticed that if there is a file named "splash.png" in PICO-8’s directory, it will be displayed at launch before the boot sequence. This also works with cartridges exported as binary.

P#55229 2018-08-16 04:20 ( Edited 2018-08-26 15:28)

My love Niarkou and I made this for Ludum Dare in 72 hours!

Objectives: Feed your cats by filling their bowls. The more they eat, the more points you get! But too many cats and you will run out of space.

Controls:

  • Pause: P or Enter
  • Navigation / Player controls: ◀ ▲▼ ▶
  • Menu validation / Take something / Pour something into the bowl: W / Z
  • Throw away something: X

LDJam link: https://ldjam.com/events/ludum-dare/42/cat-lady-simulator

P#55104 2018-08-13 19:47 ( Edited 2018-08-23 11:44)

I was working on this a while ago and haven’t found much time for it lately, but I thought it could be interesting to some people. It is a fork of Lua that implements the PICO-8 dialect.

Why?

If you know how to embed Lua somewhere, then there are chances that you can embed PICO-8 compatible Lua instead! I use it for an unfinished toy emulator project.

Features

  • short if syntax (on one line)
  • short print syntax (? at the beginning of a line)
  • compound assignment operators: += /= etc.
  • C style not equal operator: !=
  • C++ style comments with //
  • fixed-point arithmetic with overflows, infinity etc.
  • the PICO-8 math library (shr, atan2, flr etc.)
  • binary literals: 0b1001001.10010
  • works in Windows and Linux, and probably in OS X too

How?

The usual approach to the language extensions is through code parsing and patching. For instance, replacing all occurrences of <something>+=<blah> with <something>=<something>+(<blah>). This is what PICO-8 itself does, which is why it still has the occasional weird parsing issues (you can write x=0y=1 but not x+=0y=1). My approach is to implement these extensions in the Lua parser instead, which is elegant, more robust, and gives better error reporting.

Where?

It’s on GitHub: https://github.com/samhocevar/z8lua

Example

Here is a z8lua session in my terminal; you can see familiar PICO-8 syntax in here:

P#54527 2018-07-30 07:38 ( Edited 2018-07-30 11:38)

We made this game over the weekend as some practice for Ludum Dare. It is named after one of our cats.

Controls: left/right to move, X to fire.

P#54522 2018-07-29 17:18 ( Edited 2018-07-30 06:00)

Cart #47450 | 2017-12-16 | Code ▽ | Embed ▽ | No License
9

I was working on this during Ludum Dare 39 (4 months ago) but never got the courage to finish it… maybe one day!

P#47451 2017-12-16 17:17 ( Edited 2018-01-26 01:01)

Cart #46976 | 2017-12-04 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
13

Made for Ludum Dare. It’s 2 minutes before the deadline, I need some sleep now.

P#46977 2017-12-03 20:59 ( Edited 2017-12-10 16:02)

Cart #33419 | 2016-12-13 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
24

A mini adventure game.

This cartridge extensively abuses Lua memory, lossy zlib compression, data-stored-in-code, and dget to render a 600×252 image with pixel-perfect scrolling. This is more a tech demo but I ended up doing a full mini game for Ludum Dare 37.

I’ll write a postmortem to explain all the hacks.

P#33420 2016-12-12 22:29 ( Edited 2017-10-03 14:49)

View Older Posts
Follow Lexaloffle:        
Generated 2019-12-09 13:19 | 0.304s | 2097k | Q:192