
PICO-8 lighting, part 1: thin dark line - bpierre
https://medium.com/@krajzeg/pico-8-lighting-part-1-thin-dark-line-8ea15d21fed7#.2prysaoe5
======
kibwen
I'm reminded of how I was watching a friend play a game recently (can't
remember the name, sadly) with a really clever and unique way of accomplishing
line-of-sight lighting effects. It's a top-down 2D game, but the engine is 3D,
and all level geometry that would block LOS simply projects upward an
infinitely tall black tower (with a slight gap between the bottom of the tower
and the ground plane, so that you can see enough of the geometry sprites to
determine that there's a wall there). Combined with a fisheye lens effect on
the camera to exaggerate the towers, it's a very convincing and artistic
effect.

EDIT: Found it, it's called Teleglitch:
[https://www.youtube.com/watch?v=iEnS4wPRETw](https://www.youtube.com/watch?v=iEnS4wPRETw)

~~~
leggomylibro
Wow, that is a really clever technique. Thanks for sharing!

------
krajzeg
Author of the article here - if you have any questions or feedback, I'll be
happy to answer them or listen to it, respectively :)

~~~
AstroJetson
Loved part One! Stop hanging around here and get Part 2 written!! You have a
good writing style and it was easy to follow whats going on. I also like the
indepth of what PICO-8 is doing behind the scenes. I've read other articles,
but yours is the first time it's clicked.

Thanks!

~~~
krajzeg
Hey, at least let me have a few moments to bask in the glory!

Actually, I've been working on the draft of part 2 when my Medium notification
bar started going crazy - which is how I knew that something strange happened
(the strange thing being an HN frontpage, apparently).

So, no worries, part 2 is coming soon (TM).

------
sleazy_b
To anyone that's remotely interested, I'd really suggest getting yourself a
copy of PICO-8 to fiddle with. When people post their games, they include all
the code/assets by default, so there's a ton of stuff to read and learn from
and it generally is a fun tool to mess with. I'm working on my first Tetris
clone atm myself

~~~
krajzeg
Indeed, the PICO-8 BBS [1] is a smorgasbord of open-source games of various
kinds and quality.

A lot of people (including me) practice extreme open-source for PICO-8 carts
by licensing them as Creative Commons, which is easy to do - you just click a
checkbox on submission.

This in turn leads to the best games being tweaked and remixed quite a lot -
for example Celeste [2] (in my opinion, the best game on the platform) has at
least one variant with a lot of new mechanics and gameplay [3].

[1] PICO-8 BBS:
[http://www.lexaloffle.com/bbs/?cat=7](http://www.lexaloffle.com/bbs/?cat=7)

[2] Celeste:
[http://www.lexaloffle.com/bbs/?tid=2145](http://www.lexaloffle.com/bbs/?tid=2145)

[3] Perisher:
[http://www.lexaloffle.com/bbs/?tid=27694](http://www.lexaloffle.com/bbs/?tid=27694)

~~~
springogeek
We in the PICO-8 community also have both a Slack and Discord where you can
ask for advice and show off cool projects :)

------
patja
Thanks for sharing. I love the education licensing! I've been teaching with
Scratch and MinecraftEdu/ComputerCraft (which also uses Lua) and this looks
like a promising addition to my classroom tech stack. Extra-cool that it is
DRM-free and doesn't require an account to use...these sources of friction can
really negatively impact classroom productivity for students age 8 - 12.

Frankly if it requires an account I flat out won't use it in the classroom
unless it is really simple and complies with COPPA (like Scratch accounts,
especially the new classroom accounts)

~~~
mkesper
I just don't get why pico-8 itself isn't free software. :(

~~~
TeddyDD
I hope you mean free as freedom. I'm not surprised that Pico is not open
source. It's still in development and author is really careful about design
and building a community around it. Pico is such a creative environment thanks
to its limitations and last thing community needs is fifty incompatible forks
that would change pallete, resolution or token limit :)

~~~
mkesper
Yes, free as in freedom. The educational character might profit if - for those
curious to do so - it would be possible to look into the mechanics of this
'game'.

------
buttershakes
This is great, the PICO-8 is very neat, and I love seeing these kind of
explanations. It's really impressive what some people have managed to do
despite the constrained environment.

------
cableshaft
Wow, that looks ridiculous. Had no idea Pico-8 was capable of that.

Although when I was working on a game for it, I didn't do much more than draw
lines and fills on the screen :).

------
shultays

      decide it’s impossible on the puny simulated CPU
    

Doesn't PICO-8 had no limitations on CPU? It is not an emulator that slowdowns
the clock to a certain frequency. It is as fast as Lua gets.

~~~
krajzeg
Calling it a CPU is a simplification, but PICO-8 does emulate limited CPU
resources by limiting how much code you can run per frame.

Lua code runs at exactly the same speed inside the PICO-8 executable on a PC
and in the HTML5 export on a mobile - in both cases much slower than in a
standard Lua interpreter on my PC.

My guess is that PICO-8 is counting and limiting the number of opcodes the Lua
VM is allowed to execute per frame, but that's hard to confirm.

It's certain though that everything you can do in code (from variable
assignment to graphics operations like rectfill()) has a certain "cycle cost",
and you get a limited number of "cycles" per frame - just as if it was a real
machine.

------
korethr
This reminds me of some of the articles I've read about various hacks pulled
on classic video game consoles to get acceptable performance out of the
limited hardware. PICO-8 has crossed my radar and piqued my interest before. I
think I shall pick up a copy and start poking around.

------
logicallee
Very interesting and entertaining - thanks for posting.

------
jessemillar
Awesome to see PICO-8 on the front page! Nice article!

