sccspathfind => javascript void expanse mods pathfind to Cryofall c# mobs scripts RELEASED - rev 1.123 - STABLE [client + server]rev1.123. i had made corrections to the dot product and somehow 0.45f using the dot product thinking it was close to 45 degree angle wasn't giving any good results, as the mob was trying to move at approx 45 degrees and the pathfind was resetting and the mob stopping. I fixed that. I also decided to separate the functions of the scripts sccspathfind.cs and sccspathfindactions.cs and put them in separate scripts to reduce the size of the scripts in kb as they were really high at over 90kb. (looking like this now it almost felt like i was just changing the names of functions and variables of the sebastian lague's pathfind tutorial on youtube. I understand you there. well it's years back thinking i could just name a function differently and add lots of things inside to fit my purpose and say it's my function now haha and then reference who i learned from which is pointless and ridiculous to name them differently but i wanted to release asap so i will see if i can rename some functions/scripts to try and stay true to the basic pathfind architecture and function naming of who i learned from). In order to do this, i had to create multiple scripts that do the same thing as rev1.122. but this time, the size in kb is much lower and it should help a tiny bit also for the performance during gameplay maybe. Also i cleaned the last unused using statements that i hadn't cleaned up in rev1.122.
Things i have developped differently or similarly:
1. negative/positive loops for inverted positive flatindex where supposedly flatindexing is faster than using multidimensional arrays, but sincerely using flatindexing after such a long time and never really testing/benchmarking if it's faster or not, i wouldn't be able to say if this pathfind project converted with multidimensional arrays would be better or not.
2. no check for list.contains. accessing everything by index only. I use arrays as i had done some tests way back and it felt as if accessing arrays were faster than lists or i was just using lists the wrong way. But i use 2d lists for the main pathfind data to be held within a script and i am unsure if that was a good approach but since i have to increase the size of the collection, i prefered to use a list. But i think using only lists will be something i will test also later, or dictionaries for the main lists in sccspathfindarrays.cs.
3. grid index retrieval using a spiral form of indexing if i can call it that, where i interpret the index as if when adding through a list is always added in a spiral form... And visualizing it that way, and doing trial and errors. And fetching the index in the spiral indexing of a list, only additions/substractions/multiples are required to fetch the index. no check for contains. no divisions. But my functions to fetch the grid index isn't perfect. far from it. I hadn't been able then to develop a fully customizable sizeable grid size. Also, i tried to approach the grid spiral indexing in 3d, and i am unsure how to approach that problem and tried and failed as of yet.
4. no multithreading, but useful since it's a per frame pathfind (not entirely per frame yet, because i still use 2d loops for checkallsides and for building a grid and for looping through the list of obstacles while building the grids) which aren't a per frame 2d flat loop which i will add later, and i also loop the neighboorlist entirely each frame so my pathfind isn't per frame per say yet.
5. linkable pathfind grids where it doesn't matter where the target would be in a map, what matters is, is the array/list that holds the pathfind nodes/openset/closedset/listofgrids will have enough memory available on the computer or maximum allowed memory allocated by the program? hence why i have put multiple switches and maximum allowed retracepath iterations, maximum allowed creation of grids. I will bring those variables in the sccspathfindglobals.cs the moment i release rev1.124.
I will work later on a sizeable pathfind grid if i can in my next revisions, where the nodes are smaller in size and where the pathfind is way more precise, and i will try to incorporate multithreading to have better pathfind results if i can. Also, small grids, don't make my pathfind technique better, it makes the process of pathfind smooth on the cpu where looping on too large grids can be a problem when big grids require big memory allocations, but that's how void expanse modding forced me to code like this. But looping a big grid of pathfind and having the target found on one grid, is something i couldn't do back then in void expanse modding which forced me to have to go through trying to develop my homemade pathfind project. There are still bugs. Try at the risk of losing players ranting because they die more often, otherwise if you try the pathfind project, i hope you like it.

I will stop posting many posts per day on the same projects. Only one if i really have a very decent update to the pathfind from now on. I have put my scripts in the folder "Scripts" so that the pathfind project is easy to drop into a mod that isn't already modifying the original Cryofall Mobs. thank you for trying the project. I will try and set this up as a Cryofall mod for the steam workshop soon.
Repository:https://github.com/ninekorn/sccspathfind2D-csharpPath to the project:https://github.com/ninekorn/sccspathfind2D-csharp/blob/main/Cryofall/stablePathfind exceptions:Doesn't work yet on retreating mobs like chicken and starfish and others like those.
Doesn't work yet on boss mobs.
Doesn't work yet on some special mobs with abilities.
List of changes:May 18, 2023, 01:32:37 pm » pathfind mod revision 1.05
2023-may-28 - 04:42:17 pm - RELEASE 1.063 - PATHFIND ON ALL SERVER+CLIENT MOBS. SCRIPTS INCLUDED FOR MOBS AND PATHFIND.
EDIT2023MAY28-20h11-BUG FIX: there was an annoying bug where mobs that the player had never seen before, were moving away from the player when the player was seeing them for the first time. Bug fixed. The player was null so the mob was aimlessly going wherever. REV 1.063
2023-may-29- released revision 1.1 stable. Pathfind for all mobs with exceptions. Rev 1.1 released now stable. now the pathfind is individually taken care of by my scripts and there shouldn't be any entertwining of the path in memory between any mobs anymore. This is approx my approach that i did for void expanse modding player drones back then but i never had done it for the entire server enemies before. I hope you guys enjoy it. next step in development maybe, is making it better, cleaner, and adding different settings for the different mobs as currently they all act the same way with the pathfind. The npc pathfind path currently is slow to refresh a new path. i know and i will work on improving/tweaking that part and it shouldn't affect much the performance by making the npc try to discover a new path faster. Multiple settings are available to choose from to decide how many times per frame should the pathfind launch and a lot of other settings. I will work tomorrow on giving a better description as i am tired and need to go sleep.
2023-may-29-release rev1.11 - Rev1.11 released . The pathfind path for each Cryofall npc now restarts faster to get a new path, if the npc is heading away from the character when already moving through a path. which in turns makes the npcs more aggressive as they are getting closer to the player faster. Also i have cleaned up the mobs scripts, and moved the pathfind action logic into a new script sccspathfindaction.cs so that it's easier to work with instead of pasting all of it in the mobs scripts everytime that i do a single modification.
2023-may-29-release rev1.12
2023-may-29 - at 11:22:00 pm - 1.122.
2023-may-30-release rev1.123
developed by steve chassé aka ninekorn