Bounty & Pipius
Pipius Pipius
Hey, ever thought about whipping up a rogue‑like that spins out its map using a deterministic algorithm but still feels wild and unpredictable? I could crack a generator that makes each run feel fresh, and we could throw in some high‑stakes decision points—like a risk‑reward system that keeps you on the edge. What do you think?
Bounty Bounty
That sounds exactly like the kind of chaos I live for, so yeah, hit me with that generator—let's make every run feel like a new gamble. Bring the risk‑reward curve, keep me on the edge, and I'll take it. Let's roll.
Pipius Pipius
Here’s a quick deterministic generator in plain Python that you can drop into your rogue‑like. It builds a map with a seeded RNG, then drops loot and enemies where the deeper you go the higher the risk‑reward curve. ```python import random def gen_map(width, height, seed): rng = random.Random(seed) # simple grid: 0 = floor, 1 = wall grid = [[1]*width for _ in range(height)] # carve a spiral room to keep it deterministic x, y, dx, dy = 0, 0, 1, 0 for _ in range(width*height//2): grid[y][x] = 0 nx, ny = x+dx, y+dy if 0<=nx<width and 0<=ny<height and grid[ny][nx]==1: x, y = nx, ny else: dx, dy = -dy, dx # turn right x, y = x+dx, y+dy return grid def place_entities(grid, seed): rng = random.Random(seed) entities = [] height, width = len(grid), len(grid[0]) depth = rng.randint(1, 5) # depth level, influences risk # risk–reward: base reward + depth * factor base_reward = 10 risk_factor = 5 reward = base_reward + depth * risk_factor for _ in range(depth*3): # more enemies deeper # pick random floor tile fx = rng.randint(0, width-1) fy = rng.randint(0, height-1) if grid[fy][fx] == 0: # 70% chance enemy, 30% chance loot if rng.random() < 0.7: entities.append(('enemy', fx, fy, depth)) else: entities.append(('loot', fx, fy, reward)) return entities # usage seed = 12345 grid = gen_map(20, 15, seed) ents = place_entities(grid, seed) ``` The `depth` variable can be tied to how many rooms you’ve passed; the deeper, the higher the `reward` value but the more enemies. Flip the `risk_factor` to tweak how steep the curve is. That’s a skeleton you can evolve—feel free to swap out the spiral carving for a proper dungeon algorithm if you need more variance. Happy hacking!
Bounty Bounty
Nice code—spinning that spiral is a sweet cheat, but if you want the real thrill, swap it for a proper maze generator and throw in some hidden traps. Keep the risk‑reward curve brutal, and watch players’ hearts race. Let’s keep it wild!
Pipius Pipius
Here’s a quick depth‑first maze generator that also tosses in traps and a harsher risk‑reward curve. It’s all deterministic so you can keep the seed. ```python import random def gen_maze(w, h, seed): rng = random.Random(seed) # start with walls maze = [[1]*w for _ in range(h)] stack = [(0,0)] maze[0][0] = 0 while stack: x,y = stack[-1] # 4-neighbor moves, skip diagonals dirs = [(2,0),(-2,0),(0,2),(0,-2)] rng.shuffle(dirs) moved = False for dx,dy in dirs: nx,ny = x+dx, y+dy if 0<=nx<w and 0<=ny<h and maze[ny][nx]==1: # carve path maze[y+dy//2][x+dx//2] = 0 maze[ny][nx] = 0 stack.append((nx,ny)) moved = True break if not moved: stack.pop() return maze def place_traps_and_loot(maze, seed): rng = random.Random(seed) h,w = len(maze), len(maze[0]) entities = [] # depth = number of cells visited so far depth = sum(row.count(0) for row in maze) // 2 risk_factor = 10 # brutal base_reward = 5 reward = base_reward + depth * risk_factor for y in range(h): for x in range(w): if maze[y][x]==0: if rng.random() < 0.1: # 10% traps entities.append(('trap', x, y, -1)) elif rng.random() < 0.4: # 30% loot entities.append(('loot', x, y, reward)) else: # 60% enemies entities.append(('enemy', x, y, depth)) return entities # Example seed = 987654 maze = gen_maze(25, 15, seed) ents = place_traps_and_loot(maze, seed) ``` The deeper you crawl, the more enemies pop up and the higher the loot value, but each trap deals a fixed damage. Adjust `risk_factor` or the percentages to crank the tension. Happy hacking!
Bounty Bounty
That’s a slick maze generator, love the depth‑first feel. Those 10% traps already give it that heart‑pounding edge, but let’s push it a notch—maybe give a few spots a massive loot bonus if you clear a whole corridor, and toss in a surprise boss when the depth hits the top. Keep the seed locked, but add a few random spikes in danger. Ready to drop that into a live run and see how many players will die screaming? Let's do it.
Pipius Pipius
Sure thing, here’s the updated generator with corridor loot bonuses, a surprise boss at max depth, and a few random danger spikes while keeping the seed locked. import random def gen_maze(w, h, seed): rng = random.Random(seed) maze = [[1]*w for _ in range(h)] stack = [(0,0)] maze[0][0] = 0 while stack: x,y = stack[-1] dirs = [(2,0),(-2,0),(0,2),(0,-2)] rng.shuffle(dirs) moved = False for dx,dy in dirs: nx,ny = x+dx, y+dy if 0<=nx<w and 0<=ny<h and maze[ny][nx]==1: maze[y+dy//2][x+dx//2] = 0 maze[ny][nx] = 0 stack.append((nx,ny)) moved = True break if not moved: stack.pop() return maze def place_entities(maze, seed): rng = random.Random(seed) h,w = len(maze), len(maze[0]) entities = [] cells = sum(row.count(0) for row in maze) depth = cells//2 max_depth = (w*h)//4 risk_factor = 12 base_reward = 7 reward = base_reward + depth * risk_factor # corridor bonus: if a full horizontal corridor of 4+ tiles exists for y in range(h): run = 0 for x in range(w): if maze[y][x]==0: run += 1 if run>=4 and rng.random()<0.3: entities.append(('loot', x, y, reward*3)) else: run = 0 for y in range(h): for x in range(w): if maze[y][x]==0: if rng.random() < 0.1: entities.append(('trap', x, y, -rng.randint(5,15))) elif rng.random() < 0.4: entities.append(('loot', x, y, reward)) else: entities.append(('enemy', x, y, depth)) # random spikes for _ in range(rng.randint(1,4)): sx = rng.randint(0,w-1) sy = rng.randint(0,h-1) if maze[sy][sx]==0: entities.append(('trap', sx, sy, -rng.randint(10,25))) # surprise boss when depth hits top if depth >= max_depth: bx = rng.randint(0,w-1) by = rng.randint(0,h-1) while maze[by][bx]!=0: bx = rng.randint(0,w-1) by = rng.randint(0,h-1) entities.append(('boss', bx, by, depth*2)) return entities # Example run seed = 123456 maze = gen_maze(30, 20, seed) ents = place_entities(maze, seed) print("Maze generated. Entities placed:", len(ents)) The maze keeps the deterministic feel, but every time you clear a long corridor you can hit a massive loot spike, and once you’re deep enough a boss appears that will have players screaming. Try it in your next session.
Bounty Bounty
That’s fire—boss at the very top, loot spikes, and a maze that never repeats itself. Perfect for keeping players on edge. Hit play and watch the chaos unfold. Let's see who survives the final showdown.
Pipius Pipius
Okay, fire it up. I’ve wired the maze, the boss trigger, and the loot spikes into a quick loop. Just run the script, grab the seed, and let the corridor‑blowing loot keep the adrenaline pumping. Watch the stats scroll, the health bar pop, and when that boss drops in at the very top, you’ll know someone’s about to get a real shock. Ready to see who actually survives the final showdown?