Added value drop after energy is depleted (in accordance to Jager model)
Okay, so today will be the big day where the brain is inserted into the creature. So far, I have recreated most of Jager's model (at least as I understood it, based on the descriptions in the paper), which covers clustering, approach and withdrawal, but a (I think) very crude threshold-based control on whether violent behavior occurs or not. I will now expand this model by introducing concepts from Wijermans' work.
Beginning... it is done! It lives! The creature lives!
Next up: searchings for bugs, checking the logical structure, tweaking, "nicefy" things.
Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts
Friday, June 6, 2008
Thursday, June 5, 2008
Session 6-05
Scraped "flee" behavior altogether, as this is now implicitly handled by the
combination of both "spectate" and "seek-friendlies" mechanics ... DONE
Big one: get all the ifelse double blocks out of the program code -- hm, now that's courious. By simply removing these blocks (while functioning as expected) I'm seeing a HUGE performance drop here. Don't really know what causes this, but I guess I revert the changes for the time being, and stick to the proven method... UNDONE!
... okay, I just came back to this issue - I'm not quite sure what is responsible for this performance drop, but as long as it is still bearable, I'm going to stick to the new version after all. Part of the reason for this decision is that I have adapted a means to separate perception and action, by having the agents "scan" their environment only once every 10 ticks, in accordance to the Jager model (note that I still scan a lot more often than Jager did, for the reasons mentioned in an earlier post). Not only does this make sense in the 1-tick-one-second context, but it also brings the lag down to a bearable level. (This should also add some persistence to the behavior of individual agents, which is a nice thing to have).
The big theoretical thing to do today is to collapse my "aggression-level" and "arousal-level" into only one variable (which will keep the name "aggression-level") - I could explain the reasoning behind that with a quick picture, but the general idea is that the motivation towards violent behavior (which I previously handled as HIGH aggression AND HIGH arousal) is really just a combination of these two concepts. All in all, it seems favourable to have as few internal variables as possible.
Been reworking the violence-mechanic. In accordance to the Jager model, violence is now bi-directional. I also coupled it to the energy level of the agent - an agent will fight for 100 ticks, no more, no less, an then disengage. I also introduced booleans for "attacking" and "defending", to distinguish both types of violence. While violent? is true, the agent simply remains immobile.
Add violence-check to behavior node.... DONE
Handle color control in one of the top-level functions (instead of doing this distributed throughout the code)... DONE
Made a test run over 500 ticks - obviously there's some bug in the disengagement handling. Investigating ... D'OH! Found it. Fix'd it.
Made another test run over 800 ticks - beautiful! Agents are clustering slowly, took a lot of time (300-400 ticks) until the first incidents, then violence spread throughout the clusters and kept relatively stable, even given the new energy-level dependency of fighters. The ratio of violent behavior in the whole population leveled out at about 30 %, distributed over three sizable (2 bigger, 1 smaller) clusters.
The next big thing: implementing the "seek-friends" behavior (as a preferable alternative/sub-case to "seek-friendlies"). This should also improve clustering... DONE
combination of both "spectate" and "seek-friendlies" mechanics ... DONE
Big one: get all the ifelse double blocks out of the program code -- hm, now that's courious. By simply removing these blocks (while functioning as expected) I'm seeing a HUGE performance drop here. Don't really know what causes this, but I guess I revert the changes for the time being, and stick to the proven method... UNDONE!
... okay, I just came back to this issue - I'm not quite sure what is responsible for this performance drop, but as long as it is still bearable, I'm going to stick to the new version after all. Part of the reason for this decision is that I have adapted a means to separate perception and action, by having the agents "scan" their environment only once every 10 ticks, in accordance to the Jager model (note that I still scan a lot more often than Jager did, for the reasons mentioned in an earlier post). Not only does this make sense in the 1-tick-one-second context, but it also brings the lag down to a bearable level. (This should also add some persistence to the behavior of individual agents, which is a nice thing to have).
The big theoretical thing to do today is to collapse my "aggression-level" and "arousal-level" into only one variable (which will keep the name "aggression-level") - I could explain the reasoning behind that with a quick picture, but the general idea is that the motivation towards violent behavior (which I previously handled as HIGH aggression AND HIGH arousal) is really just a combination of these two concepts. All in all, it seems favourable to have as few internal variables as possible.
Been reworking the violence-mechanic. In accordance to the Jager model, violence is now bi-directional. I also coupled it to the energy level of the agent - an agent will fight for 100 ticks, no more, no less, an then disengage. I also introduced booleans for "attacking" and "defending", to distinguish both types of violence. While violent? is true, the agent simply remains immobile.
Add violence-check to behavior node.... DONE
Handle color control in one of the top-level functions (instead of doing this distributed throughout the code)... DONE
Made a test run over 500 ticks - obviously there's some bug in the disengagement handling. Investigating ... D'OH! Found it. Fix'd it.
Made another test run over 800 ticks - beautiful! Agents are clustering slowly, took a lot of time (300-400 ticks) until the first incidents, then violence spread throughout the clusters and kept relatively stable, even given the new energy-level dependency of fighters. The ratio of violent behavior in the whole population leveled out at about 30 %, distributed over three sizable (2 bigger, 1 smaller) clusters.
The next big thing: implementing the "seek-friends" behavior (as a preferable alternative/sub-case to "seek-friendlies"). This should also improve clustering... DONE
Wednesday, June 4, 2008
Session 6-04
I think I've gathered enough new input here to take up again the programming part.
In this session, what I mainly want to do is to revise some of my own stuff to closer resemble the Jager model, as outlined in the paper. In the end, I expect to see some nice agression-level handling, and clustering of agents.
What I have now is (minus all the bugs that are certainly left in there) the bare Jager model, minus type-differentiation via perception-frequency (which I want to avoid/replace ultimately), and the timed "fighting action" (which shouldn't be too hard to squeeze in there next time).
In this session, what I mainly want to do is to revise some of my own stuff to closer resemble the Jager model, as outlined in the paper. In the end, I expect to see some nice agression-level handling, and clustering of agents.
Raw stream:
Re-adapting global and agent-level variables... SORT OF DONE!
Working on bilateral "friendship"-relation that links agents together... DONE!
No, wait, 'tis still buggy ... FIXED! (Damn, I'm good!)
Going back to agent variables... DONE SOMETHING!
Alright, that should take care of the new setup-functions. Next, I want to implement that one-turtle-per-patch policy (instead of having them all over the place, which currently results in massive, constantly collapsing turtle singularities instead of proper clusters).
Okay, looks like they stay off each other's patches now. I just got my first real cluster of turtles.
Add a own perception function, where values are stored for each agent - doing this once at the start of a "tick" probably helps performance a lot (up to now I had been making "in-range"-checks throughout the functions)... DONE!
Work on behavior node... other stuff... A LOT DONE.
What I have now is (minus all the bugs that are certainly left in there) the bare Jager model, minus type-differentiation via perception-frequency (which I want to avoid/replace ultimately), and the timed "fighting action" (which shouldn't be too hard to squeeze in there next time).
Subscribe to:
Posts (Atom)