New answers tagged

1

I have it :) var blockHeight = 15; var blockWidth = 30; var zoom = 2; for (var x = 0; x < 10; x++) { for (var y = 0; y < 10; y++) { var screenX = Math.floor((x * (blockWidth * zoom - zoom * 2) / 2) + (y * (blockWidth * zoom - zoom * 2) / 2)); var screenY = Math.floor((y * (blockHeight * zoom - zoom * 1) / 2) - (x * (blockHeight * zoom - ...


1

One approach to a multilayered map would be an array (or 2-dimensional array) of linked lists or vectors holding tile objects. So your tile struct would either hold a pointer to the next tile above it, or you would have "stacks" of tiles of varying heights spread across the grid. Essentially that creates a 3D array. A nice, albeit old article on ...


0

I'm aware of two ways to do system simulations. One is macro models. You create formulas that takes areas densities in account and evaluate likely traffic at various hours, and that gives you an "extensive variable" (in physics science terms). This technique is the fastest, and most controllable, but potentially less realistic and also boring. The other is ...


2

The simple solution would be to just have each actor calculate the ideal path using A* and then stick to it. Implement each lane of a road as a first-in-first-out queue. The edges in your A* graph should be the lanes, not the tiles. When a car wants to move onto a lane but that lane is already occupied by the maximum number of cars, they simply wait until it ...



Top 50 recent answers are included