Lee Kao Posted July 30, 2017 Share Posted July 30, 2017 Hey everybody, I'm trying to revive an old project I worked on about 5 yrs ago, back then we used jQuery for all of our animations and UI and since then the world had progressed so I'm rewriting most of the code while trying to use the existing assets as much as I can (and we have lots of assets, mostly graphic and audio), one of the the assets is a map of the city the game is played on (attached), the existing code places a table above this image and has a json that defines which tiles are passable and use A* to plot the way, the movement itself was between tiles and the animation is really sluggish, I'm sure there is a better way to do this with today's tools (canvas maybe?) and would love any advice or input you can share on the issue. Quote Link to comment Share on other sites More sharing options...
Nesh108 Posted July 31, 2017 Share Posted July 31, 2017 Are you familiar with pathfinding in general, @Lee Kao? Anyway, here is a rough list of things you would need to do: Create a graph containing each location (Vertex) and their connection (Edge). Example: V(Bistro) connects to V(EBN) and the cost is 1 (arbitrary value). Store it as you like. Feed that graph into a pathfinder (Dijkstra, A* or whatever) for the pair {current_player_position, target_position} Animate the movement from starting point to end point Note: make sure you add also Vertices for transitions (e.g. points representing parts of the streets), in that way you can simplify the logic for the movement and rely purely on the path returned by your pathfinder. Have fun! Quote Link to comment Share on other sites More sharing options...
Lee Kao Posted July 31, 2017 Author Share Posted July 31, 2017 I'm sorry if I was unclear about my question, English is not my native language, we already have the code that calculates the path (using A*), what I'm asking about is the actual implementation of the animation on the map, what framework should I use or what tools. 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.