Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoRTS

A real-time strategy game built in Go with the Ebitengine game engine. Fight a procedurally generated world: command your nation's armies, declare wars, hold defence lines, and conquer — or be conquered.

Go Ebitengine

Gameplay

Every game generates a fresh world: a Perlin-noise-driven continent split into 24 nations, each with its own procedurally generated name, flag, and capital. You command one of them; the others are driven by an AI that declares wars, marches armies along terrain-aware routes, and patrols its homeland in peacetime.

Wars don't just start — they're declared with a 30-second countdown, during which borders are sealed and both sides can prepare. Your units are produced automatically at your capital every couple of seconds — and production never stops, so your war machine keeps pumping out reinforcements for as long as you survive. Victory comes from out-manoeuvring, not out-clicking.

Features

  • Procedural world generation — elevation + moisture noise combine into 8 biomes: sea, land, desert, mountain, snow, badland, forest, and jungle.
  • Terrain-driven productivity — where your capital is founded shapes how fast you grow: jungle and forest capitals outproduce mountain, snow, and desert ones (both units and ships).
  • 24 AI nations — unique names, colors, and flags, carved from the terrain with a simultaneous BFS flood fill.
  • Terrain-aware combat — terrain under a unit modifies its speed and damage output; charging off a mountain grants a one-shot momentum boost.
  • Navies & amphibious warfare — coastal nations build two kinds of ships: warships that fight ship-to-ship battles and bombard enemy shores, and transports that carry marines who storm hostile beaches on landing (and need a warship escort to survive). Ships are amphibious: they can be ordered ashore to beach on any shore they may enter, but operating on land is punishing — they crawl, their guns fire at half power, and a beached hull is an easier target. Island and overseas nations are conquerable.
  • Territorial waters — a fleet claims the sea it sails, drawing sea borders and connecting its own islands to the mainland; lose control of the water and your islands are cut off again.
  • Occupied cities — a captured capital doesn't vanish: it becomes an occupied city that keeps producing units for its conqueror (on the same terrain-scaled cadence as a capital), and any cities a defeated nation had captured earlier change hands too. Overrun a city and its production stops.
  • Encirclement & surrender — units cut off from their capital surrender over time.
  • AI opponents — the AI declares wars once it has a large enough army, marches its forces to enemy capitals along routes that steer around slow ground, and launches naval invasions across the sea when a land route doesn't exist.
  • Zoom & pan — mouse-wheel zoom toward the cursor and WASD, arrow, or middle-mouse-drag panning; zoomed far out the map renders as a fast pre-built overview sprite.
  • Event banners — war declarations, conquests, and surrenders scroll across the top of the screen.
  • Zero assets — every texture, flag, and effect is generated in code.

Controls

Input Action
Left click Select the unit under the cursor (hold Shift to add)
Left drag (empty space) Rubber-band select all player units in the box
Left drag (on a unit) One-time move order for the selection
Right click / drag Persistent order (units hold the area until cancelled with C)
Left + Right drag Defence line: the selection deploys evenly along the line you draw
C Cancel orders (selection, or all of your units if nothing is selected)
Right click (on a ship) Sail the fleet; right-clicking a shore beaches the ship (it lands, but with reduced power)
X Declare war on the country under the cursor
WASD / Arrow keys Pan the camera
Middle-mouse drag Pan the camera
Scroll wheel Zoom toward the cursor
Enter Start a new game (also restarts after victory/defeat)
Esc Back to menu / quit

Requirements

  • Go 1.25 or newer — the engine dependency (Ebitengine v2.9.9) requires CGO on some platforms. See the Ebitengine installation docs for platform-specific prerequisites (e.g. GLFW/ALSA dev libraries on Linux, Xcode Command Line Tools on macOS).

Build & Run

go build -o gorts .
./gorts

Or run directly:

go run .

Tests

go test ./...

Project Structure

File Purpose
main.go Window setup, game loop, menu, camera, and world update orchestration
input.go Selection, orders, defence lines, and war declarations
terrain.go Noise-driven biome map generation
noise.go Multi-octave Perlin noise
country.go Nation assignment, procedural names, colors, and flags
unit.go Unit movement, collision, orders, and spawning
combat.go Combat mechanics and terrain multipliers
war.go War declarations, AI strategy, and army marching
naval.go Ships: sea movement, naval combat, coastal bombardment, marine landings
terrain_effects.go Terrain speed/damage modifiers and momentum boost
pathfind.go Terrain-aware route planning for AI armies
flags.go Procedural flag generation
textures.go In-code texture generation
camera.go Camera transforms, zoom, and panning
renderer.go Rendering the map, units, effects, and HUD

License

MIT

About

a RTS game base coded in GO

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages