Menu

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.

Show posts Menu

Topics - ninekorn

#2
discontinued 2023 july 29th . by ninekorn
#4
discontinued 2023 july 29th . by ninekorn
#5
discontinued 2023 july 29th . by ninekorn
#6
Hi,

I was about to test better memory management/memory clear in my pathfind project and i started having an error:



what happened is that i had an error in my script that i hadn't noticed but thought it wasn't there. So i put the scripts in my mod folder, and started the game. Cryofall gave me a warning that there was an error with my mod. I quit cryofall, but then steam cloud gave me an error that there was a difference between the local save and the cloud save. I chose the local save... Since then i cannot launch cryofall after uninstall/reinstall.

please help.
nine

EDIT2023june02-01h40am: i found the issue. there was a script that wasn't working so i removed it sccspathfindmovement.cs.
#7
discontinued 2023 july 29th . by ninekorn
#8
Hey guys,

I cannot set my profile picture on the forums. It says "The attachments upload directory is not writable. Your attachment or avatar cannot be saved".

It is not urgent.

thank you though,
nine
#9
discontinued 2023 july 29th . by ninekorn
#10
Hi,

I think ai_enabled answered my question somehow on this post https://forums.atomictorch.com/index.php?topic=989.msg6198#msg6198 but i don't remember even seeing the post where he says:

QuoteAnother problem with global variables - we cannot serialize them easily and write into the savegame. So even if we had global variables (shared across all the scripts), it will be very easy to write bad code (which will prevent the game from properly saving the game state). So, we have storage scripting API instead. It's also very limited, but for the most cases, it was enough to get the things done.

So, every global variables that i am creating in my scripts, cannot be serialized and saved during a savegame if i understand correctly? do i need to empty the global variables before a savegame happens, or should i just from now on use the storage API instead for storing the global variables that i need? There is a lot of global variables in the AI scripts i developed in the libs section of my mod and i am currently trying to fix my galaxy market mod, and after that i am jumping on my AI scripts logic. I am not familiar with serialization of code and will go read a bit on that soon.

Thank you for your time answering,
9

Edit: It is not just my galaxy market the issue, it might not even be. I've set my globals variables to be inside of functions instead, so they are local variables for arrays, and the rest is using storage.SetGlobal... Thank you for understanding my frustration here.



I am using storage.SetGlobal for all of my variables that i need to access from other scripts or npcs. Should i use storage.Set instead? Is there a limit to the number of variables that i can storage.SetGlobal to in Void Expanse? It is easy to debug which script or variable is causing issues when you have the source code. When you don't it's a needle in a haystack with that kind of error that doesn't point to anything precise on where to look for the issue.

For instance, i use 4 scripts for the salvaging device. 1 script for the device, 1 script for storing the salvageable items in a global variable, 1 script for checking the player inventory, 1 script for activating the device with a library on specified coordinates.



using(npc);
using(console);
using(timer);

var SC_Salvage_Object_Storage =
{
    AddSpaceObjectToStorage: function (system_id, SpaceObjectID, randomYieldToStartOff)
    {
        if (storage.IsSetGlobal("systemid_" + system_id + "_salvage"))
        {
            var toReceiveData = storage.GetGlobal("systemid_" + system_id + "_salvage");
            var objectdata = { sys_id: system_id, id: SpaceObjectID, yield: randomYieldToStartOff, GameTime: timer.GetGameTime() };
            toReceiveData.push(objectdata);

            storage.SetGlobal("systemid_" + system_id + "_salvage", toReceiveData);
            /*var someTest;
            var toReceiveData = storage.GetGlobal("drone_mining_added_" + chosenPosition);

            var droneData = { id: droneid, index: droneIndex };
            toReceiveData[droneIndex] = droneData;
            storage.SetGlobal("drone_mining_added_" + chosenPosition, toReceiveData);*/
        }
        else
        {
            var toSendData = [];
            var objectdata = { sys_id: system_id, id: SpaceObjectID, yield: randomYieldToStartOff, GameTime: timer.GetGameTime()};
            toSendData.push(objectdata);
            storage.SetGlobal("systemid_" + system_id + "_salvage", toSendData);
        }
    },
    GetSpaceObjectStorageLength: function (system_id)
    {
        if (storage.IsSetGlobal("systemid_" + system_id + "_salvage"))
        {
            var toReceiveData = storage.GetGlobal("systemid_" + system_id + "_salvage");
            return toReceiveData.length;
        }
        else
        {
            return 0;
        }
    },


    RemoveFromYield: function (system_id, SpaceObjectID, currentYieldMinus)
    {
        if (storage.IsSetGlobal("systemid_" + system_id + "_salvage"))
        {
            var toReceiveData = storage.GetGlobal("systemid_" + system_id + "_salvage");

            for (var s = 0; s < toReceiveData.length;s++)
            {
                if (toReceiveData[s].id == SpaceObjectID)
                {
                    toReceiveData[s].yield = toReceiveData[s].yield - currentYieldMinus;
                    break;
                }
            }

            storage.SetGlobal("systemid_" + system_id + "_salvage", toReceiveData);
        }
        else
        {
            console.PrintError("the space object doesn't exist in the global array and this message is never supposed to print even with a console debug_reinit. If it prints, tell me. 0");
        }
    },

    SetDepleted: function (system_id, SpaceObjectID)
    {
        if (storage.IsSetGlobal("systemid_" + system_id + "_salvage"))
        {
            var toReceiveData = storage.GetGlobal("systemid_" + system_id + "_salvage");
            var s = 0
            for (s = 0; s < toReceiveData.length; s++)
            {
                if (toReceiveData[s].id == SpaceObjectID)
                {
                    toReceiveData[s] = null;
                    break;
                }
            }

            toReceiveData.splice(s, 1);

            storage.SetGlobal("systemid_" + system_id + "_salvage", toReceiveData);
        }
        else
        {
            console.PrintError("the space object doesn't exist in the global array and this message is never supposed to print even with a console debug_reinit. If it prints, tell me. 1");
        }
    },


    GetSpaceObjectYield: function (system_id, SpaceObjectID)
    {
        if (storage.IsSetGlobal("systemid_" + system_id + "_salvage"))
        {
            var toReceiveData = storage.GetGlobal("systemid_" + system_id + "_salvage");

            for (var s = 0; s < toReceiveData.length; s++)
            {
                if (toReceiveData[s].id == SpaceObjectID)
                {
                    return toReceiveData[s].yield;
                }
            }
        }
        else
        {
            console.PrintError("the space object doesn't exist in the global array and this message is never supposed to print even with a console debug_reinit. If it prints, tell me. 2");
        }
    },
};



using(npc);
using(console);
using(timer);

var counterFrame = 0;
var counterDevice = 0;

var SC_Salvage_Object_Timer =
{
    ClearCurrentDevice: function (sys_id, device_id, ship_id, slot_id) //IsWorking
    {
        game.IsShipPlayerControlled(ship_id);

        var playerName = game.GetShipOwner(ship_id);

        if (storage.IsSetGlobal("GlobalIndex_Player_" + playerName))
        {
            var someGlobalIndex = storage.GetGlobal("GlobalIndex_Player_" + playerName);


            if (!storage.IsSetGlobal("systemid_" + sys_id + "_ship_" + ship_id + "_salvage_device_" + device_id))
            {
                storage.SetGlobal("systemid_" + sys_id + "_ship_" + ship_id + "_salvage_device_" + device_id, { swtch: 1, ship_id: ship_id, device_id: device_id, slot_id: slot_id, timer_id: null, reset: 1 });

            }
            else
            {
                var globalSalvageStorage = storage.GetGlobal("systemid_" + sys_id + "_ship_" + ship_id + "_salvage_device_" + device_id);

                if (globalSalvageStorage != null) {

                    if (globalSalvageStorage.timer_id != null)
                    {
                        //timer.AddOrUpdate("CustomOnFrame", null);
                        //timer.AddOrUpdate(0.25, "CustomOnFrame", null, 1); //

                        game.ShipStopSound(ship_id, "mining_process_" + slot_id);
                        visual.DeviceDeactivateEffect(ship_id, device_id, "mining_visual_effect");

                        timer.ClearTimer(globalSalvageStorage.timer_id);

                        var data = { swtch: 1, ship_id: ship_id, device_id: device_id, slot_id: slot_id, timer_id: null, reset: 0 };
                        storage.SetGlobal("systemid_" + sys_id + "_ship_" + ship_id + "_salvage_device_" + device_id, data);


                        //console.PrintError("cleared device timer: " + globalSalvageStorage.timer_id);
                        return 1;
                    }
                    else
                    {
                        //console.PrintError("null timer0");
                        return 0;
                    }
                }
                else
                {
                    //console.PrintError("null globalSalvageStorage");
                    return 0;
                }

            }
        }
    },

    SetDevice: function (sys_id, device_id, ship_id, timer_id) //IsWorking
    {
        game.IsShipPlayerControlled(ship_id);
        var playerName = game.GetShipOwner(ship_id);

        if (storage.IsSetGlobal("GlobalIndex_Player_" + playerName))
        {
            var someGlobalIndex = storage.GetGlobal("GlobalIndex_Player_" + playerName);

        }
    },

    AddDeviceID: function (sys_id, device_id, slot_id, ship_id, timer_id)
    {
        game.IsShipPlayerControlled(ship_id);

        var playerName = game.GetShipOwner(ship_id);

        if (storage.IsSetGlobal("GlobalIndex_Player_" + playerName))
        {
            var someGlobalIndex = storage.GetGlobal("GlobalIndex_Player_" + playerName);

            //storage.GetGlobal("systemid_" + sys_id + "_ship_" + ship_id + "_salvage_device_" + device_id); //, { swtch: 1, ship_id: ship_id, device_id: device_id, slot_id: slot_id, timer_id: timer_id}

            var globalSalvageStorage = storage.GetGlobal("systemid_" + sys_id + "_ship_" + ship_id + "_salvage_device_" + device_id);

            if (globalSalvageStorage != null) {

                if (globalSalvageStorage.timer_id != null)
                {
                    timer.ClearTimer(globalSalvageStorage.timer_id);
                    //console.PrintError("cleared device timer: " + globalSalvageStorage.timer_id);
                }
                else {
                    //console.PrintError("null timer1");
                }
            }
            else {
                //console.PrintError("null globalSalvageStorage");
            }

            var data = { swtch: 1, ship_id: ship_id, device_id: device_id, slot_id: slot_id, timer_id: timer_id, reset: 0 };

            storage.SetGlobal("systemid_" + sys_id + "_ship_" + ship_id + "_salvage_device_" + device_id, data );
        }

        var deviceArray = [];


        if (deviceArray == null)
        {
            deviceArray = [];
        }
        var objectData = { sys_id: sys_id, device_id: device_id, ship_id: ship_id };
        deviceArray.push(objectData);

        var arrayData = { index: deviceArray.length - 1, length: deviceArray.length };
        return arrayData;
    },

    AddCounterFrame: function ()
    {
        counterFrame++;
        return counterFrame;
    },

    GetCounterFrame: function () {
        return counterFrame;
    },

    ResetCounterFrame: function ()
    {
        counterFrame = 0;
        return counterFrame;
    },

    AddCounterDevice: function () {
         counterDevice++;
         return counterDevice;
    },

    GetCounterDevice: function () {
        return counterDevice;
    },

    ResetCounterDevice: function () {
        counterDevice = 0;
        return counterDevice;
    }
};




#11
Help section / Setting up a Range Skeleton Archer?
September 30, 2019, 12:05:49 PM
Hi,

I am almost done setting up the Skeleton Archer, I have the animations ready for the front, the back will take me about 1-2 hours to finish but the shooting doesn't work. Im not sure in which script I would indicate that the archer actually needs to shoot arrows?

I've got 3 scripts for each MOBS data, not including the spawning of them.

*MobSkeletonArcher.cs => General Data
*SkeletonSkeletonArcher.cs => Skeleton Data
*ItemWeaponSkeletonBow.cs => Mob Weapon Data - its set as a range weapon as i checked the pistols and other range weapons but the Skeleton actually shoot anything and no damage is done to the character.


So i still would need to setup arrow projectiles to be shot from the bow and to make the scripts actually tell the SkeletonArcher to Shoot...

Please help!

nine
#12
discontinued 2023 july 29th . by ninekorn
#13
Help section / Making JSON animations for Cryofall?
September 28, 2019, 03:03:27 PM
Hi, I am trying to make new characters for Cryofall. My goal is to make Skeleton MOBs Swordman/Axeman/Archers from 3d models that i have. There will also be different equipments on them. I can easily do the 3d to 2d conversion but how would i make the JSON files?

I've purchase the software Spine Essentials 1 day ago, yesterday, and noticed that i cant even use InvertedKinematics options on the original JSON MAleFront SkeletonBones as it says its a feature from Spine Pro? anyone knows of any alternatives? If i remove the IK, it breaks all of the animations and i would have to re-do them myself. That is my last solution coz over 200$ for what little Spine Esoteric Software does, i'd rather use my money somewhere else. I feel i got totally ripped off paying over 80$ CAD for the Spine Essential.

I still like the software though as it makes for such an easy workflow but its so overpriced that it saddens me.

EDIT: Nevermind, It seems to not be that much harder without IK. Im going to keep on making the original animations without IK so that i can use them for my characters.
#14
Ideas and suggestions / Cryofall Map Modification?
September 26, 2019, 09:12:27 PM
Hi,

I am getting annoyed by my personal projects. Recently I've had a ton of "lacking knowledge" to move forward on a physics engine, on my VR Texture2d to Geometry shader for minecraft type of terrain... etc... I am getting so annoyed and the next step in Void Expanse is a pain too. Gotta create colliders out of blender made destructible station parts by calculating the width and depth of object inside of blender using Python... I didn't start writting a script for that, i got annoyed before i started.

I read the Cryofall Forums Posts and Mods a bit and wanted to get more info on the current capabilities of the Cryofall engine. The last time I tried to build a server, my goal was to remove EVERYTHING from the game except for the player and the MAP. My goal was to find a way to modify the map OR create another "instance" of the map so that players can move from map to map. My goal was to understand the Core of Cryofall before re-adding the assets. I failed and left Cryofall behind.

My questions are:
1. Do you have any plans to make Cryofall kinda "infinite 2d terrain"?
2. Do we already have access to API that modifies the terrain size?
3. Do we already have access to API were you can create a second MAP from script and have access to it from ingame?
4. I think I saw that RPG Maker MV and maybe the other engines in the RPG Maker series have maps of Limited sizes but where you have the ability to make Multiple MAPS and have access to them IN/OUT fashion and still have the ability to control the AI from different maps. Can this be achieved in Cryofall and/or if it's not incorporate yet, do you have the plan to incorporate it?

I checked the forums a bit and didn't see a similar post. Please point me to any post that could be relevant to the subject if there is already some on that subject. I want to change my hobbies a bit AKA VoidExpanse/FAil Personal project 2D Physics Engine (Lacking knowledge on Mathematical equations relating to velocity and angular velocity)/ or API of SharpDX....

Thank you for your time in answering.
nine
#15
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.


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.




#16
discontinued 2023 july 29th . by ninekorn
#17
discontinued 2023 july 29th . by ninekorn
#18
Help section / Collider hangs main Thread question?
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.

#19
discontinued 2023 july 29th . by ninekorn
#20
Hi,

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