Skip to content

u/YesBoxStudios

In this archive from Apr 2022 to Sep 2026

80
posts
175
comments
68
media
10k
score
3 saved before deletion

Hey everyone, I've been working on Metropolis 1998 for 4.5 years now, planning to launch end of year or early 2027.

I've been a solodev from the start, with a few very part tine contractors who do the art and buildings.

Making a game of this scale is a marathon. I started with an empty .cpp file + SFML and created the game and engine from there!

31 points

This is a good idea but I dont think it will help much since all parts of the building/property will be used by units (there's some random destinations depending on their activity).

Multi threading is something I only use once I exhaust all other options, for many reasons

2 points

99% of my game is single threaded. The only part that isn't is the graph generation code for the road network.

IMO, multithreading should be the last thing you do. Beyond the normal reasons (state management, it's hard to do right, etc), the efficiency gains from multi threading are tiny compared to algorithm/data structure improvements. Also, it can make changing existing code complicated.

When a player adds/removes a road/path, how are you determining which agents are affected and who's paths should be recalculated

Every unit on the road will have to regenerate its path.

For buildings, I dont allow editing unless it's off market (thus units cannot access it).

3 points

Im working on a game called Metropolis 1998 - Steam.

Efficient pathfinding has been one of the most difficult challenges of creating this game. It's also one of the core mechanisms since units are going places all the time.

There was a bottleneck with the A* setup I was using for indoor pathing that limited the number of units processed without causing FPS stuttering.

This became an issue when I began batch-processing units to update their activity each in game minute. Hard to say the max number of units it could handle since it depends on building size and the units schedule (e.g. at work they move around less)

For this building (which is quite large), it came out to ~75 units per frame (@ 60FPS). <"worst case">

Typically 2%-6% of the population (when awake) will change their activity per in game minute. Thus every ~2,000 population ate up a frame. In a real city, this number is probably closer to ~10,000 (i.e. 500 processed units per frame).

So I spent a few days tinkering with the containers the indoor pathing code relied on and boosted the numbers to 400-600 per frame (normal case: 2K to 3K), then distributed the load throughout multiple frames if needed.

Rendering 100K units requires a lot of CPU cycles, so the second half of the video shows the setup running at (a bit unstable) > 60 FPS!

20 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.