Log In  
[back to top]

Cart #38370 | 2017-03-18 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
8

Happy Saturday!

This is an attempt to create a faster falling sand simulation (60fps) by reading and writing directly to screen memory. All pixels / sand particles are active at all times.

I was inspired by Helado's Tiny Terrarium and Axnjxn's Falling sand.
https://www.lexaloffle.com/bbs/?uid=10783
https://www.lexaloffle.com/bbs/?uid=23000

I'm writing 1X2 pixel blocks in order to work directly with bytes and avoid bit-masking to address individual pixels. Then, I am using the display mode hack ( poke(0x5f2c, 2) ) to stretch the vertical scale of the display by 2X without requiring me to write any more data to screen memory.

-Electric Gryphon

P#38371 2017-03-18 16:12 ( Edited 2017-03-19 00:01)

Here's a toy I have been playing around with. Perhaps somebody can use these functions for fancy shaded 3D rendering or something like that.

I have a few functions that draw "RGB" pixels to the screen using pattern dither that are approximated using the rgb values of the pico8 palette.

color_bayer_plot_8(x,y,r,g,b) -- writes a given r,g,b at the x,y (r,g,b are from 0 to 1)

fast_rgb_create() -- pre-renders patterns using a 4X4 bayer dither representing 8 levels of R and B and 16 levels of G.
fast_rgb(x,y,r,g,b) -- writes a given r,g,b at the x,y (r,g,b are from 0 to 1)

function solid_trifill( x1,y1,x2,y2,x3,y3, r0,g0,b0,r1,g1,b1,r2,g2,b2)
Renders a triangle with the three corners colored at rgb and shades smoothly between them. Right now this uses the slower color_bayer_plot_8.

If you move the cursor around with the arrow keys you can see the triangles. The vertices can be grabbed with the "z" key and the color of the vertices can be changed with the "x" key.

Originally I had been thinking about making a gradient image compression algorithm, but it seemed less interesting after getting half-way through.

Here's a spinning R G B triangle for fun.

Cart #34413 | 2016-12-29 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
15

P#34412 2016-12-29 00:25 ( Edited 2016-12-29 15:42)

I've been playing around with Floyd–Steinberg dithering in order to achieve more continuous color gradients.

This is slow as molasses of course, and even with optimization I don't think it could be used in a game. But perhaps it could be used in a ray tracer or other, more temporally relaxed image generation applications.

P#32610 2016-11-18 14:21 ( Edited 2016-11-18 20:08)

old version:

Here is a cleaned up version of the 3D library that I put together for the Pico Fox game.

The demo code is commented in more detail, but here is the basic gist.

Copy the code between Begin Cut and End Cut. (It's a big chunk.)

In _init() function include:
--init_3d() --Need to call init_3d() to set up player, camera and lights
--use load_object(object_vertices,object_faces,x,y,z,ax,ay,az,obstacle,color_mode,color) to load 3D models into the world
--use read_vector_string and read_face_string to generate vertex list and face list from string data

In _update() function include:
--handle_buttons() -- handle default buttons for player-- this can be overwritten obviously.
--update_player() -- update the player with default movement, stopping at obstacles
--update_camera() -- update the camera based on player location and direction
--update_particles() --update 3D particles if used. (I didn't add any for this demo.)
--...
--update_3d() -- call update_3d() at the end of the _update() function to transform etc.

in _draw() function include:
--draw_3d() --render objects into triangles, sort the triangles and draw them onto the screen

Please feel free to use this in your projects as well as to update it and make it work better.

New features for version 2:
--Significant speed increase (2X!)
--Load models from strings to save token space
--Python script to translate from ".obj" files to compressed string

Run the script in the folder with the files that you are converting.
python low_poly_compress-01.py filename.obj

Detailed instructions and script found on GitHub.
https://github.com/electricgryphon/Pico-8-Gryphon-3D-Engine-Library

P#32574 2016-11-17 01:56 ( Edited 2017-06-28 20:27)

Cart #32479 | 2016-11-15 | Code ▽ | Embed ▽ | No License
158

Fly your Arwing to victory in this demake of a certain, iconic SNES game.

Controls:
Arrow Keys: Move ship, Select level in title screen
z/o: Fire

Features:
Filled 3D polygon graphics-- reminiscent of SuperFX chip
3 levels -- select with left or right on the title screen
2 enemy types
Music

Special thanks:
Star Fox Cornerea music sequenced by PJBarnes.com (http://www.khinsider.com/midi/snes/starfox) and imported using kittenm4ster's midi to pico-8 tracker translator (https://github.com/andmatand/midi-to-pico8)

Notes:
I finished this game with our three week old son sitting in my lap. I guess this is one our first father-son activities together--kinda sweet in a very nerdy way. Perhaps his first words will be in Lua.

Let me know if you would be interested in a cleaned up version of the 3D library that I put together for this project.

P#32480 2016-11-14 22:57 ( Edited 2017-03-29 17:11)

Cart #32244 | 2016-11-05 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
22

The forest is looking more foreboding these days.

-Electric Gryphon

P#32245 2016-11-05 13:44 ( Edited 2016-11-06 01:52)

Old version

The Galactic Tourism Bureau has put together a collection of postcards from their enticing travel destinations.
Postcards will switch every few seconds to ensure that you experience each of the 5,000 locales.

Thanks qbicfeet for the font library. (https://www.lexaloffle.com/bbs/?tid=27669)

V2 Changes:
--Improved near field clipping
--Water color can change
--Galactic index is readable

-Electric Gryphon

P#32242 2016-11-05 12:57 ( Edited 2016-11-07 01:50)

Cart #29299 | 2016-09-24 | Code ▽ | Embed ▽ | No License
9

This is a first attempt at creating a bump map lighting effect. The funky gray plasma thing is just there for pizzazz. The world can always use more pizzazz.

-Electric Gryphon

P#29301 2016-09-24 15:36 ( Edited 2016-09-24 19:45)

Cart #28294 | 2016-09-11 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
28

Take your trusty ship to the far reaches of the infinite multiverse...and destroy the hostile life that you find there.
Clear each planet to warp to the next system.

Features:
-- 30 fps interlaced flight simulator
-- 3,375 or more different worlds, ranging from snowy ice-planets to verdant hills.*
-- 6 enemy types

*OK, so a lot of the worlds look similar, but the same could be said about certain other games...

P#28295 2016-09-11 00:28 ( Edited 2016-09-11 04:28)

Cart #27815 | 2016-09-01 | Code ▽ | Embed ▽ | No License
11

Old_version:

Cart #27480 | 2016-08-27 | Code ▽ | Embed ▽ | No License
11

Here's a peek at a voxel based flight simulator engine that I have been working on.
The engine is heavily inspired by Comanche:
https://en.wikipedia.org/wiki/Comanche_(series)

I've been having fun with the smooth and seamless map generation. Perhaps other folks can make use of that code.

I don't think that I am ever going to get the frame rate up to butter smooth 30fps without dropping the res so low that things are unreadable, but maybe a flight sim can settle at 15 and be okay.

Updates:
--Added controllable ship with shadow
--Up and down controls height
--Z controls thrust
--Rings to collect
--F to explore the ship / return to flight mode

-Electric Gryphon

P#27482 2016-08-27 15:25 ( Edited 2016-09-01 06:43)

Cart #21310 | 2016-05-25 | Code ▽ | Embed ▽ | No License
10

Cart #21308 | 2016-05-25 | Code ▽ | Embed ▽ | No License
10

Metablob! Now with even more tasty blobbiness, but at half the calories.

-Electric Gryphon

P#21309 2016-05-25 02:35 ( Edited 2016-05-25 19:10)

Cart #21107 | 2016-05-22 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
16

Structure is a rigid body simulation where you can add and remove points and struts. Essentially, this is "World of Goo" without the, well... "gooiness."

Z: add point and connecting struts to the nearest points
X: delete point and connecting struts
CLEAR: clear the screen

The jury is out on whether I will adapt this to fit the jam based on a loose interpretation of "CHAIN" reaction.

Electric Gryphon

P#21108 2016-05-22 18:18 ( Edited 2016-07-07 20:20)

Cart #19819 | 2016-04-16 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
52

Old version:

Cart #19701 | 2016-04-11 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
52

Clean the skies of sector Q97-C with your trusty mining laser.
Keep an eye out for debris, not to mention Turrets and Tormentors.

Controls:
Arrow keys control roll and yaw.
X-key accelerates.
Z-key fires laser.

Tips:
Full 3D navigation can be tricky, so keep an eye on your radar at the bottom.
It can be easier to sweep the laser up over targets than to try to hit them dead on.
Watch out because the laser uses your ship's power, which only refills slowly over time.

Version Notes:
Added music by Robby Duguay
-www.robbyduguay.com
Added sound effects

P#19702 2016-04-11 01:28 ( Edited 2017-09-19 03:52)

Cart #19522 | 2016-04-01 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
16

A funny thing happened on the way to making an actual game.

I found this odd fox statue floating in between the bits and bytes. I hope it's not lonely.

-ElectricGryphon

P#19523 2016-04-01 02:05 ( Edited 2016-05-05 07:53)

Hi All,

Has anyone built up inverse-sine and inverse-cosine functions?

Right now, we have cos(x), sin(x), and atan2(dx,dy). If all else fails, I can create a table function to look these up, but figured I'd ask around to avoid duplicating the work.

-Electric Gryphon

P#19306 2016-03-19 14:58 ( Edited 2016-03-20 20:08)

Cart #19204 | 2016-03-13 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
13

Manged to get 16 frames of full motion (if chunky) video compressed into here before running into the limits of the compressed cart size. Frames are stored as run-length encoded images, with only the difference between frames being noted/redrawn.

I used a custom python script and some elbow grease (file renaming and bulk resizing) to get the images converted into the string format.

-Electric Gryphon

P#19205 2016-03-13 03:56 ( Edited 2016-03-19 23:53)

This is a first pass at trying to do something like Out of This World (or Another World depending on which side of the pond you land on).

Background is a static, shaded vector image that is rendered once at the beginning of the scene into a temporary buffer and then copied to the screen every frame.

The man is a moving vector animation that is rendered to the screen every frame.

Things aren't really structured for an actual game yet, but at least this shows that the concept could work.

P#19045 2016-03-02 02:40 ( Edited 2016-03-06 03:08)

It's a filled polygon, smoothly tweened animation of a running cat. There's still a decent amount of space left for a program, or even more complex animation.

Thanks to Eadweard Muybridge for taking photos in the 1880's that are still useful today.

-Electric Gryphon

P#19024 2016-02-29 02:09 ( Edited 2016-03-01 01:39)

Cart #18991 | 2016-02-27 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
18

Relive the joy of the 80's with some key mashing and marble gobbling. Feed those peckish pachyderms as fast as you can to win.

This is a two to four player, shoulder to shoulder kind of game.

Up Arrow: Red
Down Arrow: Yellow
Left Arrow: Blue
Right Arrow: Green

If anyone feels an urge to replace the music with something better, please be my guest.

--Electric Gryphon

P#18992 2016-02-27 17:48 ( Edited 2016-05-29 19:15)

Here is the first pass at the Pico-8 Flight Simulator in filled and shaded 3D.

Explore an expansive, mountainous world and avoid crashing.
(Simulation might be a stretch, as nothing about the aircraft physics is actually modeled... but you have to start somewhere.)

Controls:
Left / Right Arrow: Turn
Up / Down Arrow: Increase / Decrease Pitch

I was feeling down about the frame rate, but then I looked at videos of flight simulators from the late 80's and early 90's and that made me feel better :-D.

Changes:
--Fixed movement bug

Next tasks:
--Cockpit graphics
--More varied terrain
--Some sort of goal (perhaps travel from airport to airport and land... like a real flight sim...)

-Electric Gryphon

P#18808 2016-02-13 14:39 ( Edited 2018-08-25 18:35)

View Older Posts
Follow Lexaloffle:        
Generated 2020-09-24 17:19 | 0.148s | 4194k | Q:254