
[ad_1]
For a city-building recreation, I’d positively use a sq. grid, for one easy purpose: many real-world cities are constructed on a sq. grid plan, whereas only a few if any are constructed utilizing a hexagonal grid.
The predominant drawback of sq. grids is that, in the event you permit diagonal motion, a single diagonal step covers a bit (about 1.414 occasions) extra distance than an orthogonal step. The answer to this concern is to make diagonal motion barely slower to compensate; in the event you’re additionally measuring time in discrete ticks, having an orthogonal step tack two ticks and a diagonal step take three ticks provides a fairly good approximation to sensible motion.
The different choice could be to go “gridless”, permitting the participant to position roads and buildings at (roughly) arbitrary positions and angles. This could possibly be applied by having a really positive underlying grid (say, 0.1 to 1 meters per grid step), permitting roads to drawn in a straight (or curved) line between any two grid factors, and permitting buildings to be positioned at arbitrary positions and angles. Of course, this makes overlap and proximity checking a bit extra difficult, however it’s not that onerous to implement.
To make issues simpler for the participant, you may in all probability wish to snap highway endpoints to current roads and constructing entrances, and snap constructing positions and orientations to close by roads. (In explicit, if I attempt to transfer a deliberate constructing on prime of a highway, the sport ought to place it alongside the highway as an alternative.) You may wish to give the participant the choice to snap roads and constructing to a secondary, coarser grid (presumably with a customizable grid spacing) to make it simpler to maintain issues tidy. Depending on how fancy you wish to get, you would even let the participant rotate the grid or arrange a number of grids and customized information traces.
In any case, utilizing a gridless (positive grid) design and a positive time step eliminates any points with diagonal motion: as an alternative of counting ticks to maneuver one grid step in some route, you simply measure the gap alongside the highway from level A to level B (utilizing the Pythagorean theorem) and make the time proportional to that; the positive grid and time step make any roundoff errors negligible.
[ad_2]