Activity

tothtamaszeteny

I managed to make the color changing work, it was a formatting issue on the C++ side and parsing issue on the JS side. I did a LOT of reworking on the C++, like storing synapse class members inside of a vector in each neuron class member, which removes the hard limit of 4 synapses for each neuron. So now the simulation can handle unlimited synapses, but the IPC can’t yet. That’s why I started working on having the JS write to- and the C++ read from a JSON file to not have a limit on neurons and synapses. It’s not done yet though. I also started making it more realistic, so I added a Leaky integrate-and-Fire equation which now adds voltage gradually and does constant voltage leaking instead of it just adding and removing voltage in cycles. I also added refractory times to make it more realistic, which determines for how long a neuron can’t fire again, even if there is sufficient voltage. Furthermore, I added synapse weights, since those also affect neuron firings IRL.The JS logic is set up, and it can even write correct data to the JSON, but again, the C++ JSON side isn’t implemented yet, so the video demo is of a slightly older version where I’m still passing in data via the Neutralino API, which is why I’m not showing the different synapse weights in action. Lastly, I did some trial-and-error, and centered the neurons on the canvas when they change color.

0
tothtamaszeteny

I made the logic behind the stimulation button work, and now the messages look like this:
clk2000_nct03/0,1,/1,2,/2,/_?1!
With the numbers between the ? and ! being the stimulated neurons. Therefore I also added a parser in the C++ and now the stimulated neurons start with a voltage of 10 (or more if stimulated multiple times)
Okay, so here comes the part where my past stupidity makes my current-self suffer;
Since synapses are only stored unidirectionally, we need to check whether ANY neurons are connected to the neuron.at(i) we are looking at in the loop cycle, since the neurons are effectively blind to any ones that are incoming to them. So I had to setup a bunch of loops that check if any neuron is bound to the one that is stimulated (not the other way around!) and add stimulation to those.
Also made it send the neuron voltage levels to JS, and make it change the color of the neurons based on the voltage level. It kind of works sometimes, but needs debugging. Maybe a std::cout.flush().

0
tothtamaszeteny

I added a slider to change the timeout between each round of simulation, between 200ms and 5000ms in steps of 100ms. And now the mainscript.js can parse and format all data needed for the C++. I needed to do this because for some reason I can’t really push multiple inputs from the JS to C++ via Neutralino updateprocess, so I need to send ALL of the data needed for the simulation in one single message. Idk why it does this, but whatever. So I put all needed data, like the timeout, neuron count, and each neuron’s ID and the other neurons they are connected to, into a single string that looks like this: clk1000_nct05/0,1,2,/1,3,4,/2,4,/3,2,0,/4,0,/
Currently, the solution in the C++ that gathers the data from this string is very messy and inefficient, while only allowing for single-digits, but for a NeuronActivation 1.0, it’s fine, I’ll find a better solution if I have time to continue this project
I decided to ditch having a seperate thread for the clock in C++ and now it’s just a while(1) loop in main with a chrono timeout and runs the simulate function each round.
So currently, I can take in and parse all needed data, change the data of each member of the class, and run the simulate function, though it’s buggy and doing stuff it’s really not supposed to, so I’ll have to look into that.
I also added a stimulation button to the options, which will make the voltage of a specific neuron high enough (to 10) to trigger the surrounding ones to start the simulation. Though the logic behind it isn’t fully set up yet.

0
tothtamaszeteny

I made a few UI updates, like picture backgrounds, changing the color and text content of the Start button on click, and making the bar of buttons vertical. I fixed the bug where neurons could only be connected in a daisy chain instead of making unique connections. It’s kind of a duct-taped fix instead of finding the root of the issue, but it works just fine. I also setup the logic behind the Start/Stop button and made the NeutralinoJS API start a .exe (written in C++) with Stdin and Stdout so I can send in the starting data without having to try and get the C++ to read a Json file with the info. Also, turns out that I had arrays set up completely well, the console was just lying to me and displaying it in a weird way.
I’m probably forgetting a bunch of stuff, but a lot I’ve been doing besides what I just described is bug fixes.
I hope the video file goes through

Also, I’m pretty sure that the “Screenshots of code (e.g. VS Code) won’t be accepted” warning was added way after I made my first two devlogs of this project, so please forgive me for that, flavortown team….

0
tothtamaszeteny

It’s been quite a while since the last log; I’ve been working on some different stuff, so this devlog is just what I did like 2 weeks ago. I’ve set up a counter for how many neurons there are, and also added the feature to tie neurons together with synapses, though it’s a bit buggy right now. I also now have two arrays, one for X coords and one for Y coords of neurons, which allow me to actually select neurons and stimulate them or add synapses. There is another array, this one multidimensional, which is supposed to have as many rows as neurons on the canvas and have each row store all the neurons that that one neuron is connected to via synapses.

neuronsSynapses.push([]); //add new row to synapses array. (first number is neuron id)

But for some reason, right now it just adds the same numbers to every part of the array. Like if I have 5 neurons on screen, I will have 5 rows and all of them will have numbers 0-5, even if none of them are connected by any synapses. This is one of the more major things I spent time debugging, but I can’t see what I wrote wrong.

On the simulation side, I haven’t done an insane amount of work, I basically just made all classes and members of them global to make working with them easier, because I also now have a second thread acting as a clock, which will call the functions to do one (1) step of simulation each tick.

That’s most, bye.

Attachment
0
tothtamaszeteny

Okay, so I made some basic artwork for the different voltage levels of the neurons, I got an HTML canvas setup and a JS script to make the neuron appear at where I click on the canvas. I still need to figure out how to resize the image in JS or maybe just resize the actual png because it’s way too large right now. I don’t have a pipe between JS and C++ set up yet, but on the sim C++ script front; I have implemented a clock thread that will trigger all the functions in discrete timesteps so it goes level-by-level. I also made a fairly basic simulation function so far, that just loops through all elements of the neuron class (in a vector), check if trigger==true (which means the voltage is >= 10), then goes through all of the synapses of that neuron, checks whether they’re excitatory or inhibitory and adds or removes 2 voltage levels of the neurons connected to it like this:

if(neuron.at(i).trigger == true){
    if(neuron.at(i).synapse1.excitatory == true){
        neuron.at(neuron.at(i).synapse1.sideB).voltage += 2;
    }
    else{
        neuron.at(neuron.at(i).synapse1.sideB).voltage -= 2;
    }

If you couldn’t tell programming is not my strongsuit so far… Now you can lol. That’s about all I have now. Cya

Attachment
0
tothtamaszeteny

Alright, afterall, I ended up switching from WA to NeutralinoJS, because I already have some experience with it. But I’m still doing the backend in C++; which, I’m kinda screwing myself over with, because working with classes in C++ is kinda annoying, like, I have to put all classes in a vector to be able to loop over them, which is annoying and a bit cursed (though this might just be a skill issue on my part). The counter says this devlog will log 2+ hours of work, which would probably be a lot of time for others, but all I’ve managed to do so far is 91 lines of C++ where I set up classes, put them in vectors, assign IDs, and I also have a random number generator function for the signal threshold. That’s really all I can say rn, bye.

Attachment
0
tothtamaszeteny

Alright; devlog. I’m not very good at coding (electronics and cad is more my ballpark), but the best way to learn is to do, so might aswell make something difficult. Right now, I’m thinking about doing this in webassembly, because it’s easy to make an HTML frontend and I can make the backend in C++, which is fast and also the language I’m best at. I have no clue how to do communication between JS and C++, but I’m hoping there’s some easy way in this framework, because I don’t want to deal with pipes, while JSON editing would be insanely slow and inefficient. That’s all for now

Attachment
0
tothtamaszeteny

So, I’m not really good at coding; electronics is more my ballpark, but what better way to learn than by doing?
I quickly brainstormed an Idea about an IDE that gives snarky/sarcastic comments based on what you’re typing. I probably won’t be able to get it working, but let’s give it a shot.

Attachment
0