Nerv:a library for controlled randomness

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
pelicano_o
Prole
Posts: 13
Joined: Sun Mar 09, 2014 1:44 am

Nerv:a library for controlled randomness

Post 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.
Attachments
demos.love
(6.7 KiB) Downloaded 168 times
User avatar
Oysi
Prole
Posts: 48
Joined: Fri May 02, 2014 11:18 pm
Location: Earth

Re: Nerv:a library for controlled randomness

Post by Oysi »

Cool stuff. Simple idea that creates very interesting things.

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

Image
Follow the potato. Achieve enlightenment.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Nerv:a library for controlled randomness

Post 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...
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: Nerv:a library for controlled randomness

Post 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...
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
pelicano_o
Prole
Posts: 13
Joined: Sun Mar 09, 2014 1:44 am

Re: Nerv:a library for controlled randomness

Post 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.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Nerv:a library for controlled randomness

Post by Karai17 »

God's in his heaven, all's right with the world.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
gestaltist
Prole
Posts: 49
Joined: Thu May 29, 2014 10:56 am

Re: Nerv:a library for controlled randomness

Post by gestaltist »

Great stuff!

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

Your demo looks very nice!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest