Log In  

Cart #intoruins-2 | 2022-11-08 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Reach depth 16 and retrieve the Wings of Yendor


(◀)(▶)(▼) : Turn

(▲) : Step forward / Attack / Interact

(X) : Open inventory

(O)/Z/C : Wait 1 turn

Into Ruins is a roguelike for the PICO-8 Fantasy Console.

There are no stairs. Jump down holes in the ground to make your way to the bottom. You will encounter natural cave formations, crumbling dungeon rooms, and terrifying creatures on your way.

There are no doors. Tread carefully or the creature in the next room might spot you. Light helps you explore more easily, but also reveals you to your foes. Fires can spread wildly through the environment, while glowing mushroom spores can mend your wounds.

There are no classes or character levels. Expand your abilities by finding magical items on your descent, and bring them to their full potential with Orbs of Power.

Each attempt is a new beginning — the different types of orbs, staves, cloaks and amulets will not be immediately recognizable to you. Some experimentation is required to identify them.


Into Ruins was created by Eric Billingsley. It was greatly inspired by Brogue by Brian Walker.

Thanks to FReDs72, Heracleum, James Edward Smith, morgan, Oli414, Sim, SlainteES, SmellyFishstiks and Waporwave for beta testing and feedback.

Technical Info

I figured some of you might be interested in some of the technical aspects of the game. This was my first foray into PICO-8 and Lua, and I learned a lot along the way -- from discovering with shock that variables are global by default after a week and a half of strange bugs, to trying to cram as much as possible into strings, and _ENV abuse to reduce token count.

How does it all fit?

Initially I thought I could fit everything into 1 cart, but partway through I realized that even if I could fit all the features I had planned in while respecting the token limit, the compressed character limit would be a problem.

The final version of the game is in 2 carts -- one for the title screen and text intro, and another for the main game. The title screen cart also puts a huge string containing most of the game's data (creature stat blocks, animation data, item stats, text descriptions) into the upper memory region, which is then read and parsed by the main cart. Because the title screen still displays the environment and character, there's a lot of similar code between the two carts, though a lot of things that were refactored to save tokens in the main cart are still in the title cart in their original form.

Even with these measures, the main cart still needed to be stripped of comments, newlines, and whitespace using shrinko8 to fit within the compressed character limit.

As far as tokens go, making almost everything in the game be the same type of object went a long way. Each object has a type (which is just its sprite number), and from that we can initialize its properties with a combination of default values and ones read from the huge string mentioned earlier. Having everything be intialized and accessed the same way means that each object has a lot of data it doesn't actually need, but we aren't strapped for Lua memory so that's okay! The upside is we can reuse code where appropriate, and make things interact more easily. To save tokens on accessing properties, I also made heavy use of the _ENV trick outlined by slainte here, and seleb's list of token optimizations was indispensible as well.

Level generation

The levels are generated using a couple different algorithms. Levels can contain natural caves, manmade dungeon rooms, or both. In either case, there is a variable called Entropy which ticks down as more of the level is generated.


Caves are made recursively using a type of random walk. From our current position, we try to generate another tile in a random neighbouring space. We then decide whether to recurse again from this position or backtrack -- this probability is based on the current entropy, so at the start we always continue, and by the end backtracking is more likely. Playing with the starting entropy and the amount it goes down by with each recursion allows us to achieve the right density and balance between narrow tunnels and wide open areas.

When choosing which tile to put in a new space, we consider the tile we are generating from. Each tile type has a corresponding section of the map data which defines 16 possibilities for the next tile, so we choose one at random from these. In a way this is like a Markov Chain, where the state is just based on the tile we are coming from. Holes, grass and other environmental features are all generated this way. The tile definition can also include an entity to generate, like a mushroom, brazier, chair or barrel.

With each recursion, there's a very small chance we switch to generating rooms.


For rooms, we choose a random point on the map which will be contained in the room, and then random values for the room's width and height. The boundaries of the room are clamped to multiples of 2 or 4 to get them to lock together well and play nice with the rendering. We then create the floor and walls of the room, with one dimension being staggered to fit properly into the hex grid. Each room gets a random crumble value, which we use to decide if we should replace parts of the wall with different tiles (selected in the same way as in the cave generation).

After generating each room, there's a chance we switch to cave generation. Otherwise, we keep generating rooms at random positions until the entropy reaches 0. The rooms can overlap each other, and each time we generate one, a random openplan variable sets whether it should have walls on all sides, or try to merge with any overlapping rooms. In this way, we can get all kinds of interesting dungeon shapes just by combining rectangles.


Once the initial generation is complete, we analyze the level to find parts that are inaccessible, and then find a nearby position the player can get to and connect them in a straight line, either by building bridges or tunneling through walls. Then we recurse randomly through the level and fill out the contents of the manmade rooms, in the same way we did with the caves earlier.

There are a few more steps, like creating cave walls, ensuring there are exit holes, and running the code to connect areas again at various points. One interesting step is to replace cave walls which have walkable tiles both below and above them with a random tile, again sampled from the map data. This is actually the only way that stalagmites and mushrooms can be generated, and I think it makes their placement a bit more natural looking.


With the environment generated, all that's left is to spawn creatures and items.

Creature spawn groups are again defined in the map, with each line corresponding to a different depth. We attempt 6 times to spawn a group of creatures, either choosing a group from the current depth or sometimes randomly from a greater one for a nasty surprise. We pick a random position, and try to spawn a creature there, and then move on to a to a neighbouring tile for the next one in the group. If it turns out the spawn point is invalid, we don't try again, just move on. This means some levels, especially smaller ones, will tend to have fewer creatures but that's okay -- it just adds variety!

Items are spawned in a similar way, with the depth just affecting how many we try to spawn (we attempt to spawn slightly more items on earlier depths than on later ones). For certain important orbs, we make extra spawn attempts if there haven't been enough of them generated yet over the course of the game based on the current depth.


There's a lot of other things that I think could be interesting to write about, like the lighting, FOV algorithm, or various aspects of the AI, but for now I think this post is long enough. Let me know if there's anything you'd like to hear more about!

Into Ruins is also available on itch.io, and the unminified code is up on Github.

v1.02 Changes:

  • Improved fire animation (was intended to flip horizontally every 3 frames, but I accidentally broke this before release)
  • Changed text description for Orb of Light for improved clarity

v1.01 Changes:

  • You can now pick up <important item> even if your inventory is full.
  • Fix a rare bug where 2 Mirrorshards could teleport into the same space, with strange effects.
  • Increase Mirrorshard HP from 6 to 8
P#119614 2022-10-27 14:52 ( Edited 2022-11-08 19:08)

Amazing work!!!

P#119661 2022-10-27 16:25

Wowsen! Super cool work!

P#119667 2022-10-27 16:46

This is amazing!

P#119668 2022-10-27 17:10

Sooo good. Really impressive all around. I'm going to study and learn from the methods you employed here.

P#119672 2022-10-27 18:31

This looks super cool.

P#119697 2022-10-27 23:58

Amazing work, it is very impressive !

P#119750 2022-10-28 07:21

Beautiful game. This is my new obsession.

However, I gotta admit, half the time I have no idea what I'm looking at. Is that a hole or an unexplored region or the top of a different tile?

P#119765 2022-10-28 13:33

Thanks for all the kind words! Glad people are enjoying the game :)

@joealarson yeah, some of the tiles aren't the most readable, especially when you're in the dark. Some sacrifices were made in the name of aesthetics, and prioritizing the enemies/player being readable against the tileset. I think this is something you get used to as you play the game more and familiarize yourself with the tiles, and at least walking up to it and trying to move/interact doesn't cost too much.

P#119788 2022-10-28 18:20

I realize "amazing" has already been used several times to describe this, but I'll add another to the pile. The attention to detail, depth of gameplay, and overall presentation is indeed amazing. I've been playing roguelikes for about 25 years now, and this isn't only a great roguelike for PICO-8, it's a great roguelike period.

I wanted to finish the game before providing feedback, so I've been playing it quite a bit over the past couple days.

Brogue is easily my favorite roguelike from a gameplay perspective, and I love seeing its influence here. Every element (enemies, items, and terrain) is essentially unique and integral to the whole, and there are so many opportunities for emergent behavior. The bats that catch fire in light and start massive infernos are great. The braziers that can be knocked over to start a fire create interesting tactical situations. The weapons differing in how best to move in relation to enemies. My favorite bit along these lines is small, but I love it. Instead of healing directly, the goblin mystic heals allies with a healing cloud. I don't know if this was a conscious design decision or a byproduct of streamlining code, but it's great because it creates meaningful decisions. Kill the more dangerous enemy, or kill the one that was just healed? If I do the latter quickly enough, I can benefit from the healing cloud. So good.

Also, the little details are fantastic. The difference in the sound of footsteps depending on terrain (bones, grass, ice). The glow of orbs. Stepping on bones alerting nearby enemies. Staves of lightning briefly illuminating dark areas. It all combines to make the game feel like a cohesive, consistent whole.

And, of course, the graphics and animations are great. The terrain feels suitably dark and ruined, creating a great atmosphere. Each enemy already has its own character due to its behavior and sounds, but the animations reinforce this further.

I'm honestly not sure if I have any real criticism of the game. I do think the initial readability of some tiles is a valid criticism. For me, this went away after about a half-dozen plays, but I can understand that it might discourage some. I like the twist on cursed items, though the cloak is quite brutal. I like that each can be turned into an advantage of sorts, but the drawback of the cloak is such that I don't know how it could be used beneficially (I tried several times). I think the difficulty curve is close to perfect. It can be rough at the beginning (e.g. goblin archers and no mushroom on the first level) but seems fair more often than not. I've gotten the impression of a sharp increase in difficulty at level 14, but I've been that deep less than 10 times.

My first victory was melee-focused with some utility staves. +4 axe, cloak of wisdom +3, staff of blink +1, and staff of ice +1. The cloak recharging the staves every level was a huge contributor, but didn't feel overpowered. Becoming cornered was always a concern, because I couldn't escape via blink, and e.g. ogres could potentially kill me in one turn. I had one such very close call on D14, where an orb of teleport saved me. D16 was tricky, with a dragon in the way, but the staff of ice and a couple blinks made victory possible.

My second victory was almost all magic. I basically put all of the orbs of power into a staff of lightning, which ended up at +6. Anything more dangerous than a goblin or slime was dealt with from afar. Somewhere around D10, I found a cloak of wisdom. Otherwise, I just had a rapier and a slightly above average number of orbs of life. I thought I was done when a dragon ambushed me on D16, but alternating rounds of lightning and orbs of life were enough to defeat it.

Thanks for the game! Not only because it's great and I've gotten a lot of enjoyment out of it, but because it's an inspiration. I've been working on a traditional roguelike for PICO-8 for the past several months. I thought I was close to finished, but your game has made me realize what's possible and that I need to reconsider its general design and tighten up the gameplay.

P#119892 2022-10-31 01:45

Incredible! Great game! It was instantly add to my favorites

P#119909 2022-10-31 15:53

@eduszesz Thanks, I'm happy you're liking it!

@binaryeye Thank you for your detailed feedback! I'm so happy the game clicked for you as somebody who has played lots of roguelikes and shares a love for Brogue.

I think the goblin mystic healing was mostly an intentional design decision, but it was more from the angle of visually communicating a heal to the player, since they would already be familiar with the spores. The code streamlining and additional tactical options were a nice side-effect though!

It is definitely possible to beat the game with the cursed cloak if you find the right items (it can even be a pretty powerful build), though the cursed items are meant to be a sort of extra challenge.

I've updated the game with a few small changes:

  • You can now pick up <important item> even if your inventory is full.
  • Fix a rare bug where 2 Mirrorshards could teleport into the same space, with strange effects.
  • Increase Mirrorshard HP from 6 to 8
P#120006 2022-11-02 18:00 ( Edited 2022-11-02 19:14)

Well that just ended.

I walked into a room with an unidentified monster, hit him with an ice blast, walked past him to get the prize thinking I'd use it to beat the frozen monster, only to have the game take me out victoriously.

I feel like the game is very luck based. If you can find a weapon and staff on the first few levels, and don't accidently break an orb of fire while you're trying to figure out what you've picked up, then you've got a chance. But I suppose that's roguelikes.
But still I wonder if some load out could be scattered through the first two or 3 levels to insure you'll at least have something. There were a number of games where level 1 was just rats, and then others where I'm fighting goblins and dogs and I just have to restart.
Now that I know better how long I can stretch a light or gravity orb, I might not hold on to as many of them next time as I did in this run.

P#120092 2022-11-03 21:34 ( Edited 2022-11-03 21:37)

@joealarson Congrats, you've done it! Yeah the ending is sort of meant to take you by surprise the first time ;)

I agree there's a lot of variation in difficulty based on what items you find. In Brogue, this is partly addressed by having unlockable rooms which contain several items, of which you can only take one. I didn't have the tokens for something that complex so I tried to mitigate it by biasing item spawns towards the early depths a bit.

Another way of addressing it would be to make extra spawn attempts to ensure at least one (weapon or staff) and one (amulet or cloak) spawns in the early depths. I think this could work, but finding the tokens for it would be a challenge. The game does do something similar with some of the orbs if not enough of them have been spawned based on your current depth. It's a delicate balancing act to keep the game feeling fair and also interesting. Overall though I think I'm pretty happy with the current difficulty & variation -- I think it's good for some runs to be difficult even for a seasoned player.

In other news, I've released an update with a couple changes:

  • Improved fire animation (was intended to flip horizontally every 3 frames, but I accidentally broke this before release)
  • Changed text description for Orb of Light for improved clarity
P#120328 2022-11-08 19:22

Should I bother them?

P#121546 2022-11-28 22:14

incroyable ! BRAVO !
amazing game... wow

P#121569 2022-11-29 15:46

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2022-12-06 21:37:25 | 0.036s | Q:44