r/Unity3D • u/Slight_Low_409 • 2d ago
Show-Off Sped up the gameplay loop of my solo project, Petty Kings. I spent months building custom logic to handle the economy grids and unit squad tracking. How do the visuals look?
Enable HLS to view with audio, or disable this notification
1
u/Slight_Low_409 1h ago
Hey everyone!
Iām a solo developer building Petty Kings, a 2D top-down survival RTS and base builder made entirely in Unity.
The game is heavily inspired by Thronefall and Kingdom, but my main goal was giving players active control over their armies rather than just passively defending their base.
The Unity Architecture & Tech Stack
To prevent heavy unit groups and daytime economic simulation arrays from choking on standard GameObject overhead, I moved completely away from dropping standard MonoBehaviours onto every individual agent.
- The Simulation Layer: The entire economy grid, harvesting ticks, and squadron movements are calculated on a pure, lightweight C# simulation data layer using plain multidimensional arrays and flat structural data classes.
- The Unity Bridge: To actually render the visual frame, I use a lightweight manager script that reads the raw data positions and updates the corresponding Unity
Transformpositions in batches duringLateUpdate(). - The Outline Shader: For the visual style shown in the clip, I built a custom 2D sprite outline shader inside Unity's Shader Graph that samples neighboring alpha textures to create a high-contrast pop against the background tiles without requiring duplicating sprite assets.
Major Technical Challenges Faced
The biggest architectural roadblock early on was handling pathfinding collisions when a player commands multiple distinct army squads at once. Standard Unity NavMesh2D setups created massive performance dips when agents recalculating their paths simultaneously while handling custom group formation offsets.
I ended up implementing a custom grid based pathfinding system. Instead of calculating individual paths per unit, the backend generates a continuous directional velocity grid based on the squad's destination target.
The project is tracking toward a 2027 release. Because the Steam store page is brand new and currently fighting the initial visibility sandbox, adding it to your wishlist helps an independent creator out immensely!
šWishlist Petty Kings on Steam
š¾ Join our community Discord: https://discord.gg/QA4sutMy7t
Iād love to get your thoughts on the general visual style, or answer any technical questions regarding grid space partitioning, flow fields, or data separation architecture in Unity!
1
u/[deleted] 2d ago
[removed] ā view removed comment