Guppy Posted November 17, 2014 Share Posted November 17, 2014 To keep the GUI project from growing too abstract I had the idea of making a toy city game for my son where he can place down tiles with roads/grass/houses/traintracks and then put cars, trains and people in that will run around randomly. Seems fun and deceptively simple, but one thing I can't quite figure out is how to keep the cars on the road, the train on the track and let people walk on the pavements and cross the road. This lead me to two questions; Can I have multiple navigations meshes? ( on each for cars,trains and people ) how would each tile share what parts belongs to various navigation meshes? For 2) I'm thinking of making multiple collision meshes to cordon off the areas that are off limits, of course this depends on 1 being possible. But the documentation leads me to believe it is not, if it indeed is not how would you go about it? Quote System: Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k Link to comment Share on other sites More sharing options...
gamecreator Posted November 17, 2014 Share Posted November 17, 2014 Though there is only one navmesh per world, I believe you can make multiple worlds, and so as many navmeshes as worlds created. So I'd create a world/navmesh for the trains, world/navmesh for the cars and world/navmesh for the people. In your case it sounds like this will require varying collision meshes (as people can go everywhere and cars can cross tracks). Should be interesting to implement. Note that there will be a major lag when the navmeshes are recalculated (as calculation is slow) so you'll want to do that once the tiles are finished being placed (gameplay will need to stop). Quote Link to comment Share on other sites More sharing options...
randomkeyhits Posted November 17, 2014 Share Posted November 17, 2014 The whole thing is effectively a tile system right? Taking roads as an example I'd create a 2D binary array and every time I add a road location I set that tile to true. That way I only need worry about whether or not a vehicle can cross a tile boundary in a specific direction. So If I were travelling east at Roads[x, y] then I can continue if Roads[x+1, y] is true else I'd have to decide which way to turn. Same with trains and people. You can also imply some stuff too Roads[x,y] == true and Trains[x,y] == true means level crossing while Roads[x,y] == true and People[x,y] == true means pedestrian crossing. Then its about adding the unit level AI to use the arrays Quote content over form, game play over all. Link to comment Share on other sites More sharing options...
Einlander Posted November 17, 2014 Share Posted November 17, 2014 You can create tiles with prebuilt waypoints. The road waypoint has a key saying its a road, the sidewalk has a waypoint saying its a sidewalk. Cars only look for car waypoints and people look for sidewalks. The complicated part is getting the car to plot a path from a location to another exclusively using waypoints. Quote Link to comment Share on other sites More sharing options...
nick.ace Posted November 17, 2014 Share Posted November 17, 2014 Einlander and randomkeyhits: Is it possible to do this with the navmesh and pathfinding system built into Leadwerks though? I mean, you would essentially be having to program A* or something just for selecting the waypoints. That being said, that's probably the way to go for a tile-based game like Guppy described. Quote Link to comment Share on other sites More sharing options...
Guppy Posted November 18, 2014 Author Share Posted November 18, 2014 Yeah it seems like the sensible solution would be to make a grid based A* implementation, would've been nice to just have the engine solve it tho ^^ Quote System: Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k Link to comment Share on other sites More sharing options...
randomkeyhits Posted November 18, 2014 Share Posted November 18, 2014 As there is only the single navmesh you couldn't easily use it for multiple purposes if the requirements of the mobiles were different. In Guppy's case its to keep the roads and pavements separate. As part of a tile system, each tile could have a (or even more than one) pivot attached. That way the actual movement becomes a GoToPoint on a GetPosition of the selected pivot. Its a case of how much of the AI gets baked into the map vs how much is computational under the mobiles. Quote content over form, game play over all. Link to comment Share on other sites More sharing options...
AggrorJorn Posted November 18, 2014 Share Posted November 18, 2014 What I do for my own game is using the navmesh as a base for where movement is possible. Then I create my own layers of walkable areas on top of that (both waypoint and grid). When you look in to the recast repository it is actually not that common to make severall navmeshes. I also would have though this was something common but apparently this isn't the case. Quote Link to comment Share on other sites More sharing options...
randomkeyhits Posted November 18, 2014 Share Posted November 18, 2014 To be honest I'd love to be able to create my own shaped plain and designate it as a navmesh, being able to tailor something exactly for a scene is quite a powerful tool. Especially if I'm using several different meshes. This would mean extending the navigation commands though. Quote content over form, game play over all. Link to comment Share on other sites More sharing options...
xtreampb Posted November 18, 2014 Share Posted November 18, 2014 I thought that once the navmesh was generated, it could be updated realtime without much conflict. Such as, in the editor adding another navigation obstical would cause that area of the navmesh no longer reachable. I thought you could observe this in the editor. Been a while so i may be wrong. Quote bool Life() { while(death=false) { if(death==true) return death; } } I have found the secret to infinite life Did I help you out? Like my post! Link to comment Share on other sites More sharing options...
Olby Posted November 18, 2014 Share Posted November 18, 2014 I thought that once the navmesh was generated, it could be updated realtime without much conflict. Such as, in the editor adding another navigation obstical would cause that area of the navmesh no longer reachable. I thought you could observe this in the editor. Been a while so i may be wrong. Perhaps in 3.0 but since 3.1 its no longer real time, unfortunately. Quote Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64) Link to comment Share on other sites More sharing options...
nick.ace Posted November 18, 2014 Share Posted November 18, 2014 If I'm not mistaken, with the C++ version of Leadwerks, you can access recast functions directly and do threading, so you can recompute a small region of the navmesh instead of the whole thing. Personally, I would like to see these functions exposed to Lua. When I bought the engine, I had thought that dynamic pathfinding was a part of it due to a few dev videos that showed it, but I guess that was an earlier version like Olby said. 1 Quote Link to comment Share on other sites More sharing options...
beo6 Posted November 19, 2014 Share Posted November 19, 2014 I am also still waiting for dynamic navmesh generation to come back. It might be OK for simple things but games always have one or another dynamic obstacle 1 Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted November 19, 2014 Share Posted November 19, 2014 realtime navmesh updating was removed as of the terrain update. Which has been more than 1.5 years ago. You can update chunks of the navmesh instead of generating an entire new navmesh. This functionality is not exposed to Lua. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.