Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Q: What do we get with the 3D?
- A: There's data behind it being 3D, but as far as why I render it in 3D, it's just for fun. As far as data is concerned, the heuristic is weighted based on change in elevation. It will prefer to go down hill (since that's less effort), as long as it's not blatantly in the wrong direction.
- Q: Maybe the color relates to 3D?
- A: The map is a generation of 2D noise. The noise is represented as a height map. The colors on the map correspond to height values of each tile. Based on the intensity of height, you see three separate biomes:
- • noise value below 0.3125 (5/16) will be generated as a lake. The color of the water indicates how deep it is, but for calculating heuristic and rendering, all water tiles are "water level" (5/16). Color ranges from dark blue (0) to light blue (5/16).
- • noise value above 0.6875 (11/16) will ge generated as a mountain. Color ranges from rock grey (11/16) to snow white (1).
- • Noise values between 5/16 and 11/16 are generated as a gradient from sand to forest. Color ranges from sand yellow (5/16) to forest green (11/16)
- Q: Can you go over and not over certain things?
- A: Every tile is traversable, but the heuristic changes based on what type of tile you're on (or moving to).
- • Heuristic on grass of sand is unchanged (except for taking elevation into consideration).
- • Heuristic on mountains is doubled due to increased effort from rocky terrain. If it determines that going over a small mountain is better than going down and around, it will.
- • Heuristic ON water is unchanged, *BUT*, there is a huge heuristic increase when you transfer from land to water (or vise versa). This is akin to spending time waiting for a ferry; embark/disembark.
- Other notes: When two cities are connected, it will convert the path into a road (Represented as brown). If you make two new cities on the same map and the path finds a road, the heuristic from one road tile to the next will be significantly reduced.
- The camera movement was fun to do. The camera will always move towards the best tile, but, it's done so behind two layers of smoothness. In each draw loop, there's a "Target" position (moving 1/100 the distance to the best tile), and a "Target Target" position (moving 1/100 the distance to the "Target" position). This negates any jerky (and nauseating) camera movements. Also, the further from the start point you get, the more it zooms out so that you can see the whole path.
- Bugs: Every once-in-a-while, the program will freeze when you go to select the second city of a new pair of cities. Could be after the first pair, could be after the 12th. I have a feeling it's because of a rogue while-loop somewhere, but everything that leads up to it seems to be working as intended.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement