Posts about roguelike
8 posts
-
GRD 031
#B37
The message log is harder than the combat
The orc hits you. Three words, and behind them a grammar engine, a visibility check, a repeat counter and a prompt that stops the game.
-
GRD 028
#512
Unidentified items: why the potion is bubbly this time
Rogue shuffled the names of its potions, scrolls, rings and wands every game, and forty years later the genre still does it. The code is thirty lines. Working out what the mechanic is for took me longer.
-
GRD 024
#A73
Deterministic randomness for a roguelike
A seed should give you the same dungeon every time, but it won't if the combat rolls and the level generator share one random number generator. The fix is a separate stream for each thing that rolls.
-
GRD 019
#249
An energy scheduler for turn-based games
Move the player, then move every monster once: that loop works until the first bat. Angband's energy system fixes it in forty lines, and the browser loop around it stops at the player and waits for a key.
-
GRD 014
#153
An entity component system for a roguelike
A Monster class, a Player class and a base class they share work until you want a door you can attack. I use a small entity component system instead, about a hundred lines of TypeScript, with one downside you should know about.
-
GRD 011
#6B2
Dijkstra maps: the roguelike trick I use for everything
One flood fill from the goal tells every monster on the level which way to walk, and a negated copy tells them which way to run. Brian Walker wrote it up a decade ago and I keep finding new uses for it.
-
GRD 010
#841
Field of view with symmetric shadowcasting
Rogue lit whole rooms and called it a day. Rays and shadowcasting came later, along with a bug where the monster could see you but you couldn't see it. Symmetric shadowcasting fixed that, and this is my TypeScript port.
-
GRD 009
#394
How Rogue drew its dungeon
Before BSP trees and cellular automata there was a three by three grid with a room in each cell. It's still the generator I write first, and it fits in a hundred lines.