Hey PICO-8 people! Builds for 0.1.12 are now live on Lexaloffle and Humble. UPDATE: PocketCHIP users can get it here.
If you just want to see what's new, please scroll down a bit. But first of all, I should issue a..
Breakage Warning!
Future Compatibility: You'll need to update to 0.1.12 to play cartridges made in 0.1.12 or later. This update is another attempt at eternal future compatibility (can handle any future carts). There were a few bugs in 0.1.11g that needed a cart version bump to fix, and so I also took the chance to tweak the API (more on that below).
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 |
Hi !
I'm working on a game project since several months.
The player moves in a dungeon in top view, like a 2D zelda, generated randomly.
He must find a treasure randomly placed while avoiding the boss who will chase him from the moment the player is too close to the room where the treasure is.
Currently, I find myself a little blocked by the limitations in the code. Also I would like to separate the game into two cards. A first will take care of generating the dungeon, the location of the rooms, etc.
And the second for the gameplay.
Basically, to use the gameloop model, a cartridge will be used for the _init () function, say "init_dungeon.p8".
But the question is: is it possible?
Knowing that my game elements (dungeon, player, boss, treasure, etc.) are tables integrating functions, is it possible to transfer this from one cartridge to another?
I'm thinking of the cstore function for example:
cstore (0x4300, 0x4300, 0x1aff, "game_dungeon.p8") [ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=63573#p) |
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.
When loading a file via #include, pico-8 crashes when running the program from the command line, like "run".
The code loaded is tested and used correctly and does not cause the crash. Also, running via Ctrl+R works and behaves as expected.
Editor:
Result:
#include multi.lua m=multi(0,17) m:draw(10,10) -- this works when run with ctrl+r -- it crashes when running with "run" |
multi.lua
local multi = {} multi.__index = multi setmetatable(multi,{ __call=function(cls,...) return cls.new(...) end } ) local function getxy(index) local y = flr(index / 16) local x = index - y * 16 return x,y end function multi.new(tl,br) local self = setmetatable({}, multi) local tx,ty = getxy(tl) local bx,by = getxy(br) local w = bx - tx + 1 local h = by - ty + 1 self.tx = tx self.ty = ty self.bx = bx self.by = by self.w = w self.h = h return self end local function getindex(x,y) return x + y * 16 end function multi:draw(x,y) for u=0,self.w - 1 do for v=0,self.h - 1 do local index = getindex(self.tx + u, self.ty + v) spr(index, x + u * 8, y + v * 8) end end end |
It also would be great, if the folder for includes was the same folder as the cartridges (AppData).
In ROBLOX I am also learning how to code, but one thing stands out that I feel should be necessary.
What is supposed to happen is that it runs:
function _init() cls() spr(192,20,20,4,4) wait(3) end |
But it errors with
"Runtime error line 4 tab 0
wait(3)
Attempt to call global 'wait' (a nil value)
In _init line 4 (tab 0)
At line 1 (tab 1)"
Is there a way to make the program wait a few seconds without taking too much space?
Thanks :)
Made this game over the course of 2 days. I wanted to make something simple so I could familiarise myself with Lua so I made this. The best part is no matter where it spawns it will always hit the corner! Hope you guys enjoy. (Pls leave a star, I'd appreciate that :D)
Edit: Thank you so much for leaving such nice words about my game.
Update: Fixed a bug where if it spawned at x83 and moved right then it would clip out of the map.
# Picotéras
by Fuchikoma71
Introduction:
As Eriban, fellow Pico-8 developer and code optimiser extraordinaire (very much unlike me) once observed, I have a habit of creating the completely wrong kind of Pico-8 games: slow-paced, physically accurate, complex and austere simulators. Picotéras is the latest in this slowly extending line of misfits.
I have long held the ambition of creating some sort of 4X analogue in Pico-8. However, it quickly became obvious that compromise would be necessary to make it playable. I ended up keeping the gigantic scale, every game spanning centuries (or even millenia) and dozens of star systems, but simplifying the core mechanics of the genre.
The changelog for v0.1.11c (from a year or so ago) says:
> Added: F11 to toggle fullscreen
...but F11 has never actually worked in any version of PICO-8 so far, to my knowledge. Alt + Enter is still the only way to do fullscreen.
So I'm just making a bug report to track this, and as a reminder in case a fix might make it into 0.1.12b or something ;)
Hello,
Recently grabbed the latest version 0.1.12 on macos. I noticed that after editing on an external text editor, attempting to reload the cart with cmd+r caused PICO-8 to completely crash and quit.
It seemed to only happen if the cart.p8 file had been changed in someway. cmd+r works fine without edits.
Anyone else having this issue?
As the title says; music playback is clipping and causing distortion since upgrading to 0.1.12
I've tried rectifying the problem by setting music_volume to 128 (which is what I had previously always had it set to), but the music_volume value in the config.txt file gets reset to 256 every time Pico-8 is closed.
While poking around with Pico8, I discovered a way to simulate char and unsigned char types.
-- tochar -- --[[ this function converts a value to make it emulate a char (256 max characters) it can emulate signed and unsigned chars. the value will not go beyond 0-255 if unsigned, and if signed the values will remain at -128 to 128. tochar returns a signed char and touchar returns an unsigned char. tochar(variable) touchar(variable) see sample; --]] function tochar(id) local res=id%256 return flr(res) end function touchar(id) local res=((id-128)%255)-127 return flr(res) end --sample number=1428 print(touchar(number, true)) |
Theres the code snippit, put it in and play with the sample.
info about it is in the code;
enjoy for anybody wanting to make char variables for what ever your reasons might be.