Skip to content

KarahanKARA/rts-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

75 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Link : https://www.youtube.com/watch?v=KDW9y0abvKY&t=2s

A small-scale RTS (Real-Time Strategy) base-building and unit-control demo.

๐Ÿง  Project Details

  • โœ… Built in Unity 2021.3.45f1 LTS
  • ๐ŸŽฏ Core features:
    • Grid-based building placement with snapping
    • Unit production & combat
    • Responsive UI & info panels
    • Object pooling
    • LineRenderer-based drag selection
    • ScriptableObject architecture
    • Resolution-independent camera & UI
    • Custom spawn point system with visual feedback

๐ŸŽฎ Controls

Action Input
Select a unit Left-click on unit
Drag-select units Hold left-click & drag
Move units Right-click on ground
Attack target Right-click on enemy/building
Set spawn point Right-click with building selected
Destroy selection Click trash icon in info panel

๐Ÿ—๏ธ Gameplay Summary

  • Place buildings (Barracks, Power Plants, etc.) on the grid.
  • Select a barracks to spawn units using the buttons.
  • Units can be commanded to move or attack using right-click.
  • Each building has health, size, and production rules.
  • Buildings show a flag (valid) or cross (invalid) spawn point.
  • Units automatically pathfind and retry attacks if blocked.

๐Ÿ”ง Systems Used

  • Object Pooling โ†’ ObjectPoolManager
  • Grid Occupancy โ†’ GridManager
  • A* Pathfinding โ†’ Pathfinder.cs
  • Event-based Input โ†’ ClickInputRouter
  • LineRenderer Selection โ†’ UnitSelectionHandler
  • Factory Pattern โ†’ UnitFactoryMB, BuildingFactoryMB
  • Data-Driven Setup โ†’ ScriptableObjects for Units & Buildings
  • Sprite Atlas โ†’ Packed via Unityโ€™s Atlas system
  • Responsive Camera โ†’ Dynamically resizes based on resolution & layout
  • UI Panels โ†’ TMP-based with dynamic info population

๐Ÿ’ฌ Notes

  • Custom spawn point is placed using right-click on ground with a building selected.
  • Selection line is shown using a LineRenderer, not a UI element โ†’ fully resolution-independent.
  • UI scales with CanvasScaler and adapts to both portrait and landscape.
  • Health bars and info panels are updated in real-time using Events.

About

Real-time strategy demo with base building, unit spawning, combat mechanics, and A* pathfinding in Unity.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors