Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - ninekorn

Pages: [1] 2 3 4
1
I am working on a version of AI learning/machine Learning for Void Expanse so that I can use that on the drones to make their movement better in game and also for their decision making. I am barely getting started in this though. I am currently working on a version of it based on the series by Sebastian Lague here : https://www.youtube.com/watch?v=bVQUSndDllU
He built his tutorial in Python, although that wasn't why I decided to learn a bit of Python a couple of days ago, it was actually for exporting TONS of objects and build XML files for Void Expanse all at the same time. I've decided to "try" and translate his Python tutorial of Episode 1 and 2 mathematical equations to c# inside of Unity and started playing with that. But I am encountering some "obstacles". For instance, when Sebastian Lague explains the mathematical equations in episode 1 and 2, there is something that I am missing. I don't know how he is using the "output" of the Neural Network. Is he "re-feeding" it into the neural network as inputs in order for the neural network to complete a certain number of iterations until it reaches the goal?

If anyone has any idea of how Machine Learning works, and has really good explanations that can be understood for a beginner, I would be really interested in asking questions. here is what I have so far.. Although the script is able to get to the goal whether it is closer to 1 or closer to 0 which is going to be perfect for me when using the Dot product for the movement in Void Expanse, I have no clue if this qualifies as a Neural Network.

Code: [Select]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;

public class SC_Neural_Network : MonoBehaviour
{
    double[] input;
    double[] weightsOne;
    double[] hiddenLayer;
    double[] lastHiddenLayer;
    double[] biasValueOne;
    double[] biasValueTwo;
    double[] output;
    double[] lastOutput;

    double[] currentOutputError = new double[2];
    double[] lastOutputError = new double[2];

    double[] currentHiddenLayerOutputError = new double[3];
    double[] lastHiddenLayerOutputError = new double[3];
    double[] lastHiddenPercentChanged = new double[3];
    double[] currentHiddenPercentChanged = new double[3];

    double[] weightsTwo;
    System.Random rand = new System.Random();

    double[] lastPercentChanged = new double[2];
    double[] currentPercentChanged = new double[2];

    public void Start()
    {
        input = new double[2];

        weightsOne = new double[6];
        hiddenLayer = new double[3];
        lastHiddenLayer = new double[3];
        biasValueOne = new double[3];
        biasValueTwo = new double[2];
        output = new double[2];
        weightsTwo = new double[6];
        lastOutput = new double[2];


        neuralNet(0.001, 100); // right now, can only use 0.001 or 0.999
    }

    double oriGoal = 0;

    int starter = 0;
    int finisher = 0;
    int someCounter = 0;

    //right now only working for input of 2 and hidden layer of 3 and output of 2 and biasOne 3 and biasTwo 2 and WeightsOne 6 and WeightsTwo 6
    private void neuralNet(double goal,int counterMax)
    {
        oriGoal = goal;

        while (someCounter < counterMax && finisher == 0)
        {
            if (starter == 0)
            {
                input[0] = rand.NextDouble();
                input[1] = rand.NextDouble();
                for (int c1 = 0; c1 < weightsOne.Length; c1++)
                {
                    weightsOne[c1] = rand.NextDouble();
                    weightsTwo[c1] = rand.NextDouble();
                }
                for (int c1 = 0; c1 < biasValueOne.Length; c1++)
                {
                    biasValueOne[c1] = rand.NextDouble();
                }
                for (int c1 = 0; c1 < biasValueTwo.Length; c1++)
                {
                    biasValueTwo[c1] = rand.NextDouble();
                }
                starter = 1;
            }
            else
            {
                input[0] = output[0];
                input[1] = output[1];
            }

            for (int c = 0; c < hiddenLayer.Length; c++)
            {
                hiddenLayer[c] = ActivationFunction(input[0] * weightsOne[c * 2 + 0] + input[1] * weightsOne[c * 2 + 1] + biasValueOne[c]);
            }

            for (int c = 0; c < output.Length; c++)
            {
                output[c] = ActivationFunction(hiddenLayer[0] * weightsTwo[c * 3 + 0] + hiddenLayer[1] * weightsTwo[c * 3 + 1] + hiddenLayer[2] * weightsTwo[c * 3 + 2] + biasValueTwo[c]);
       
                if (output[c] <= goal && goal >= 0.999)
                {
                    currentOutputError[c] = 1 - output[c];
                    lastOutputError[c] = 1 - lastOutput[c];

                    var totalDiffInError = Math.Abs(currentOutputError[c] - lastOutputError[c]);
                    currentPercentChanged[c] = totalDiffInError / currentOutputError[c];
                    var diffToGoal = Math.Abs(goal - currentOutputError[c]);

                    if (currentOutputError[c] >= lastOutputError[c])
                    {
                        for (int c1 = 0; c1 < weightsOne.Length; c1++)
                        {
                            currentPercentChanged[c] *= 1.19;

                            double someTest = (currentOutputError[c] * currentPercentChanged[c]);
                            weightsOne[c1] = weightsOne[c1] - someTest;

                            someTest = (currentOutputError[c] * currentPercentChanged[c]);
                            currentPercentChanged[c] *= 1.19;
                            weightsTwo[c1] = weightsTwo[c1] - someTest;
                        }
                    }
                    else if (currentOutputError[c] < lastOutputError[c])
                    {
                        for (int c1 = 0; c1 < weightsOne.Length; c1++)
                        {
                            currentPercentChanged[c] *= 1.19;

                            double someTest = (currentOutputError[c] * currentPercentChanged[c]);
                            weightsOne[c1] = weightsOne[c1] + someTest;

                            someTest = (currentOutputError[c] * currentPercentChanged[c]);
                            currentPercentChanged[c] *= 1.19;
                            weightsTwo[c1] = weightsTwo[c1] + someTest;
                        }
                    }
                }
                else if(output[c] >= goal && goal <= 0.001)
                {
                    //Debug.Log("test00");
                    currentOutputError[c] = 1 - output[c];
                    lastOutputError[c] = 1 - lastOutput[c];

                    var totalDiffInError = Math.Abs(currentOutputError[c] - lastOutputError[c]);
                    currentPercentChanged[c] = totalDiffInError / currentOutputError[c];

                    var diffToGoal = Math.Abs(goal - currentOutputError[c]);


                    if (currentOutputError[c] >= lastOutputError[c])
                    {
                        for (int c1 = 0; c1 < weightsOne.Length; c1++)
                        {
                            currentPercentChanged[c] *= 1.33;
                            double someTest = (currentOutputError[c] * currentPercentChanged[c]);

                            weightsOne[c1] = weightsOne[c1] + someTest;

                            currentPercentChanged[c] *= 1.33;
                            someTest = (currentOutputError[c] * currentPercentChanged[c]);
                            weightsTwo[c1] = weightsTwo[c1] + someTest;
                        }
                    }
                    else if (currentOutputError[c] < lastOutputError[c])
                    {
                        for (int c1 = 0; c1 < weightsOne.Length; c1++)
                        {
                            currentPercentChanged[c] *= 1.33;
                            double someTest = (currentOutputError[c] * currentPercentChanged[c]);
                       
                            weightsOne[c1] = weightsOne[c1] - someTest;

                            currentPercentChanged[c] *= 1.33;
                            someTest = (currentOutputError[c] * currentPercentChanged[c]);
                            weightsTwo[c1] = weightsTwo[c1] - someTest;
                        }
                    }
                    /*else //not used but if the above variable 1.33 is less than 1.19, it breaks the script and i gotta implement this part
                    {

                    }*/
                }
                else if(output[c] <= goal && goal <= 0.001 || output[c] >= goal && goal >= 0.999)
                {
                    finisher = 1;
                    Debug.Log("FINISHED AND REACHED GOAL");
                }

                lastPercentChanged[c] = currentPercentChanged[c];
                lastOutput[c] = output[c];
               
                Debug.Log(output[c]);
            }
            someCounter++;
        }
    }

    double ActivationFunction(double x)
    {
        return (1 / (1 + Mathf.Exp((float)-x)));
    }
}



EDIT: this can hardly be qualified as a neural network except for the variable names in the script. I am far from the goal. Will keep learning and searching for more info on how to implement a working version in c# or javascript.





2
Hi, I just wanted to know if when using the generator.AddNPCShipToSystem if the position x and y are actually rounded instead of using the exact location where i want them spawned.

Below picture shows why i am asking. I am able to create destructible parts from Blender and then from the destructible parts, i am creating "turrets" without AI to drive them, and I put their weapon invisible, which makes it so that i have static Walls in place for the station and those walls are destructible. Although I set the correct pivot location for every object in Blender and double checked they were correctly aligned, they aren't spawned where i want them to in Void Expanse. Any ideas why?




EDIT: Nevermind about my question.... I just printed to console and the correct position is supposed to be set. That is confusing me.

3
Mods / 9sMODs - Part 2.3 of 9.0 - RELEASED - Range Combat drones
« on: June 10, 2019, 10:01:00 pm »
9sMODs part 1 of 9 Released - IN BETA VERSION - UNSTABLE... DOWNLOAD AT YOUR OWN RISK.... REASON is the simple colliders that I am using for stations are incompatible with the farseer physics implementation. Until there is a fix, I'd have to remodel ALL of the station interiors to fit "I dont know" what type of parameters.

https://steamcommunity.com/sharedfiles/filedetails/?id=1766918802

Title: 9sMODs part 1 of 9
Author(s): ninekorn
Description: Station Interiors with the Galaxy Market
Mod version: 1.0.0
Game version: Latest
Game mode: singleplayer and multiplayer


The MOD includes:
-ALL stations INTERIORs (untextured)
-The Galaxy Market
-The ability to rebuild turrets (without a cost for now)
-The Onboard Ship Computer to access the Galaxy Market from your ship. Not really usefull for the moment unless you are a trader. It will be a MUST once the drones MOD is released though.

TODO list:
1. Correctly rotate the turrets that are defending the stations.
2. Texture the station Interiors
3. Put a price on the re-building of station turrets depending on the level of the station.
4. Check for compatibility with the Expansion Pariah's Bane. NOW COMPATIBLE AS OF PATCH 2.0
5. Placing lights inside of all stations where they are supposed to be.
6. There seems to still be a Collider Bug affecting the MOD. If you save the server each 5 minutes, you will only lose the difference because you will need to restart your server. I have made sure to modify polygon colliders to NOT touch any other polygon Colliders but the bug is still present. I will continue investigating.


EDIT:
*Quick fix for the station Interior Collider crash that doesn't even work... it seems that it might never have been the station colliders the issue but more the fact that many miner squads are spawned on top of each other and on the station colliders... I tried that and it doesn't work. I'm gonna have to keep seeking the culprit. But the bug is not reliably happening at the same time every time.

EDIT 2019-06-12
*Another quick fix - I completely removed the Polygon Colliders from the science station. Seems more stable now. Will continue testing.

EDIT 2019-06-13
*Another quick fix - All polygon Colliders of the Military Stations have been removed except 3. currently testing the server with ONLY military stations generated in the server. I will provide screenshots soon! ;)

EDIT 2019-06-14 - 01h18AM
*Latest FIX - I have completely refactored all Polygon Colliders of All station interior models so that no Polygon colliders touch any other types of Colliders. So the station interior colliders still contain Polygon Colliders, much more box colliders, as per the Physics Adjuster tool of Void Expanse. Will continue testing to see stability.

EDIT 2019-06-16 - 00h28
*Latest FIX - I thought I had completely removed the Mining Station Polygon colliders on the 12th of June but I had just refactored them to not be touching anything else and still it was crashing the server... After many attempts at trying other things I decided to go back to the mining station and remove ALL polygon colliders except one(all stations have 1 polygon collider). Finally something stable happened. I will be leaving my private server online tonight to see how stable it is.

EDIT 2019-06-16 - 02h28
*Latest FIX - NOT UPDATED ON STEAM YET - Still unstable so i removed ALL of the station Interior Polygon Colliders that ever existed in the stations interior scripts. Testing right now.

EDIT 2019-06-16 - 02h28
No polygon colliders. Increased Physics calculations to try and increase the occurrence of the bug...



4
Help section / Collider hangs main Thread question?
« on: June 09, 2019, 08:56:18 pm »
Hi, I got this physics issue in my server. I am trying to push for a release of a basic Station Interior Mod but right now Id be releasing with a bug that crashes the server... Im not sure exactly why it does that. If anyone can help please.


5
Help section / array of object inside objective
« on: May 09, 2019, 09:48:14 pm »
Hi,

I need some help trying to put an array of objects inside of an objective? Is it possible and if it is, how do I do it?

On the official wiki page it shows this: "npc.AddObjective(25334, "go_to_jumpgate", {jumpgate_id: 15});"

But if I put and array of objects instead inside the "object parameter", it gives me the error below?




Does anyone have any ideas?

nine

6
Bug reports / Colliders Server Thread Aborted crash?
« on: May 03, 2019, 05:02:16 pm »
Hi,

Here is the image of the current bug I am facing. Is it due to too many colliders on the same object?


7
Hi,

I am trying to correctly UVmap the Station Interior in Blender. The problem is that Void Expanse at it's highest graphics is awesome but NOT my UV mapping as blender is doing things wrong. This is still a question that is for Void Expanse importing .obj models.

I am doing the SEAMS of the objects separately and THEN using SmartUVMapping and THEN use CTRL-J to join/fusion all objects... At that point, I press Tab to go in EDIT mode and the UV mapping is all wrong. Alternative is if I use UNWRAP in Edit Mode on the fusioned Model, the UV mappings are on TOP of each other which doesnt work either.

I gotta work on this tonight in order to release the station Interior MOD tomorrow. If anyone has ANY ideas of another free program or how to perfectly do UV mapping in Blender with COMPLEX objects of 9000 vertex++, please help.

thank you,
nine


EDIT: Nevermind... I might have found the solution. It seems that I hadn't correctly done the seams on the Mining station. I did also activate the "Magic UV" pluggin... Dunno if that helped.

8
Help section / static NPC?
« on: May 01, 2019, 04:58:11 pm »
Hi ai_enabled or/and Lurler,

Again, the basic interior station MOD V1.0 is almost completed. But I wanted to know if there is something that i can do to have a static NPC. Meaning - a NPC that doesn't move.

I have thought of a couple of things:

  • making a NPC Stick to point
  • to make its WEIGHT super HEAVY.
  • to make the collider WEIGHT super HEAVY.
  • to make its speed 0 and acceleration 0 inside of the calculateShip.js script
  • to use opposite direction force with addtorque/addforce
  • All of the above combined


The reason is I want the interior station MOD V1.1 to incorporate destructible stations. I can put a NPC that has an empty hull but individually attach the Stations colliders to it to make it stay EXACTLY where the station is and BAM if the npc is destroyed by hitting its colliders that are positioned EXACTLY where the station walls are, the station is also destroyed... That is how i have thought of making them destructible.

Any ideas of a better way or static NPC function?

Oh and i have got no clue if 30++ colliders on an NPC will affect the game performance. It might hit it hard.

nine

9
Help section / player spawning question?
« on: April 30, 2019, 10:20:16 pm »
Hi, The station MOD is almost ready for release. The basics and most important are done: interior station models, colliders, unwalkable tiles...

Now I need to setup the spawn points for players to be more distanced to the starting station but cannot seem to find the setting where to modify it.

I would need help on that. I think i know how to spawn turrets already and specify which position i need them.
nine

10
Help section / cleaning up of my posts on the forums?
« on: April 28, 2019, 06:08:40 pm »
Hi, I would like to know if its possible to change some of my posts to the correct forum sections... For instance, Ive got a lot of crap going on in the mods section of the forum that I would change to the MOD INFO section instead.

Also, I would like to know if I can modify some titles of those Posts?

nine

Its nothing urgent. It just feels unorganized because of me.

11
Bug reports / Concave Collider Server Error?
« on: April 24, 2019, 12:15:17 am »
I need some help figuring out the current Error. Here are images of my current collider for the interior of the station outpost. It only has 4 polygon colliders and those don't seem to be working on stations? is that normal? I was trying to limit the number of colliders for each stations while building the physics for them otherwise I will have to use a LOT of cubic/box colliders in order to cover all the parts.



12
Help section / Void Expanse distance of view option?
« on: March 06, 2019, 04:22:41 pm »
Hi,

I am pretty sure that I saw somewhere that I could change the distance of view for players. I would need to change that setting as the station models are disappearing too soon. Is it possible and if it is, where is the setting again?

nine

13
Modding info / Void Expanse Free ASSETS.
« on: March 03, 2019, 12:15:07 am »
Hello guys,

So here are the assets:

********* GIMP assets. *********

1. Those are only the original dismantled sprites of items, with the background picture removed and with item rarity or "MK0 to MK5". If I remember correctly, I was able to clean ALL of the item assets with Gimp in order for them to be ready for the infinite items mod. You just have to install GIMP and then open up every GIMP project and export the sprites (PNGS). With an export pluggin in GIMP it is faster.

https://drive.google.com/open?id=1X0zMSLVuj-73KwMPLm4RNj6Pw5gVb7Ca

nine

14
Help section / Overriding a whole folder of scripts in Cryofall?
« on: March 02, 2019, 04:19:43 pm »
Let's say I want to override a full folder of Cryofall, to get rid of all the scripts inside of it for testing purpose.

In Void Expanse, I had to manually "comment out" each scripts that I didn't want or remove all "function calls" towards those scripts and put those scripts in the MOD folder of Void Expanse. As for XML Files, I would have to make them unavailable in the shops etc..

Removing the scripts for the core.cpk in the Steam folder wasn't the way to go in Void Expanse so I presume I cannot do this either in Cryofall? So Let's say I want to remove all Mobs to start off. I want to remove all items, all tech trees, all world objects, all weapons, all skills, all quests etc... I want to know how the server loads Cryofall first and foremost and how the world is created, not how the objects are created. I want to know where and when the world starts if thats a better explanation. If anyone knows already, it would be much appreciated to have an explanation and I am more than willing to write down in my scripts that explanations are coming from other modders for the credit of how I was able to get there myself.

I have decided to go in another path for modding Cryofall. At first I wanted to build an infinite weapons/items and Zombie/Skeleton Mod but now I want to go a different way.

Any help is appreciated.

nine


 

15
Hi, ai_enabled or Lurler.

I tried everything many times in corefunctionality.js to try and activate more than 1 system at a time with only 1 player in the game. It NEVER has been working.

I didn't find a loophole BUT, it seems that if I put a "timer" linked to a function inside of the AI scripts, then make them jump to another system, the script of the AI is still alive so to say, because the timer functionkeeps debugging me information but the AIDecision function is not working because the NPC physics are deactivated.

This made me think of this. Could it be easier to just remove this "deactivating" function instead of making all systems alive at all times. I'm just saying coz that is something  that I have been looking forward to for a long, very long time in Void Expanse.... to have more than 1 system alive at all times.... If the system isn't alive but I am able to use the NPC's physics, would I be able to control the NPC AIDecision in the other system without the physics affecting the "upper layer" system? I mean, it must be layers that you guys have used to do this game, I suspect so if it is layers and physics are independant from one system to another, then only reactivating the physics/movement capabilities of the ship and AIDecision on whatever layer they are on could make it so that we have multiple "AI's alive" in different systems in Void Expanse... well, the systems won't be alive but the AI will still be which would make everything that exists in other systems, accessible by AI's... I don't need to see what they do, I need to read the debug window on what they do, to know if they are following the correct orders, like going to a base, fighting another ship, trading with another station etc.

Thank you for taking the time to answer. And please consider this for the next Void Expanse update. like pretty pretty please. Like a blitz fast update that would make it possible for me to work on that new option. It's all for Void Expanse and the station mod and whatnot that I'm working on.

I want to make a "persistent" Game/Mod. I know that performance will be crucial in those cases so I'm always wary of that when I code especially since Void Expanse is NOT multithreaded but it still has a lot of capabilities. I know you guys are working hard on Cryofall but please consider it.

EDIT: lol i tried addingForceToObject to the NPCs ship that are on the other system but it has no effects. I also tried using the "set ship as arrived from jumpgate" method because it reactivates the physics for a second but unfortunately, the physics are deactivated right after that because the NPC isnt in the same system as I am. No loopholes. prooves the game is well coded lol.

Pages: [1] 2 3 4