Inspiration
Divide N Conquer draws inspiration from classic territorial strategy games and the intricate dynamics of geopolitical mapping. The thought of slicing an area to conquer is not new. However, doing it with limited resources on a certain geography presents an interesting problem
What it does
"Divide N Conquer" is an interactive web-based game where players strategically draw lines to divide a main territory into smaller regions. The objective is to expand your "green" territory, capture valuable landmarks, and maximize your score, all while managing a limited "line length" resource. The game features a dynamic map that can be panned and zoomed, and a scoring system that rewards both area control and landmark acquisition. Players must carefully plan their moves to avoid splitting the "regime stronghold" (represented by a grey circle around the capital) and to efficiently use their available line length before the game ends.
How we built it
The game was built using a combination of HTML, CSS, and vanilla JavaScript. The interactive map and all game elements are rendered dynamically using the HTML Canvas API, allowing for precise control over drawing and animations. GeoJSON data is used to define the initial map shape, which is then transformed and scaled to fit the canvas. Core game mechanics, such as polygon splitting, line-polygon intersection detection, and point-in-polygon checks, were implemented using custom geometric algorithms. User interactions like drawing, panning, and zooming are handled through a robust event listener system for both mouse and touch inputs, including pinch-to-zoom functionality. Responsive design principles were applied to ensure the game is playable and visually appealing across various screen sizes.
Challenges we ran into One of the primary challenges was implementing the complex geometric algorithms required for polygon splitting and intersection detection. Ensuring these calculations were accurate and performed efficiently, especially during real-time drawing and manipulation, was crucial for a smooth user experience. Another significant hurdle was making the canvas and its drawn elements truly responsive across different devices and zoom levels, while maintaining correct aspect ratios and handling diverse touch gestures. Debugging visual issues on the canvas and optimizing rendering performance for a fluid interaction were also key areas that required careful attention.
Accomplishments that we're proud of
We are particularly proud of successfully implementing the polygon splitting logic, which is the core mechanic of the game, allowing for dynamic territory division. The intuitive drawing and manipulation of lines, coupled with responsive panning and zooming, creates a highly engaging and satisfying interactive map experience.
What's next for Divide N Conquer
For future development, we envision several exciting enhancements for "Divide N Conquer." New scoring methods are also being experimented with.
- Local leaderboard
- Global leaderboar
- Perimeter based scoring
- Experimenting with multiple strongholds
- Adding rivers
Built With
- css3
- devvit
- html5
- javascript
- redis
Log in or sign up for Devpost to join the conversation.