Log In  
BBS > Lexaloffle Community Superblog
This is a combined feed of all Lexaloffle user blogs. For Lexaloffle-related news, see @zep's blog.

All | Following | PICO-8 | Voxatron | General

Patito Hulk 3: The game

Cart #patitohulk-0 | 2022-01-12 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

P#104903 2022-01-12 17:34

Cart #boids8_19-0 | 2022-01-12 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

A simple boids simulation. You can open it in the editor to tweak the settings even further

there are no controls in this cart, but you might want to turn off carts in the menu

P#104897 2022-01-12 16:18

Cart #jowapoziki-2 | 2022-01-13 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
10

Inspired by Porklike by @Krystman

HELLCUBE is designed as a disposable arcade-ish roguelike game, basically as a "5 minute game", trying to offer a fast, but hopefully intense and fun gaming experience; Hope you enjoy :D

P#104886 2022-01-12 14:56 ( Edited 2022-01-16 07:40)

~ hey <INTERN NAME>
~ be careful when you boot your computer this morning
~ I left a cartridge in the slot: Intermediate Ideocartography
~ it’s kind of dangerous, but <REDACTED> did the same for me when I was an intern, and I think it’s a major reason why I survived here
~ you have to be willing to take risks
~ some notes about the cart:
~ a. it’s more complicated than the Beginner cart. You can use the arrow keys to move the map directly, gives you more control
~ b. you can also hop from seed to seed in the metalayers, use the mod key (Z) AND the arrow keys to do that
~ there’s an entropy network in place to prevent seed adjacency
~ you’re going to be frustrated but it’s for your protection
~ you can still get to any seed, just some are difficult
~ <REDACTED>
~ <REDACTED>
~ c. now the X button takes screenshots by default, but also saves a gif if you hold the mod button
~ d. you can press enter to get to a menu that lists the controls as well, now that text is permitted that kind of <REDACTED>
~ happy hunting, and be safe!
~ PS: if you find any <REDACTED> in there, msg me directly ASAP

Cart #intermed_ideocart-0 | 2022-01-12 | Code ▽ | Embed ▽ | No License
5


License: cc-by-4.0
https://bafybeigp4iylbriyjg7mpzpslrw42tqoqtmj2265ucd3xmwppvxvxfig74.ipfs.infura-ipfs.io/

creator: Andrew E. Brereton
date: 2022-01-12
twitter: @aebrer
website: aebrer.xyz

P#104880 2022-01-12 13:21

The typical external editor workflow keeps a .p8 file open in both PICO-8 and a text editor. The author edits code in the text editor, saves the file in the editor, then presses Ctrl-R in PICO-8 to reload and run the new version. The author also edits sprites, map, sfx, or music in PICO-8, saves the file in PICO-8, then reloads in their editor (automatically in some editors).

To prevent a potential accident, PICO-8 has a failsafe that blocks Ctrl-R with a warning message if it detects that the cart has changed in memory since the last time it was saved from PICO-8 and the file on disk has been updated by an external editor. PICO-8 makes no further attempt to help resolve the merge conflict: it's up to the author to rescue the external edits, save the cart from PICO-8, then re-apply the edits.

This failsafe considers the entire cart—code, graphics, sound—as a single document for this purpose. This makes triggering the failsafe common in the typical workflow: even when the author uses the external editor exclusively for code and the internal editors exclusively for art, failing to save changes in one before making changes in the other will block reloads.

I don't expect PICO-8 to merge two sets of changes to the same section, but it seems like it would be an improvement if PICO-8 can do dirty data detection on each section individually, or perhaps just "code" and "everything else." If PICO-8 has unsaved changes only to non-code and the file on disk has changes only to the code, Ctrl-R can silently load just the new code from disk and preserve non-code changes in memory.

Sound good? Anything I'm missing?

P#104866 2022-01-12 04:04

Cart #orbit_dasher-1 | 2022-01-12 | Code ▽ | Embed ▽ | No License
8

In this arcade-style game, you need to collect all the items (blue circles) and avoid the enemies (red circles) in a circular stage to move to the next one. To do this, you need to move not only from left to right, but also dashing from one side of the stage to the other, which can be done with the O Button/Z Key. Try to clear as many stages as you can!


Controls:

  • Left/Right - Move
  • O Button/Z Key - Dash/Start

Thanks to the PICO-8 Discord server for all of the help and feedback!

P#104864 2022-01-12 01:54 ( Edited 2022-01-12 15:52)

Hey, how do I actually start this? I have PAID for the Pico-8 but I cannot see any obvious way to begin. Help anyone?

P#104841 2022-01-11 23:07

Cart #aerialrave1_0-2 | 2022-01-11 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

Final jam submission is here on the bbs! The "office" tutorial should hopefully teach how the game works, and address some of the problems people have been having figuring out the game. I've had very little time to playtest it (being a jam and all) so if anything still isn't clear or if you don't like something I'd like to hear your criticism!

P#104834 2022-01-11 21:23 ( Edited 2022-01-11 21:27)

I made a tool to launch your favorite games,
check it out here:
https://www.lexaloffle.com/bbs/?tid=46049

P#104813 2022-01-11 14:24

Rare Monster Truck

A monster truck game with an ordinary name

This one is mostly aimed for kids and mostly designed and named by a 5 year old, meaning low on challenge but still enough for a bit of fun. Plus who doesn't like monster trucks.

Like my ghost game, the truck IP is totally original. Any similarities with real life trucks is purely co-incidence.

Now start your engines and get to crushing.

Cart #rare_monster_truck-0 | 2022-01-11 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6

P#104804 2022-01-11 09:06

Cart #ssc_b0b98_1-0 | 2022-01-11 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

Controls

Z roll the dice
X stop rolling the dice/Continue
(i'm just now realizing how incredibly counter intuitive is to use stop and continue on the same button)

Ship captain crew is a dice game, I learned at a bar.

It can be a drinking game, but I've never played it that way (though I have always been drinking when I played it) I only know it as a basic very short gambling dice game.

The rules are pretty simple. But kinda hard to explain.

you are trying to get a 6(the ship) a 5 (the captain) and a 4 (the crew).

You roll all five dice, if you get a six you take it out and set it aside, same for five and four. Eventually you'll only have 2 dice left. These are your score (sometimes called cargo) you want the highest score.

The catch is that you have to get 6,5,4 in order.

For example if your first roll is 5,5,4,3,2 you get nothing. You must re-roll all dice. You cannot have a captain or a crew without a ship.
You re-roll and you get 6,4,4,3,3. You take the six and set it aside. You can't take one of the fours. You can't have a crew without a captain.
your final roll! 5,4,3,5. You take a five and set it aside then the four. You have eight points.

You could also get lucky, and on your first roll get 6,6,6,5,4 and suddenly have 12 points and stop right there.

  • the current highest score is called the point number.

  • Always keep rolling until you at least tie the point number.

  • You cannot re-roll only one of your final 2 dice. (its easier to code, but it's also the rules, at least at my local bar that plays it)

  • In case of tie no one wins. The money stays in the pot, everyone who wants a chance at it pony's up another buck and you go again.

This game should follow the rules as I understand them. They might be regional, I've seen others online claim that in case of tie the people who are tied play against each other, but I like the "let it ride" approach. I've seen a game of roughly 10 people end up with about 50 dollars in the pot due to consecutive ties.

Also the winner starting the next round might be regional, i've seen online people saying it rotates, but starting is actually a disadvantage (it's better to go later) so I think it makes sense for the winner to start.

I might change the rolls to display how many rolls you have left. I'm not sure that'd be better.

I hope to add some weird role playing elements like a luck score that will make dice rolls work out better for you, and also make the CPU players behave differently and have their own luck scores.

Also I want a nice random-ey looking dice rolling animation

P#104802 2022-01-11 08:39 ( Edited 2022-01-11 09:07)

This follows the classic Stable Fluids paper by Jos Stam. Use your mouse.

Cart #simple_smoke-12 | 2022-01-13 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
11

A few things that would make this better:

  • More optimization
  • Higher resolution (if possible)
  • monotonic cubic interpolation for advection (likely too expensive)
  • MAC grid (NOPE - saves a lot of time to backtrace all quantities from cell centers instead. A MAC grid would mitigate some of the boundary artifacts here, but it's just too slow.)
  • vorticity confinement (expensive, but probably the next most important thing)
  • better smoke vis - bilinear interpolation? (almost certainly too expensive)
  • higher resolution for smoke than for velocity?
  • other forces: gravity / heat / etc.
  • better code quality (it's kind of a mess, sorry)

V0.1

  • Alternating Gauss-Seidel direction
  • Control number of pressure iterations with left/right
  • Some optimizations thanks to @freds72 (I'm loving the hack for newgrid)

V0.2

  • @freds72 pointed out a few more optimizations and bugs (thanks!)
  • Merged all advection together and integrated density decay - saves tons of CPU.
  • Got rid of velocity diffusion - this also saved lots of CPU.
  • Lots more micro-optimizations (pre-multiply dt, split up multiple assignments, treat fg/bg colors as a single unit, etc.)
  • Increased resolution due to all the optimizations! Formerly, at 30fps, this could do 20x20 at 9 pressure iterations. Now it can do 24x24 at 10 iterations.
  • Smoke gets introduced a little slower and fades a little slower.

V0.3

  • Sacrificed a little CPU (and a pressure iteration) for some tracer particles.

V0.4 (not posted yet)

  • More verbose CPU time breakdown if desired
  • Unroll pressure loop 4x to save about 6% CPU

Bonus GIF because it's neat: two vortex pairs approach each other, collide, vortices re-pair and move to the sides.

P#104799 2022-01-11 06:34 ( Edited 2022-01-15 03:10)

Cart #littleroot-2 | 2022-01-11 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6

Littleroot Town theme in PICO-8
It kinda sucks right now so I might keep working on it to make it more like the original

P#104797 2022-01-11 03:55 ( Edited 2022-01-11 04:10)

Pico Tower

Office Tower Simulator

Cart #tomuhikipi-3 | 2022-01-11 | Code ▽ | Embed ▽ | No License
11

What is this

Pico Tower is a tower simulator in the vein of a scaled-down SimTower or Project Highrise.
Build offices and provide needed services to earn money. Grow your tower and unlock more features as your tower grows in height. Experiment with layouts to optimize travel times for your tower's occupants.

Tips

  • Most rooms have an entranceway indicated by a yellow doorway. When building make sure this side is rotated to be accessible.
  • If a meeple is travelling, they aren't making money! Optimize travel times to make sure offices stay profitable.
  • If a meeple cannot find a nearby service they will eventually leave the building to meet their need elsewhere.
  • If maintenance requests are not addressed in a timely manner it will flash RED and reduce office income!
  • Check your finances tab. Upkeep expenses are paid at 10:00PM. Your cash can (and probably will) go negative at times!
  • Maintenance staff comes in at 4:00AM. Office workers at 6:00AM. Workday ends at 6:00PM
  • Leave space for expansion. One stairwell or elevator wont suffice forever

Meeple thoughts

Sometimes thought bubbles will appear over meeples' heads
[8x8]
Destination was full (Will leave tower after a few retries)
[8x8]
No nearby bathrooms
[8x8]
No nearby cafeteria
[8x8]
Could not find path to a destination

Commentary

This is my first PICO-8 cart. I predictably underestimated the token/compression limitations and had to cull many features I had planned, such as more services, office types, transport modes, and save files. Nonetheless I'm satisfied with the result as a tiny tower builder given the limitations.

P#104668 2022-01-11 03:39 ( Edited 2022-01-11 03:40)

what is this?

The wiki is nice for checking exactly how time-expensive various operations are, but it's a bit out of date. Also, it'd be nice to just be able to directly test two implementations against each other, rather than adding up how long each individual operation takes.

The wiki also has a code listing for a cpu profiler, but it's a bit hard to find if you don't know it exists. Plus, it was fun for me to dive in and double-check the math myself.

My profiler is pretty similar to the one on the wiki, although IMO mine has a nicer/simpler interface. Additionally, I've commented exactly how the cycle calculation works, which might be useful for other people to see:

-- slightly simplified from the version in the cart
function profile_one(func)
  local n = 0x1000

  -- n must be larger than 256, or m will overflow
  assert(n>0x100)

  -- we want to type
  --   local m = 0x80_0000/n
  -- but 8๐˜ฎ๐˜ฉz is too large a number to handle in pico-8,
  -- so we do (0x80_0000>>16)/(n>>16) instead
  -- (n is always an integer, so n>>16 won't lose any bits)
  local m = 0x80/(n>>16)

  local function cycles(t0,t1,t2) return (t0+t2-2*t1)*m/30 end
  -- given three timestamps (pre-calibration, middle, post-measurement),
  --   calculate how many more ๐˜ค๐˜ฑ๐˜ถ cycles func() took compared to nop()
  -- derivation:
  --   ๐˜ต := ((t2-t1)-(t1-t0))/n (frames)
  --     this is the extra time for each func call, compared to nop
  --     this is measured in #-of-frames (at 30fps) -- it will be a small fraction for most ops
  --   ๐˜ง := 1/30 (seconds/frame)
  --     this is just the framerate that the tests run at, not the framerate of your game
  --     can get this programmatically with stat(8) if you really wanted to
  --   ๐˜ฎ := 256*256*128 = 8๐˜ฎ๐˜ฉz (cycles/second)
  --     (๐˜ฑ๐˜ช๐˜ค๐˜ฐ-8 runs at 8๐˜ฎ๐˜ฉz; source: https://www.lexaloffle.com/bbs/?tid=37695)
  --   cycles := ๐˜ต frames * ๐˜ง seconds/frame * ๐˜ฎ cycles/second
  -- optimization / working around pico-8's fixed point numbers:
  --   ๐˜ต2 := ๐˜ต*n = (t2-t1)-(t1-t0)
  --   ๐˜ฎ2 := ๐˜ฎ/n := m (e.g. when n is 0x1000, m is 0x800)
  --   cycles := ๐˜ต2*๐˜ฎ2*๐˜ง

  -- calibrate, then measure
  local nop=function() end -- this must be local, because func is local
  flip()
  local atot,asys=stat(1),stat(2)
  for i=1,n do nop() end
  local btot,bsys=stat(1),stat(2)
  for i=1,n do func() end
  local ctot,csys=stat(1),stat(2)

  -- report
  local lua=cycles(atot-asys,btot-bsys,ctot-csys)
  local sys=cycles(asys,bsys,csys)
  local tot=lua+sys
  return {
    lua=lua,
    sys=sys,
    tot=tot,
  }
end

how do I use it?

You can try it here online, but to really use it you'll want to download it yourself and edit the body of the analyze() function. There are instructions embedded in the cart with more details:

Cart #cyclecounter-2 | 2022-01-16 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
5

misc results

poke4 v. memcopy

  profile("memcpy     ", function() memcpy(0,0x200,64)       end)
  profile("poke4/poke4", function() poke4(0,peek4(0x200,16)) end)

> memcpy : 7 +64 = 71 (lua+sys)
> poke4/poke4 : 7 +60 = 67 (lua+sys)

Copying 64 bytes of memory is very slightly faster if you use poke4 instead of memcpy -- interesting!
(iirc this is true for other data sizes... find out for yourself for sure by downloading and running the cart!)

constant folding

I thought lua code was not optimized by the lua compiler/JIT at all, but it turns out there are some very specific optimizations it will do.

  profile("     +", function() return 2+2 end)
  profile("   +++", function() return 2+2+2+2+2+2+2+2 end)

These functions both take a single cycle! That long addition gets optimized by lua, apparently. @luchak found these explanations:

https://stackoverflow.com/questions/33991369/does-the-lua-compiler-optimize-local-vars/33995520
> Since Lua often compiles source code into byte code on the fly, it is designed to be a fast single-pass compiler. It does do some constant folding

A No Frills Introduction to Lua 5.1 VM Instructions (book)
> As of Lua 5.1, the parser and code generator can perform limited constant expression folding or evaluation. Constant folding only works for binary arithmetic operators and the unary minus operator (UNM, which will be covered next.) There is no equivalent optimization for relational, boolean or string operators.

constant folding...?

One further test case:

  profile("tail add x3", function() local a=2 return 2+2+2+2+2+2+2+a end)
  profile("head add x3", function() local a=2 return a+2+2+2+2+2+2+2 end)

> tail add x3 : 2 + 0 = 2 (lua+sys)
> head add x3 : 8 + 0 = 8 (lua+sys)

These cost different amounts! Constant-folding only seems to work at the start of expressions. (This is all highly impractical code anyway, but it's fun to dig in and figure out this sort of thing)

update the wiki?

I have not updated the CPU page on the wiki; it's a bit hard to pin down exactly which operations take cycles, and I would personally rather use a tool like this to compare two potential implementations.

But, just so you're aware, the wiki is definitely out of date; when I ran the wiki's cpu profiler on pico-8 0.2.4, it produced different results. (I put a summary of the raw differences here)

credits

Cart by pancelor.

Thanks to @samhocevar for the initial snippet that I used as a basis for this profiler!

Thanks to @freds72 and @luchak for discussing an earlier version of this with me!

changelog

v1.1

  • added: press X to copy to clipboard
  • added: can pass args; e.g. profile("lerp", lerp, {args={1,4,0.3}})

v1.0

  • intial release
P#104795 2022-01-11 03:31 ( Edited 2022-01-16 06:34)

Cart #sidijafizo-1 | 2022-01-11 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
5

Hello and thank you for taking you time to look at this post. Please try out my first little game. Be gentle lol. it's just a day at the park with my dog Zelda playing fetch.

P#104770 2022-01-10 20:59 ( Edited 2022-01-11 05:15)

Cart #map_col142-0 | 2022-01-10 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
7

This is an open-source cartridge/engine with map collision, player movement, and map scrolling. (206 tokens in total)

P#104766 2022-01-10 20:40 ( Edited 2022-01-10 21:20)

Cart #duwifisora-0 | 2022-01-10 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

P#104761 2022-01-10 19:18

Cart #tipapeks-0 | 2022-01-10 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

P#104760 2022-01-10 19:12

One post, two topics -- but I figured they are mildly related here since it's really up to zep in both cases :D

I know it's a long shot, but is there any chance of getting a port of PICO-8 to MIPS? Specifically, I want to be able to use my Abernic RG280V to play PICO-8 games on the Adam image (https://www.youtube.com/watch?v=kdIdiQ-dO_Y).

Second topic. Is official Apple Silicon (aka ARM64) support on the roadmap for the Mac version? I know the Intel version runs just fine under Rosetta, but there is still downsides to running Intel code on these machines, like additional memory and battery usage. Plus it future proofs things a little for the eventual (still years away) removal of Rosetta by Apple in a future OS update.

P#104758 2022-01-10 19:06
View Older Posts
Follow Lexaloffle:        
Generated 2022-01-24 00:34:41 | 0.160s | Q:95