Pico-8 Style Dithering Effect

Show off your games, demos and other (playable) creations.
Post Reply
User avatar
CapitalEx
Prole
Posts: 9
Joined: Fri Jul 24, 2015 2:33 am

Pico-8 Style Dithering Effect

Post by CapitalEx »

So, there is this twitter user by the name of Trasevol Dog who often showcases games with effects such as this on the PICO-8.
The fallowing code recreates that effect:

Code: Select all

-- Using love 0.10.x
love.graphics.setLineStyle "rough"
love.graphics.setDefaultFilter("nearest", "nearest")
love.window.setMode(512, 512, {borderless=true})
local rand, abs = love.math.random, math.abs
local mx, my = love.mouse.getX, love.mouse.getY
local screen = love.graphics.newCanvas(128,128)
local strength = 512 -- The more circles the stronger the effect.

function love.draw()
    BEGIN_DRAW()
        love.graphics.setColor(0xde, 0xad, 0x75)
        love.graphics.circle("fill",mx()/4, my()/4,8)
    END_DRAW()
end

function BEGIN_DRAW()
    love.graphics.setCanvas(screen) 
    -- Set the background color
    love.graphics.setColor(0x84, 0xe8, 0xd4)
    -- 
    -- The Magic happens here.
    -- Repetitively draw small circles to the screen,
    -- which clears parts of the previous frame,
    -- thus creating creating a nice trailing effect
    --
    for i = 1, strength do
        love.graphics.circle("line", rand(0,128), rand(0,128), 2)
    end
    love.graphics.setColor (0xff, 0xff, 0xff)
end

function END_DRAW() -- render frame.
    love.graphics.setCanvas()
    love.graphics.setColor (0xff, 0xff, 0xff)
    love.graphics.draw(screen,0,0,0,4,4)
end

function love.keypressed(key, code, isrepeat)
    if key == "escape" then love.event.quit() end
end
result:
Image
However, you're going to need to ask Trasevol about the other stuff :p
~~<Ɵ/\/\_: *snake noises*
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Pico-8 Style Dithering Effect

Post by Davidobot »

That's an ingenious way of doing things.
But what impressed me the most was that you used Hexadecimal values for colour. :o:
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
CapitalEx
Prole
Posts: 9
Joined: Fri Jul 24, 2015 2:33 am

Re: Pico-8 Style Dithering Effect

Post by CapitalEx »

Davidobot wrote:But what impressed me the most was that you used Hexadecimal values for colour. :o:
The hex codes come from a color pallet I had made (DEAD 75). I was to lazy to get the RGB, so I just broke apart the hex codes :P

Here's the full pallet:
Image
~~<Ɵ/\/\_: *snake noises*
User avatar
Crest
Prole
Posts: 1
Joined: Wed Nov 09, 2016 5:56 pm

Re: Pico-8 Style Dithering Effect

Post by Crest »

Simple and beautiful :)
User avatar
evgiz
Citizen
Posts: 83
Joined: Mon Aug 29, 2016 11:05 pm
Contact:

Re: Pico-8 Style Dithering Effect

Post by evgiz »

Looks great! Good way to add some juice to low resolution games!
Computer science student and part time game dev! Currently working on Depths of Limbo! :cool:

Check out the game website DepthsOfLimbo.com! :ultrahappy:
And my personal website with all my projects evgiz.net! :megagrin:
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests