Hacker News new | comments | show | ask | jobs | submit login
PICO-8 lighting, part 1: thin dark line (medium.com)
197 points by bpierre 342 days ago | hide | past | web | favorite | 30 comments

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

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

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

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.


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).

I've been following you on Twitter and have been mad impressed for some time. Great to see this technical write-up and I'm looking forward to part two!

This is great, really looking forward to the next part!

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

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

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

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

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

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)

Yeah, the guy behind PICO-8 is big on education and having the whole thing as accessible to children as possible.

There are a lot of people using it to introduce their children to game development and programming in general, and it's (supposedly) a blast for both them and the parents. I always felt that while our PCs have gotten 100x as powerful, they paid a big price in accessibility for actually getting stuff done on them when you're 10.

For adults, PICO-8 has just about the right amount of restrictions to keep you productive while still letting you create something worthwhile.

Exactly, the C=64 begged you to create something when it booted up to a BASIC prompt. We've come 2 steps forward 1 step backward with current devices. More kids have these in their hands, but they are harder to create with than ever.

Why are accounts a problem? Because kids are always forgetting their passwords? My understanding is that chromebooks are pretty popular in schools now, they require passwords.

Directing 30 kids to login and get authorized means an entire period of no productivity. And then you still may have problems the next day. Also there's legal issues with storing personal info about students.

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

So the guy who wrote it can pay his rent? I'd love for him to share the source code, but I'm happy to pay for it.

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 :)

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'.

There's more to pico8 than just a bit of software. There's a community, a games database, updates and support. The alternative is ad based revenue, and quite frankly I and possibly others wouldn't use pico if it were ad based.

You're also free to sell your software, which you cant even do with unity without a royalty.

Plus, there seems to be a small recent trend of releasing games for free and charging a small donation amount for an instruction manual, as has been done with The Lair[1] and Galactic Wars[2]

[1]: https://krajzeg.itch.io/the-lair [2]: https://volcanobytes.itch.io/galactic-wars

In the all things considered category it's very inexpensive at $15 for all the stuff that you get. Compared to some movies (ticket, popcorn and a drink at almost twice the cost) I've had much more fun with PICO-8.

For $30 you can get a C.H.I.P computer, game pad AND a copy of Pico-8. So you can go retro on tiny hardware.

Are you willing to pay his rent for it to be free software?

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.

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 :).

  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.

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.

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.

Very interesting and entertaining - thanks for posting.

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

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact