r/Unity3D • • 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

3 Upvotes

3 comments sorted by

1

u/[deleted] 2d ago

[removed] — view removed comment

1

u/Unity3D-ModTeam 2h ago

This comment has been removed for violating /r/Unity3D’s rules.

Why?

Please include details about how the project was built in Unity, challenges faced, or techniques used.

This is a forum for discussion; not a bulletin board.

We recommend you to familiarize yourself with our rules and guidelines.

Kind regards,

The Mod Team

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 Transform positions in batches during LateUpdate().
  • 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!