Log In  

hs
by dw817
Cart #hs-0 | 2019-11-27 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
5


TO LOAD THIS CART in immediate mode, type:

load #hs

Hyperspace or falling into a black hole. Whichever you think it might be. In any case, thought I would create a new post for this example. Earlier I was explaining some of the interesting things you can do with the PALETTE.

Here is a small example using all 15-colors of the 16-total. It uses the exact same principle you see as the snowflake animation found HERE:

https://www.lexaloffle.com/bbs/?tid=35927

So in the animation itself, no pixels are actually being drawn or moved. Only the palette is manipulated. Two per animation cycle at 30fps and likely using zero CPU if any at all despite how many sprites "appear" to be moving.

-- falling into a black hole
-- written by dw817 (11-15-19)

-- standard ⌂ pico-8 license

function main()-------------->>

cls()
for i=0,127,2 do
  pline(64,64,i,0)
  pline(64,64,127-i,127)
  pline(64,64,0,i)
  pline(64,64,127,127-i)
end

circfill(64,64,16,0)

for i=1,15 do
  pal(i,0,1)
end

i=0
repeat--forever
  pal(i+1,7,1)
  flip()
  pal(i+1,0,1)
  i=(i+1)%15
until forever 

end--<<------------------------

-- get random # from a to b
function rand(a,b)
  if (b==nil) return flr(rnd(a))
  if (a>b) a,b=b,a
  return a+flr(rnd(b-a+1))
end

-- draw a line from point to
-- point, starting with a
-- random color and stretching
-- it the further it travels.
function pline(a,b,c,d)
local px,py=c-a,d-b
local ax,ay=abs(px),abs(py)
  if ax>ay then py/=ax px=sgn(px) else px/=ay py=sgn(py) end
  e=rand(0,14)
  f=5
  repeat
    pset(a,b,e+1)
    e=(e+f)%15
    f/=1.06
    a+=px b+=py
  until abs(a-c)<1 and abs(b-d)<1
ff=f
end

main()

Now imagine if Pico-8 could work with 256-colors for their palette instead of this simple 15 ? :)

P#69932 2019-11-15 23:35 ( Edited 2019-11-27 16:36)

1

Indeed, @roywig. Looks good.

If Pico-8 wants to maintain a low profile for graphics, that's fine. Here's hoping we get a 256-color palette in the future with true 24-bit RGB color choices to each of the indexes.

If I hadn't mentioned it before, here are some graphics that are indeed possible using the same 8192-bytes we have today.

These are for square resolutions only. I've got some ideas for 4x3 and wide-screen, but that's fine for now.

  1. (128x128 pixels, 16-colors per pixel, current resolution), 8192-bytes
  2. (64x128 pixels, each pixel visually double-wide, yields 256-colors per pixel), 8192-bytes
  3. (256x256 pixels, two colors per pixel, default black and white), 8192-bytes
  4. (128x256 pixels, each pixel visually double-wide, yields 4-colors per pixel), 8192-bytes
  5. (64x64 pixels, each pixel visually double-wide and high, yields true 16-bits per pixel), 8192-bytes

Note, #5 does not have a palette, you have true 4-bits for red, 8-bits for green, and 4-bits for blue, or if desired instead, 5-bits for red, 5-bits for green, 5-bits for blue, the last bit not used.

P#69955 2019-11-17 01:30 ( Edited 2019-11-17 01:35)

@dw817, would you mind posting that hyperspace code as a cartridge?

P#70286 2019-11-27 12:12

Seconding @chungus_is_gay here. I'd love to see how this was done and maybe learn how to do it myself :) As usual, cool stuff, @dw817!

P#70289 2019-11-27 14:26

The source-code is listed, @chungus_is_gay and @Remagamer ?

Alright, well, here's the cart, it's at the top now.

BTW for those of you unfamiliar with how to copy listed code in the BBS to Pico-8, start at the top of the code, in this case the first two "--" click the mouse and hold it.

Then drag all the way down to the last line, in this case of and including "main()"

Release the mouse, press CTRL+C. Then in the Pico-8 sourcecode editor press CTRL+V.

Done.

As there is an interest in this I was wondering if someone could tackle this ?

The star movement as seen in Star Voyager for the NES.

https://youtu.be/HyMBk9FfDCI?t=140

Notice it's like looking into a sphere when the stars move. Fascinating and I have no idea how to reproduce something like this code-wise myself.

P#70294 2019-11-27 16:40 ( Edited 2019-11-27 16:41)

Cool. Noice effect.

P#70295 2019-11-27 17:04
1

3d starfield (many Pico games have that in action already...)

Cart #deneminoza-0 | 2019-11-27 | Code ▽ | Embed ▽ | No License

P#70304 2019-11-27 18:53

You see how complex that was though. I try to avoid SIN() and COS() when I can. I was using coords 0-127 whereas yours are -.5 to +.5. Interesting.

And so - it is a sphere after all. And no this is the first time in Pico-8 I have seen this particular way to present star movement.

Nicely done, @freds72 !

Now that I know the coordinates you are using are -.5 to +.5 I need to sit down and mess with SIN() and COS() myself and see if I can put together something presentable with true UDLR scrolling.

Stars alone are tiny enough without becoming rectangles, will just use brightness levels of 1x1 pixels.

I was experimenting with the unusual way that planets appear in Starship, a game I hope to eventually write.

Cart #gumahijipi-0 | 2019-11-27 | Code ▽ | Embed ▽ | No License

https://www.youtube.com/watch?v=hAYMezFn06w

P#70306 2019-11-27 19:30 ( Edited 2019-11-27 19:55)

@freds72 ? Thanks. I really do appreciate what you did here. It showed me it was possible. And while I may have gone a completely different angle than what you have (albeit I did not use SIN or COS), by you doing it - it showed me that I could do it too.

https://www.lexaloffle.com/bbs/?tid=36043

P#70318 2019-11-28 02:21 ( Edited 2019-11-28 02:37)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 05:49:03 | 0.046s | Q:37