Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8155253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:37:07+00:00 2026-06-06T16:37:07+00:00

I’m a real speed freak if it gets to algorithms, and in the plugins

  • 0

I’m a real speed freak if it gets to algorithms, and in the plugins I made for a game.

The speed is.. a bit.. not satisfying. Especially while driving around with a car and you do not follow your path, the path has to be recalculated.. and it takes some time, So the in-game GPS is stacking up many “wrong way” signals (and stacking up the signals means more calculations afterward, for each wrong way move) because I want a fast, live-gps system which updates constantly.

I changed the old algorithm (some simple dijkstra implementation) to boost::dijkstra’s to calculate a path from node A to node B

(total node list is around ~15k nodes with ~40k connections, for curious people here is the map: http://gz.pxf24.pl/downloads/prv2.jpg (12 MB), edges in the red lines are the nodes),

but it didn’t really increase in speed. (At least not noticeably, maybe 50 ms).

The information that is stored in the Node array is:

The ID of the Node,
The position of the node,
All the connections to the node (and which way it is connected to the other nodes, TO, FROM, or BOTH)
Distance to the connected nodes.

I’m curious if anybody knows some faster alternatives in C/C++?
Any suggestions (+ code examples?) are appreciated!


If anyone is interested in the project, here it is (source+binaries):

https://gpb.googlecode.com/files/RouteConnector_177.zip

In this video you can see what the gps-system is like:

http://www.youtu.be/xsIhArstyU8

as you can see the red route is updating slowly (well, for us – gamers – it is slow).

( ByTheWay: the gaps between the red lines have been fixed a long time ago :p )

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T16:37:09+00:00Added an answer on June 6, 2026 at 4:37 pm

    Since this is a GPS, it must have a fixed destination. Instead of computing the path from your current node to the destination each time you change the current node, you can instead find the shortest paths from your destination to all the nodes: just run Dijkstra once starting from the destination. This will take about as long as an update takes right now.

    Then, in each node, keep prev = the node previous to this on the shortest path to this node (from your destination). You update this as you compute the shortest paths. Or you can use a prev[] array outside of the nodes – basically whatever method you are using to reconstruct the path now should still work.

    When moving your car, your path is given by currentNode.prev -> currentNode.prev.prev -> ....

    This will solve the update lag and keep your path optimal, but you’ll still have a slight lag when entering your destination.

    You should consider this approach even if you plan on using A* or other heuristics that do not always give the optimal answer, at least if you still get lag with those approaches.

    For example, if you have this graph:

    1 - 2 cost 3
    1 - 3 cost 4
    2 - 4 cost 1
    3 - 4 cost 2
    3 - 5 cost 5
    

    The prev array would look like this (computed when you compute the distances d[]):

           1 2 3 4 5
    prev = 1 1 1 2 3
    

    Meaning:

    shortest path FROM TO 
                     1  2 = prev[2], 2 = 1, 3
                     1  3 = prev[3], 3 = 1, 3
                     1  4 = prev[ prev[4] ], prev[4], 4 = 1, 2, 4 (fill in right to left)
                     1  5 = prev[ prev[5] ], prev[5], 5 = 1, 3, 5 
                     etc.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.