[MOD] Galactic Waez navigator

Discussion in 'The Hangar Bay' started by HoberMellow, Sep 16, 2021.

  1. HoberMellow

    HoberMellow Lieutenant

    Joined:
    Sep 16, 2021
    Messages:
    12
    Likes Received:
    25
    @imlarry425 I was thinking something similar about using a client as fallback but alas, sounds like a no-go. I have _another_ fix on branch reverse-starfind, which I'll explain...

    I was poking around a memory dump of a vanilla game for more clues about the data structure. It has 16,945 stars but immediately before the star data I saw the number 36353 ... where have I seen that number before? Your error report from yesterday! I've seen 17519, you and @ASTIC have reported 3209 and 1931 ... all these numbers are prime! C# Dictionary<> (maybe other collections, too?) is array-backed, resizable, and likes to use a prime number capacity. So, I think what's happening is the data structure is being resized (for the unfamiliar, when the backing array is full, the data are copied to a new, larger array) but the StarFinder is finding a previous array that hasn't been garbage collected yet. So, I adjusted StarFinder to work backwards through memory, to increase the odds that it finds the right array.
    Man, I hope I'm right (or someone educate me).

    All that said, @ASTIC, I wonder if the server problem is timing. For SP, initialization doesn't happen until GUI.IsWorldVisible. That's just to guarantee that the stars have been generated before it starts. MP will need a similar delay, or just wait for an admin command.

    I'll add a command to store the star data, and have waez look for stored data to use and only scan if it's not there.
     
    #21
  2. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,094
    Likes Received:
    735
    @HoberMellow The problem on the server isn't timing, it's just that different events have to be used there than in SP - since some are only fired in that mode and others are fired at different times. That's what makes it so costly for testing and debugging.

    As I said it is not impossible but time costly ;-)
     
    #22
  3. imlarry425

    imlarry425 Captain

    Joined:
    Jan 10, 2019
    Messages:
    465
    Likes Received:
    340
    @HoberMellow with the classic caveat that you can never really be sure with an intermittent fault- apparently invoking JWJ Williams (the father of heap memory) and walking backwards was the correct spell! It's (so far) worked 100% for me using the revised branch. 8^)
     
    #23
    HoberMellow likes this.
  4. bbk.3164

    bbk.3164 Commander

    Joined:
    May 17, 2016
    Messages:
    235
    Likes Received:
    88
    I support - because when traveling across the galaxy - it takes a very long time to MANUALLY pave your way for the next jump (!)
    Therefore, automation is NECESSARY (!) :)
     
    #24
  5. Raven_Ta2

    Raven_Ta2 Ensign

    Joined:
    Jan 22, 2020
    Messages:
    24
    Likes Received:
    17
    Outstanding! Plotting long trips with an upgraded warp drive is so much easier now. Just one suggestion: Would it be possible to make waypoints automatically appear on the HUD? Maybe with an extra command like /waez to _____ HUD or something?
     
    #25
    Myrmidon and HoberMellow like this.
  6. HoberMellow

    HoberMellow Lieutenant

    Joined:
    Sep 16, 2021
    Messages:
    12
    Likes Received:
    25
    Glad you like it! I think that would be doable; I'll definitely take it as a feature request.
     
    #26
  7. HoberMellow

    HoberMellow Lieutenant

    Joined:
    Sep 16, 2021
    Messages:
    12
    Likes Received:
    25
    Just dropped an update. Fixed the reliability problem with finding the star data, and it now stores the positions in your savegame. Also, you no longer need to do a restart to apply warp upgrades after turning in nav data (Eden).
     

    Attached Files:

    #27
    imlarry425 and ravien_ff like this.
  8. HoberMellow

    HoberMellow Lieutenant

    Joined:
    Sep 16, 2021
    Messages:
    12
    Likes Received:
    25
    New update:
    -'Show on HUD' checked by default for waypoints*
    -option to specify warp range when navigating e.g. "/waez to --range=55 Foobar"
    (it doesn't know your ship's warp range)
    -commands for troubleshooting (see help)
    -commands for changing visibility of waypoints*
    -improved help that works like the console command

    There is also a server mod included in the .zip file (disabled by default). Interested parties are encouraged to try it out and tell me what's missing/broken :D. Just know that I have only tried it on local co-op by myself at this point. Loading existing saves should work fine, but if starting a new one Waez will probably fail to start. If the status is InitFailed, do "/waez restart scan-only" and it should be good. There's also a "ginfo" command that tells how many stars it found so you can make sure it's right.

    *You have to exit/reenter for added/changed/removed waypoints to change on screen. The changes are reflected immediately in the Galaxy Map view, but I have yet to figure out how to refresh the main view.
     

    Attached Files:

    #28
    willderyes, ravien_ff and Myrmidon like this.
  9. Myrmidon

    Myrmidon Rear Admiral

    Joined:
    Mar 26, 2016
    Messages:
    1,736
    Likes Received:
    2,066
    I will have to re assign a chat shortcut to test this. How come and it does not work through console?

    Upd: After testing the mod for a while I have to say the following :

    1. Useful tool but with room to improve. For the refresh on the HUD feature maybe you should try to talk with Eleon.
    2. I tested it with vanilla, and scenarios Craftable Epics and Reforge Eden. It works but for some reason it can not take into account the warm drive range properly, at least with pinfo. I have to make further tests for this.
    3. I think the game responsiveness becomes slower when doing specific tasks. With craftable epics scenario it was not much of an issue but with Reforged eden it was noticeable. Again it might be me, need further testing.
    4. For some reason if the player have not set a bookmark on the galaxy map, waez can not plot the jump bookmarks between current location and target, even if the target system or planet do exist. It always need the bookmark first to plot the jumps.


    PS Thank you for the much useful tool. I think many players need it. I hope you can make ti work for those who play MP games. I play SP and I love it already. It has features much needed in the game, which I have requested a couple of times in the past. Do not forget to make it known on discord under the mods channel. Who knows you might find extra help there for further development too.
     
    #29
    Last edited: Oct 12, 2021
    ravien_ff and HoberMellow like this.
  10. imlarry425

    imlarry425 Captain

    Joined:
    Jan 10, 2019
    Messages:
    465
    Likes Received:
    340
    Hiya @Myrmidon ... I'm working on an offline version of a similar solution to teach myself Python and have looked/tweaked on @HoberMellow 's solution (nice C# BTW (with VS integrated unit tests!)) and can give you a cut at the answers to some of those:

    1. Fingers crossed- several places where being able to trigger a db/client synch refresh would be nifty;
    2. While iPlayer would let you know what ship the user was in or piloting, I (and I assume HM) haven't figured out a straight forward way to figure out what type of warp drive or it's range is installed in that ship. The pilot can also get a navigation buff and that's an easy db lookup;
    3. This is due to two factors: number of stars and drive range. Pathing algorithms operate on a data structure called a graph which is made up of nodes (stars) and edges (warp paths between stars) and Eden, for example, has 4x as many stars in it's universe than a vanilla game and the Reforged epic drives have greater range and thus increase the number of edges. An easy way to visualize how computers interact with a graph is using what's called an adjacency matrix (see: Representation of Graphs: Adjacency Matrix and Adjacency List - The Crazy Programmer) and for an undirected graph the worst case number of edges is (N^2)/2 - N for a ship like "The Heart of Gold" with an infinite improbability drive- this is exponential growth and the time to create the graph structure comes from that. HM's done some things with using bounding boxes to optimize range checks but the N^2 is still an issue;
    4. The tricky (!) mechanism that's being used by this mod to get at the galaxy map yields coordinates (the x/y/z key) but it doesn't have the names of the stars at those locations (the alternate natural key) ... creating a bookmark at the destination creates a db entry with the name and the x/y/z for the "to" in from/to and the intermediate points can be bookmarked based on location without actually knowing their names.

    If anybody has clever ideas on how to get star names or the warp capability of a vehicle entity please yell! I'd love to get that info too.
     
    #30
    ravien_ff and HoberMellow like this.
  11. Myrmidon

    Myrmidon Rear Admiral

    Joined:
    Mar 26, 2016
    Messages:
    1,736
    Likes Received:
    2,066
    @imlarry425 Thank you for the reply. Wish I had the knowledge to jump into it and help you. One other player I know is @byo13. If you like and if he can, may give you insights regarding the db. All I can do is test any feature you guys introduce to the tools find bugs if any and propose ideas for improvement. The community thanks you :thumpUp:
     
    #31
    byo13, imlarry425 and HoberMellow like this.
  12. HoberMellow

    HoberMellow Lieutenant

    Joined:
    Sep 16, 2021
    Messages:
    12
    Likes Received:
    25
    Thanks @Myrmidon for the feedback! I just want to add a little bit to what @imlarry425 said (everything he said is spot-on):
    2. I hope to figure this out, and I hadn't thought about the discord :facepalm:. The workaround is the --range option that lets you override the range waez calculated for you.
    3. The obviously huge tasks of building the galaxy map (which takes about a minute on my machine for RE galaxies) and pathfinding are done in separate threads in hopes of preventing that, but especially the map construction task eats RAM so it really might cause some lag. Good thing it only has to be done once:). Some of the other things it does might be slower than I anticipated and might also need to be done in separate threads. If you can point out specific situations, it would help. I'll be testing, too.
     
    #32
    ravien_ff and imlarry425 like this.
  13. Myrmidon

    Myrmidon Rear Admiral

    Joined:
    Mar 26, 2016
    Messages:
    1,736
    Likes Received:
    2,066
    The slowing down is noticed mostly when loading and exiting a save game. Also when resuming after being killed. Bellow are the screenshots I took after those situations showing the console. Like you said RE loading takes around 1 minute to complete when waez is active in the mods directory. My PC conf is R73700X @ 4,3 GHz !16GB RAM and GTX 1070 at 1987GHz. Most visual details are maxed except shadows in low and reflections medium.

    Screenshot from 2021-10-13 13-11-09.png Screenshot from 2021-10-13 13-12-13.png Screenshot from 2021-10-13 13-24-44.png
     
    #33
  14. byo13

    byo13 Captain

    Joined:
    Jul 13, 2020
    Messages:
    417
    Likes Received:
    641
    Whoa. This looks promising and very very useful.
    Gonna try it soon. Thank you.
     
    #34
  15. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,094
    Likes Received:
    735
    I'm working on my EmpyrionGalaxyNavigator ... (reactivate/refactor it)
    upload_2021-11-27_18-19-52.png

    with some cool ideas from @HoberMellow
    I'm curious to see how much of it I can get to work in MP server mode.

    PS: Unfortunately, the complete galaxy map is only available in SP.
     
    #35
  16. Myrmidon

    Myrmidon Rear Admiral

    Joined:
    Mar 26, 2016
    Messages:
    1,736
    Likes Received:
    2,066
    If it works for visited star systems, at least this way, there can be a team of explorers that their job would be to visit new system for all the server players to use with the navigator.
     
    #36
    byo13 likes this.
  17. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,094
    Likes Received:
    735
    #37
    byo13 and Myrmidon like this.
  18. Myrmidon

    Myrmidon Rear Admiral

    Joined:
    Mar 26, 2016
    Messages:
    1,736
    Likes Received:
    2,066
    Ok I see you designate that it is for MP here. Please update in your page also. Thank you.
     
    #38
  19. byo13

    byo13 Captain

    Joined:
    Jul 13, 2020
    Messages:
    417
    Likes Received:
    641
    That's awesome! Can't wait to test it.
     
    #39
  20. Xador

    Xador Ensign

    Joined:
    May 24, 2022
    Messages:
    1
    Likes Received:
    0
    Hey!

    I tried to set the BaseWarpRangeLY parameter in the config.ecf, but i doesn't seem to work. Maybe wrong syntax or wrong file. Can someone give me a dummy help on how to set it in a fixed file?

    Kind Regards
     
    #40

Share This Page