Jump to content

Advice on creating map from image

Lee Kao

Recommended Posts

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. 


Link to comment
Share on other sites

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! :) 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...