Game
Territory — The schoolyard land-grab game
A Unity remake of the childhood alleyway game where flicking a stone home in three throws claimed the ground it traced. A casual strategy game built on touch trajectory drawing and physics.

View larger

View larger

View larger
Overview
A Unity mobile remake of the childhood game where you flick a stone and, if it returns to its starting point within three throws, the path it traced becomes your land. You aim with your finger, and the stone's bounces off walls and obstacles turn territory expansion into a game of angles.
Key features
- Touch trajectory drawing: swipe to set the stone's direction and power
- Physics-based bounces: Unity 2D Physics computes reflections off walls and obstacles
- Area calculation: return near the start after three bounces and the enclosed area is claimed automatically
- Territory stealing: overlap a new path onto existing land to take it from an opponent
- AI opponents: play against an AI that optimises for maximum area
Technical challenges
The hard parts were polygon collision handling and area calculation. Reflected paths are drawn live with a Line Renderer, and territory changes are computed through polygon intersection and union operations.
// Polygon area (shoelace formula)
float CalculateArea(List<Vector2> polygon) {
float area = 0f;
int n = polygon.Count;
for (int i = 0; i < n; i++) {
int j = (i + 1) % n;
area += polygon[i].x * polygon[j].y;
area -= polygon[j].x * polygon[i].y;
}
return Mathf.Abs(area) / 2f;
}
Gameplay
- Swipe to set the stone's direction
- The stone travels, bouncing off walls (up to three reflections)
- Return near the starting point and the enclosed path becomes your territory
- Whoever claims more of the board wins
Project details
Category
Game
Completed
February 5, 2025
Reading time
2 min read
Tech stack
UnityC#2D PhysicsMobile