Page 1 of 1

Nerv:a library for controlled randomness

Posted: Sat May 31, 2014 11:34 am
by pelicano_o
Hi all,

The other day when I wanted a whale to jump out of the sea randomly and naturally, I ripped the concept of nerve impulse transmission off my biology lecture notes, and the outcome was surprisingly nice.

Image

I decided to make the concept into a library (using love.math.noise for randomness), and nervwas born.

nerv might be useful for The following scenarios:

1. make birds fly/frogs jump/fog lift randomly when player approaches
2. make enemies attack player randomly when player approaches and drastically reduce the chance of enemies attempting to attack when obstructed by obstacle
3. make customers leave the store with increasing chances as the waiting time increases
4. make interesting interactive patterns

The basic idea is that on each frame, stimuli are summed up, and if they are strong enough, a function that you supplied will be called. For a short period of time afterwards, the nerv instance will not respond to any stimuli.

Refer to Github for more explanations and documentation.
https://github.com/pelican2014/nerv.lua.git

Demos give you an idea of nerv.

Re: Nerv:a library for controlled randomness

Posted: Sat May 31, 2014 12:18 pm
by Oysi
Cool stuff. Simple idea that creates very interesting things.

Btw, I managed to get it to loop on itself =P

Image

Re: Nerv:a library for controlled randomness

Posted: Sat May 31, 2014 12:35 pm
by Roland_Yonaba
Hi, nice library.
I'd like to point out that this library is not tight to love2d (you might want to update the description on github). It can be use on any Lua based environment, as long as it is feeded with a delta time value, for updates.

Second, I noticed some functions need to check arguments before using them. In that respect, i would recommend to perform all the assertions first and then, use the arguments. As-is, using this lib with REPLers, in case one pcall's a method with some incorrect arguments, there are likely one or two assignements that will be made internally, leading to some unexpected behaviors...

Re: Nerv:a library for controlled randomness

Posted: Sat May 31, 2014 3:54 pm
by Germanunkol
This is really awesome. I just learned about the whole nerve impulse transmission again at university, it's a great topic and you're using it for awesome effects. I especially ike demo 2...

Re: Nerv:a library for controlled randomness

Posted: Mon Jun 02, 2014 12:35 am
by pelicano_o
Thanks for the awesome comments :awesome:
Roland_Yonaba wrote:I'd like to point out that this library is not tight to love2d
...
Good suggestions. Maybe I will implement them in the next version.

Re: Nerv:a library for controlled randomness

Posted: Mon Jun 02, 2014 3:40 am
by Karai17
God's in his heaven, all's right with the world.

Re: Nerv:a library for controlled randomness

Posted: Thu Jun 05, 2014 8:02 am
by gestaltist
Great stuff!

I am a big fan of biology informing computer science (genetic algorithms, neural networks, etc.).

Your demo looks very nice!