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 | Off-site
:: Unfold ::

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

Barnsley Fern https://en.wikipedia.org/wiki/Barnsley_fern

Tweetcart version:

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

P#121675 2022-12-01 16:24 ( Edited 2022-12-01 16:25)
:: Unfold ::

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

P#121671 2022-12-01 14:23
:: Unfold ::

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

Feature Overview

BPACK() pack the value of the bit specification with bit width.

  • By packs in the direction of low bits when multiple bit values are specified.
  • By setting [number s] to a negative value, bit pack can be started from the decimal point.
  • If there are fewer bit-width elements relative to the value to be packed, the bit-width elements are rotated.
  • This function consumes 37 Token.
v=bpack({8,4},0,0xff,0xb)
?tostr(v,1) -- 0x00ff.b000 (bit-left-shift:0)

v=bpack({8,4},8,0xff,0xb)
?tostr(v,1) -- 0xffb0.0000 (bit-left-shift:8)

release note


v0.1

  • first release
P#59572 2022-12-01 13:18 ( Edited 2022-12-01 13:54)
:: Unfold ::

This is probably a huge request, but it would be super useful for me.

Nowadays, most of my Pico-8ing takes place on pico-8-edu.com on a school-issued chromebook. Which means it's bad. It randomly decides to sign me out, reload tabs, and/or clear my downloads folder. So I have to backup all my projects to Github daily or I risk losing my project. My friend @Ummmm_ok lost progress on like 3 games he'd been working on when his tabs reloaded and hadn't backed up in a while (he has the same situation as me).

It would be extremely nice (in my opinion) if the education edition worked a bit more like Scratch, where the projects are linked to an account and saved in the cloud. That way, it wouldn't be as much work to back it up all the time.

Perhaps there would just be a button in the top right corner with your username and profile picture. When you click it, it gives you a list of all carts saved on your account. Then you can click one to load it. It would autosave like every 30 seconds or so, or alternatively you'd have to manually save like it is currently.

Again, this would probably be pretty hard to do, but it would be super handy.

P#121656 2022-12-01 02:11
:: Unfold ::

Cart #starjump_pico_cover-2 | 2022-11-30 | Code ▽ | Embed ▽ | No License
4

i did a cover of starjump from Celeste for @ooooggll and thought i should put it here :)

i quite love love love starjump but couldn't do it justice (especially the baseline, anxiety parts) but whatever hope you like it.

P#121651 2022-11-30 23:39
:: Unfold ::

No, it's not a duolingo demake.

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

It's a simple demake of Duet, a (primarily) mobile game by Kumobius. Made in about 2 days.
Also featuring auto-generated levels! Yay! Let me know your highscore (or when you gave up because you were bored).

P#121646 2022-11-30 23:15
:: Unfold ::

Cart #shapeofmind-0 | 2022-11-30 | Code ▽ | Embed ▽ | No License
25

Arrow keys - Move cursor
(X) - Confirm, pick up pieces, drop pieces
(O) - Cancel
Enter - Menu

​Shape of Mind is a simple puzzle game similar to Solitaire card games. Connect shapes by dragging them on the board. Shapes of the same color won't connect. You can move strips of connected shapes by grabbing the top-most shape of a strip. Drop shapes onto the Dreamer to begin a Halo. Shapes in the Halo cannot be removed. Once a Halo is complete the shapes will disappear. Complete three Halos to clear all the shapes and win the game!

About

​This game was created as part of the A Game By Its Cover Jam 2022​. The goal was to create a game based on of the cartridge covers from the Famicase Exhibition 2022​. The cover to Shape of Mind was created by Agustin Crisostomo​.​

The game was written and designed by Krystian Majewski​, an Independent Developer and the host of the Lazy Devs Academy video channel​. The entire development process was livestreamed.

The music was composed by Gruber Music​.

The game is written entirely in Pico-8.

P#121642 2022-11-30 22:25
:: Unfold ::

Cart #calcinp8-0 | 2022-11-30 | Code ▽ | Embed ▽ | No License

calculator in pico 8!

this was pretty fun to make!

hope you enjoy!

[32x32]

instructions on how to use are shown when you play it!
the code is heavily commented for "ease of access" and "peace of mind" so that you can edit it if you want
this was
have fun mathing!

thank you so much for all the support! i love this community so much and i am grateful of how kind and accepting it is! thank for for all the support on my last project:"celestenograv" and the feedback! i hope you all have a wonderful day! have fun out there!
--antibrain

P#121633 2022-11-30 20:00
:: Unfold ::

Cart #knutil_bunpack-2 | 2022-11-30 | Code ▽ | Embed ▽ | No License

Feature Overview

BUNPACK() slice the value with bit width.

  • By specifying the argument after [number w], a value of up to 32 bits can be sliced.
  • By setting [number s] to a negative value, bit slice can be started from the decimal point.
  • This function consumes 30 Token.
a,b=bunpack(0xf8,4,4,4) -- Value, First bit-shift, bit-width, ...[bit-width]
?a -- 15 (0xf)
?b -- 8 (0x8)

release note


v0.1

  • first release
P#121616 2022-11-30 12:12 ( Edited 2022-11-30 12:37)
:: Unfold ::

Cart #tuyizubuso-1 | 2022-11-30 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

Hello friends ! this is the second episode of the Aliens invaders saga !

I hope you can have some fun !

Enjoy !

P#121607 2022-11-30 07:26 ( Edited 2022-12-01 04:56)
:: Unfold ::

stars={}
for s=1,10do
add(stars,{x=128,y=128,spd=rnd(3)})
end
for i in all(stars)do
i.x-=i.spd
pset(i.x,i.y,7)
end

hey! super quick and basic question, feel like ive definitely done this before but i am just not thinking hard enough rn but why isn't this working? no errors are being thrown so i feel like im definitely forgetting something super basic thats making it all break but i am still a beginner and can't seem to figure out what. ty for any help!

P#121581 2022-11-29 21:16
:: Unfold ::

I purchased the bundle of Pico-8 and Voxatron earlier this year, but have since lost my download key in an email purge. I realize now that I never created an account to link to it. Is there any way for me to recover my info so I can re-download them? I emailed the support email a few times, but haven't heard anything back.

P#121576 2022-11-29 20:11
:: Unfold ::

Cart #vector_p8-1 | 2022-11-29 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

vector.p8

A simple and lightweight (in tokens) vector math library for PICO-8. This library contains no error handling at all. It's a side effect of keeping it low in tokens, so you're gonna have to be responsible of whatever goes in.

Usage:

  • load #vector_p8
  • Save as such: vector.p8.
  • Remove all the demo code; it's in the second tab.
  • #include in any cart you want.

Functions within:

Creation and management

vector(x,y,z) - The function. Vectors are just normal Lua tables with x, y and z fields, so you can pass any table that contains x, y and z to any of the functions and it'll work just fine.

v_polar(length,angle)- Makes a vector using polar coordinates.
v_rnd() - Gives a normalized vector with a random direction.

v_cpy(v) - Copies a vector.
v_unpck(v) - Unpacks a vector.
v_arr(v) - Returns a vector as an array of the 3 components that comprise it. Ignore the third value (Z) if your vector is a 2D one.
v_tostr(v,d) - Turns a vector into a string. The d parameter is used to know if it should be printed as a 3D vector or not.
v_isvec(v) - Checks if a certain value is a vector.

Actual math

v_add(a,b) - Adds two vectors of any dimension.
v_sub(a,b) - Subtracts two vectors of any dimension.
v_scl(v,n) - Scales a vector by a scalar (normal number).
v_mul(v,n) - Alias for v_scl.
v_div(v,n) - Scales a vector by the inverse of a scalar ("divides" the vector).

v_dot(a,b) - Computes the dot product of two vectors.
v_cross(a,b) - Computes the cross product of two 3D vectors.
v_magsq(v) - Computes the magnitude squared of a vector.
v_mag(v) - Computes the magnitude of a vector.
v_dstsq(a,b) - Computes the distance squared between two vectors.
v_dst(a,b) - Computes the distance between two vectors.
v_norm(v) - Normalizes a vector.
v_perp(v) - Gets a 2D vector perpendicular to the passed one.
v_sprj(a,b) - Returns the scalar projection of one 2D vector in another.
v_proj(a,b) - Returns the actual projection of one 2D vector in another.

Rotation related functions

WARNING! None of these functions work with 3D vectors. When passing in 3D vectors, the result will always be 2D. All these functions work with revolutions according to PICO-8's convention.

v_rot(v,t) - Rotates a vector by an angle t.
v_ang(v) - Gets the direction a vector is pointing towards.
v_atwds(a,b) - Gets the angle needed to point towards.

Miscellaneous

v_lerp(a,b,t) - Linearly interpolates two vectors.
v_eq(a,b) - Checks if two vectors are equal.

Constants

WARNING! Because of the way Lua tables work, do NOT use compound assignments to alter a variable if you directly assign one of these constants to it. Either copy the constant using v_cpy and then assign that to the variable or use one of the functions within the library (all but v_be*d) to manipulate it.

v_right - Rightwards pointing vector.
v_left - Leftwards pointing vector.
v_up - Upwards pointing vector. Y points downward in 2D so this vector points towards -Y.
v_down - Downwards pointing vector. Y points downward in 2D so this vector points towards +Y.

v_above - 3D vector pointing upwards. Unlike 2D, Y in 3D points upwards, so this vector points towards +Y.
v_below - 3D vector pointing downwards. Unlike 2D, Y in 3D points upwards, so this vector points towards -Y.
v_front - 3D vector pointing forwards.
v_back - 3D vector pointing backwards.

v_zero - Zero vector. All components are set to 0.
v_one - Identity vector. All components are set to 1.

v_cntr - Utility vector pointing towards the center of the screen, i.e. [64,64].

Changelog

v1.1 (09-11-2022):

  • Removed all dimension related functions.
    Consequently, a parameter was added to v_tostr for it to know how to format the output.
  • Added v_sprj and v_proj.
  • Renamed v_center to v_cntr.

v1.0 (09-11-2022):

  • Initial release
P#121553 2022-11-29 14:31 ( Edited 2022-12-01 03:24)
:: Unfold ::

Cart #gubegimofi-0 | 2022-11-28 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

P#121549 2022-11-28 22:53
:: Unfold ::

Cart #naharana-0 | 2022-11-28 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

P#121509 2022-11-28 03:53
:: Unfold ::

I'm going to start with my general understanding and label questions [Q#] with the hope someone can fill in the blanks. Consider the discussion of 'cost' in terms of speed/cpu. I'm hoping there's a general concept I'm missing that will cleanup the flurry of questions around [Q2], regardless please bear with me:

General code is written topdown like the below where you define the function at the top and then you can simply call said function below that point to access the block inside. I don't fully understand the cost, in terms of lua itself, associated with defining 'function a()end' (the pico8 wiki has general pico8 cycle costs). My understanding though is the program won't look inside of the function 'until' I call it and so there is simply some generic predefined 'base cost'(cpu cycles) to defining a function and this cost is not affected by the number of parameters or whatever is inside the function....tldr it's always a flat cost each time the compiler/better-word runs down that part of the page and sees you want to define a function. So this usually amounts to the general idea of 'define the function once at the top of the code' and then call it as many times as u need where u need to after:

function a()end
for i=1,100 do a() end
--vs: for i=1,100 do function a()end a()end; defining the same function 100 times is bad.

However, the defining of function, like most parts of lua, can be optimized through the limiting of its scope. Again my understanding of scope is limited(puns), but as a functional explanation it amounts to 'smaller scope of an item = less cpu cost of the item'. Turning functions local makes it apply to 'just the' remaining part of the block it is currently in, and you can further limit the scope of a larger block with 'do end'.

--code above--
do 
local function a()end
for i=1,100 do a() end
end
--code below--

I think I got the general idea above. My main confusion lies when you toss the idea of a gameloop into this picture. I'm assuming there is no secret difference to how _update() and _draw() handle functions outside of the idea _draw() might skip frames, so Let's take the example below which seems to be how most games orient things. My understanding in pico8 being: everything runs top-to-bottom 1x at the start of a game(unless I'm doing function calls in the middle of the ocean, the stuff in the functions will not be run yet)....then everything inside _init() runs 1x...then everything inside _update() and then _draw() runs over and over xx times per second.

function _update()a()b()end
function a() end
function b() end

If we wanted to define the above functions as local, the next example below shows the change in order necessary to do so...and there seems to be no change in cost(ctrl+p testing values in pico8) between a local function a() or global function b()...since they seemingly have the same level of scope and are only defined 1x each (is my understanding as to why). [Q1] So that trope I hear from the love2d community and sometimes in pico8 to 'just redundantly define everything as local' is wrong....but doesn't inflict penalty.... so it's really just a habit builder to protect against mistakes where u otherwise would find benefit from limiting the scope...?

local function a(x) return x^4 end
function _update()for i=1,10000 do a(10)b(10)end end
function b(x) return x^4 end

Okay so we now have base cases for gameloop and nongameloop above. So Let's look below where the cases overlap. In these situations I'm left confused and often wondering if there is some kind of benefit to 'defining the function within a block within the gameloop'... or just to revert to the above where u toss the function outside everything with all the other global functions..aka where it only gets defined 1x at the start of the game and never again. Take this info() example:

function _draw()info()end
function info()
if time()==2 then print("<5")end
if time()==3 then print("<5")end
if time()>5 then print(">5")end
end

[Q2]Let's say I wanted to keep everything in this truly horrible format, but create a function for the redundant print("<5") blocks. If the function I want to use is: function p()print("<5")end
Which (A/B/C/D/?) position should I use to define function p()... and why?

function _draw() 
--D) local function p()print("<5")end
info()
end

--C) local function p()print("<5")end --if [Q1] was correct then this position and A are the same thing

function info()
--B) do local function p()print("<5")end
if time()==2 then p()end
if time()==3 then p()end
--B) end
if time()>5 then print(">5")end
end

--A) function p()print("<5")end

I would think B would be the correct position....but then I consider the fact that B is a function being defined every single frame in a loop....and the code where we call p() is only actually running for two frames in the game. I would think any potential saved overhead those two frames might be undone every other frame by this fact, and that A) would be the appropriate answer. But what if info() only ran for specific frames and every time it did run the p() was called without exception? I would think then B is indeed the correct answer since it mimicks the nongameloop ex at the top of the page.... But that still assumes the cost per defining each frame is still less than the amount saved by calling a local function....wud that change based on how many times I need to call that local function.
What if info() was in a for-loop that ran a thousand times in one of those combinations....what if it was just p() itself?

function _draw() 
--D) local function p()print("<5")end; [Q3] is D now the best position?
 for i=1,1000 do p() end
 info()
end

[Q4]What if environments come into play...a local function defined in the current environment each frame of the gameloop vs a global function linked through a metatable from another environment that's defined just 1x outside the gameloop. Here's an earlier example I had: If the rest of the game is defined in the environment of _G = _ENV _G.__index = _G and if add_bullet(...) is called each time in _update when the player presses the fire button...and there are variable chances of the bullets fired actually being of the type (10%/50%/90%) that call the function trimg_xy() if at all... where should I place the function trimg_xy? in A. or B. or C. or other?

I guess all these questions comes back to: [Q5] how much does this all compare to the cost of defining a function 1 or more times every frame within the gameloop vs 1x outside of it? Cause that's effectively what this is...do we define a function 1x like A) outside of everything.....or define it xtimes every frame....and is there a different payout depending on which per each conceivable scenario.

P#121503 2022-11-28 03:29 ( Edited 2022-11-28 03:58)
:: Unfold ::

I am running into a curious situation, @zep, regarding Pico-8 when it comes to lowercase letters.

For instance, in new code type this:

To type the lowercase letters you will need to press CTRL+P first, then type the letters, then press CTRL+P afterwards to return to normal uppercase letter mode.

Now highlight the code. The easiest way to do this is to triple-click it. Press CTRL+C to copy it.

Now paste it in any text editor like Notepad or even a message in here with CTRL+V. You will get the following:

a="abcdefg 𝘢𝘣𝘤𝘥𝘦𝘧𝘨"

Why is the text italicized ?

If you run the code and then use printh(a,"@clip") and then CTRL+V in the same text editor, you get this:

abcdefg ABCDEFG

Which is think is more correct. What do you guys think is going on here and are you getting the same results I do ?

P#121499 2022-11-27 23:44 ( Edited 2022-11-27 23:55)
:: Unfold ::

Hello, @zep.

You have seen that loading pause that appears in the top-left-hand corner of the screen every time you use CSTORE(), RELOAD(), or EXPORT (PNG) in your code. This is voluntary. I'm certain you chose it for a good reason. Sometimes I can't see the reasons you do. Yet it's not from not trying to.

I feel, however, the delay is artificial and unnecessary. You can prove this by IMPORTING a PNG image and it loads immediately with no delay at all, inside your code or out.

So how about this ? You have the pause when you use it the first time running if you must. Then you can continue to have the pause each time for every time you change the filename. However, if it were used in such a way that only =1= filename were used, for instance, to make it a random access file to save your current work, then it would be most helpful to me, perhaps to others, to remove that pause.

So your work may be saved automatically every minute or so minus the icon and timeout animation.

{beginning of code ...}
cstore(0,0,8192,"stream") -- expect delay + animation

{start of loop}
every 1-minute, cstore(0,0,8192,"stream") -- no delay or animation because the filename is the same
{end of loop}

So the 2nd, 3rd, and more cstore() would not bring up the pause delay. Once the filename is established, there is no further need for the animation and delay.

As it is now you get the pause even if you load or save a single byte. One byte ! 2-second delay every time. You see my annoyance with it.

OKAY, as always, all of these suggestion we make as a community - is up to you, ZEP.

Please remove this artificial delay. I am trying to work on a cart that requires these commands to not pause every time they are called, especially if it is the self-same filename.

The only thing I can add is that it would help me if it were passed, and I could write more amazing code.

I'm here because you hear. A great listener. And I mean that. Thank you for your time.

. . .

For those of you people who think I am being a difficult person. I apologize. Yet you should never ever think that my mood is based solely and 100% on this forum. I have many other difficulties running in my real life and family that all contribute to how I present myself.

Zep. I remember the words you used to encourage me recently. And you made me smile when you did that, knowing that I was important enough for you to support. We're all in this together.

Have a good Sunday and I will return.

Happy Holidays ...

🎄

P#121489 2022-11-27 20:25 ( Edited 2022-11-27 23:21)
:: Unfold ::

Cart #beautifulrunaway-0 | 2022-11-27 | Code ▽ | Embed ▽ | No License
14

This one is short but sweet. I hope you enjoy it! 😊

P#121486 2022-11-27 18:17
:: Unfold ::

Cart #pinema-0 | 2022-11-27 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

P#121484 2022-11-27 15:11
View Older Posts
Follow Lexaloffle:          
Generated 2022-12-01 16:55:26 | 0.138s | Q:86