Log In  
Follow
drakeblue

Solo Indie Dev - author of P8C-BUN, Pico Mermaid and Demystifying the Christmas Tree. Currently working on Pico Space, a 2D space sim featuring small animals in space and Dungeon Apprentice (a pico version of FTL's Dungeon Master). I tweet and itch.

The Pico Mermaid
by drakeblue
Demystifying the Christmas Tree
by drakeblue

Fading Stars Demo

Cart #fading_stars-4 | 2021-01-12 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

Demo showing the combination of the stars and fade effect I'm using in my current space game project (link TBD).

Stars

The stars are just simple particles that have x,y,z coordinates.

In this demo I use a couple of sin functions to give them some movement combined with a divide by the z coord for a bit of parallax. In game, I feed in the player's position.
Then I clamp the resulting x,y values to the screen with the modulus operator so they're always visible (%128). It does mean that the same stars go past constantly, but otherwise I was processing a lot of particles that don't get seen very often (not aiming for realism here).

Fade Effect

This works by mapping the colour of every pixel on the screen to another colour that tends to a target e.g. 0/black.
You can use a similar mapping with the pal(x,1) function to e.g. do fades to black between screens etc. but that fades everything including anything drawn that frame.

In this demo I process the pixels already in screen memory so that the screen is faded by a step, then draw fresh stars on top of that.

It's pretty expensive to do the whole screen (IIRC about 90% of performance at 60fps) so I've set it up to do every fourth scan line, starting from a different point each frame so that effectively a quarter of the screen is faded at a time. It takes 4 frames to fade the whole screen one step.

I initially tried fading in quarter strips top to bottom, but the tearing on bigger objects like planets looked pretty bad.

Using the order 0,2,1,3 for the scanlines does some rough dithering to make the effect look a bit more uniform. A random value flr(rnd(4)) works quite well too, but is messier looking.

Since I found using poke4 to work on 8 pixels at a time was fastest (not surprising really) dithering horizontally is limited and isn't in the demo. Nevertheless, I keep meaning to try a "Z" pattern i.e.

 0000000011111111
 2222222233333333

I'm concerned it might cost too much more in performance/tokens for too little visual improvement.

[edit]
Of course, as soon as I write about it the old subconscious starts working away and it takes 5 minutes to implement just that - a reverse N pattern as it turns out. Same performance, same tokens. See the new cart.

Pros of Effect

  • You can draw whatever you want really and the effect essentially "just works" as a replacement for a cls().
  • Cross-fading out from a scene just happens "free".
  • very simple particles look much more complicated than they really are

Cons

  • You can't draw anything that moves without the fade effect "catching" it. It can be mitigated by drawing around your objects (e.g. black borders), but if the view moves more than the width of the border you're out of luck.
  • Conversely, the effect only works where you don't draw that frame - so if your game has e.g. a full-screen scrolling background that's drawn every frame then you won't see any effect at all. For a space game this isn't a huge problem, but it's still visible here and there.
  • If nothing moves then there's no effect - try hacking the stars to be still in the demo.
  • Performance cost is approx 21% at 60fps.
  • Obv costs some tokens.
P#86396 2021-01-12 15:57 ( Edited 2021-01-12 19:20)

Cart #demystify-2 | 2020-12-24 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
11

Demystifying the Christmas Tree

Help your kitten destroy as many decorations as you can before the tree is fully decorated or their energy runs out and they nap.

Try to destroy multiple decorations within a short time to get combo bonuses and improve your score. Use your energy wisely, young feline.

Play as Philly or Frankie on their own or with a friend against each other. See who can cause the most chaos!

Controls

Action      Frankie (Player 1)  Philly (Player 2)
jump        up                  E
run         left/right          S, F
descend     down                D
poke        O(Z)                W
swipe/hit   X                   Q

Return      menu, including music on/off and restart.

(These are the standard PICO-8 controls so some other keys work too)

Background

Demystifying the Christmas Tree recreates a real event from a Christmas past, although in real life the kittens not only broke decorations, but also took out parts of the tree itself. They also didn't run out of energy (as anyone who has had kittens would know).

If you like this game, find a problem or have any suggestions then please comment below.

Please consider trying my other games or following me for news on new projects.

Happy Holidays :)

1.0.1 update: after testing with the owner of the kittens (my girlfriend's mother aka "mother-outlaw") I've added an option to change the speed that the arms decorate the tree.

1.0.2 update: added fade effect to intro. Because I felt like it.

P#85468 2020-12-16 13:32 ( Edited 2020-12-24 12:58)

Silly Snow

Cart #db_silly_snow-3 | 2020-12-02 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

(update: added 2 new methods that incorporate gusts of wind)

Controls

UP/DOWN chooses different behaviour for the snow flakes
X changes the colour of the falling snow so you can see the "trick" a bit easier
O/Z toggles drawing the non-snow bits of the graphics each frame on and off

What it is

--

TL;DR
Only track falling snow, add lying snow to the background.

--

As it's that time of year again, I thought I'd write some winter-themed stuff.

This is my take on ye olde faithful falling snow demo, which I'm using for the intro screen for another cart (on its way soon). I've cleaned it up a bit, added way more comments than I normally do and added some options to show what's happening a bit and show some variations. Click "Code" below the display above if you're interested.

I first typed in a version of this demo from a magazine back in the mid 80s on an Atari 800XL. In the 35ish years since then I'm not sure I've ever implemented it again though.

The gist of how it works:
Falling snow is represented by a collection of simple particles that are represented by a position (x,y). Each frame that position is updated (mostly downwards i.e. y+=some_dist).
If the snow flake encounters an obstacle (i.e. a pixel that isn't empty or the bottom of the screen) then the snow flake has landed.

Tracking snow flakes after they've landed isn't practical (even with PICO-8 and it certainly wasn't with an 800XL) and is also a bit pointless since once a snow flake has landed, it aint going anywhere. Well, at least not in this demo. Instead, the particle is destroyed and the pixel where it landed is set to white and becomes part of the background (in this demo that means it has a colour greater than 1).
This is an incredibly basic version of how a lot of "physics" engines work: updating only moving or otherwise interesting parts of the simulation and "parking" the rest. Usually they'd check the stationary particles in some way for whether they need to be activated. If you wanted to simulate collapsing drifts etc. there's nothing really to stop you keeping a record of where the snow has fallen or scanning for white pixels and perhaps checking to see if a condition to collapse has been met. Then you could find all the snow pixels affected by the collapsing pixel and "wake" them up. You would probably need to check at a slower than per frame rate for performance reasons.

As with most sims the fun is in playing about with it, hence the 9 method variations in the cart e.g.

  • the exact behaviour of the flakes in the air
  • whether they land or slide to the side on encountering the background can be tweaked.
  • wind gusts...

Blustery Blizzards

Methods 8 and 9 add a wind factor to the updated position for each flake generated by a value derived from complex and deep trigonometric knowledge (aka trial and error). The nice thing about this is it's only calculated once per frame and only added per snow flake so it's very cheap. Adding sin values per flake based on the flake's position gives some odd results.

Limitations

  • for there to be stationary, landed snow relies on not clearing the screen. If you clear the screen then you're pretty snow drifts all disappear. You can still have snow flakes falling, but they will disappear a frame after they land...

  • The methods in this cart are fairly non-destructive of the background, but it's fairly easy to make a version that "eats" into what's already on the screen (acid snow!). I've included an option to re-draw the background each frame. As long as your background doesn't move then it works fine (remember, no screen clear).

  • "tunneling" through thin parts of the background varies in frequency depending on your method. Generally, the more random the snow flake movement, the more problems you'll have.

On the Atari ST there was a game based around this that I got from a magazine cover disk called "Downfall". I could only find one video of it and the uploader doesn't seem to really understand how to play it sadly.
You were supposed to compete against a friend to draw lines to funnel snow from your side out of a hole at the bottom that would then be sent to their side (and vice versa). You could also funnel snow to the sides to give you energy for "special powers" that let you e.g. draw lines on your opponent's side.

I expect that explanation's as clear as a blizzard; hopefully the code isn't as bad.

Happy holidays :)

P#84926 2020-12-02 12:47 ( Edited 2020-12-08 17:56)

The Pico Mermaid

Cart #thepicomermaid-0 | 2020-11-09 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Use (X) to control the Pico Mermaid as she fetches pearls from the bottom of the sea back to the surface. Avoid the piranhas that will swim faster and faster as the mermaid retrieves more pearls.

This is my entry into Tweet Tweet Jam 5 and so the code fits into 560 characters (two tweets).

Features:

  • Single-button controls (X)
  • Animated and multi-colour pixel art sprites*
  • air and water physics*
  • Two particle systems*
  • Difficulty ramp*
  • Score effect*
  • Death effect*
  • start animation*
  • current score and high score display*
  • in-game instructions*

(* kinda)

Here's the code:

P=pset::A::x=64y=0v=-9t=0w=127e=0d=.6s=0for z=0,29do
poke(z\6*x+z%6+1,'0x'..sub('e0e800800880ce0800444404e008002444043b0000444480b000004088',1+z*2,2+z*2))end::B::P(69,e<1and w or y,7)H=max(s,H)e=y>119and 1or e
?'tAP❎ gET●:'..s..' hI:'..H
v+=.5C=cls
if(y>8)v-=max(btnp(❎)and 2or.4,v-.6)
flip()C(1)rectfill(0,0,w,9,12)t=(t+d)%w
y=min(120,y+v)spr(0,x,y,1,1,t&8<1,e<1)for i=3,14do
d=-d
t=-t
h=40*i-t-4&w
pal(4,i)k=i*8k+=7*sin(h/w)if((h+4)\8==8and 4>abs(k-y-2))C(8)goto A
spr(1,h,k,1,1,d<0)P(rnd(8)+x,h*d%y+3)P(k*d/.7,h\d)end
if(y<9and e>0)e=0s+=1d*=-1.2C(7)
goto B
P#84034 2020-11-09 11:37 ( Edited 2020-11-09 11:40)

P8C-BUN is now uploaded to itch.io here: https://drake-blue.itch.io/p8c-bun

I've also been working on something else that I really want to share a preview of soon, but I need to clean it up just a little more first.

P#83617 2020-11-02 14:36

P8C-BUN

Cart #drakeblue_p8cbun-2 | 2020-12-26 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

Help your chosen bunny cover each level with poo then escape down a rabbit hole. Don't get caught by the fox or anything else that's out to get you!

Finish all 16 levels without restarting to achieve "Iron Bun" or just try to post a high score. Start at whatever level you like.

Controls

  • Use the d-pad/arrow keys to direct your bunny.
  • z/c/(O) to show where you haven't pooed yet.
  • x to paws and return to the title screen.
  • You can toggle the music or return to the title screen from the menu as well.

Tips

  • The buns will keep running in the direction you choose until there's no clear path in front of them so there's no need to hold down the arrow keys.
  • If you choose a new direction before a junction or corner they'll remember that and turn immediately so corner early for maximum speed.
  • The bananas will give you a speed boost, but leave skins behind that you (or the fox) may slip on.
  • Macaroon is too tough to be caught by the fox or anything else so if you just want to play through the levels (or practice) choose to play as her. Real-life Macaroon has seen off cats and kills blankets on a regular basis.
  • The fox gets faster and the red kite will fly over as you cover more levels so choose which level you start from wisely if you're aiming for Iron Bun.
  • Manipulate the fox, especially using the rabbit holes, to make your life easier.

1.1 Update: text legibility and efficiency improvements
1.1.1: restored kite spawn to be after a few levels and not right from the beginning.

This is my first PICO-8 game (in fact, my first full game for anything) so any feedback is welcome. More info about P8C-BUN is here: DrakeBlue.com.
This game was inspired by our real-life pet rabbits (especially Oreo, who does tend to poo everywhere) and exists thanks to the patience of my gf (who runs the rabbit-oriented website mentioned on the title screen RabbitRetail.co.uk and uses it to help donate to rabbit charities and rescues as well as feed ourselves and our own bunnies).

Purchase to download and support more development and bunnies here: https://rabbitretail.co.uk/products/p8c-bun-game

Or here: Drake Blue on Itch.io

P#83276 2020-10-24 11:46 ( Edited 2020-12-26 10:43)

Follow Lexaloffle:        
Generated 2021-01-25 04:36 | 0.127s | 2097k | Q:100