All MicroEvals
A hard test for a hard game genre.
Create MicroEval

A hard test for a hard game genre.

Prompt

I am building a 2D isometric modern warfare RTS game. I need you to design and implement the core system for Line of Sight (LOS) and Directional Cover (Defilade). Please write the foundational code (in C# or C++) and explain your architectural decisions for a system that meets these constraints: The Grid & Elevation: The game uses a 2D isometric tilemap, but logically functions in 3D. Tiles have varying elevation levels (e.g., ground level is 0, a trench is -1, a hill is 2). Obstacles (walls, sandbags, buildings) occupy tiles and have specific height values and "material thickness" (e.g., concrete vs. wood). True 3D Line of Sight: A unit on a hill (elevation 2) should be able to see over a wall (height 1) to spot a target on the ground (elevation 0) behind it, provided the angles align. The "Defilade" Mechanic (Directional Cover): When Unit A fires at Unit B, the system must calculate if Unit B is in cover. Cover is purely directional. If Unit B is behind a half-wall relative to Unit A, they receive a defensive bonus. If Unit B is in a trench (elevation -1), they have cover against ground units, but no cover against mortar fire (parabolic trajectory). Performance: This is an RTS. Up to 300 units may need to calculate LOS and cover states simultaneously every few frames. Deliverables: The data structures for the Grid, Tiles, and Units. The math/algorithm for translating 2D isometric coordinates to calculate a 3D raycast/LOS check. The algorithm for determining if a unit has directional cover against a specific incoming attack vector. A detailed explanation of how you would optimize this to maintain 60 FPS with 300 active units (e.g., spatial partitioning, bitmasking, caching).

Drag to resize
Drag to resize
Drag to resize
Drag to resize
Drag to resize