swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Synchronized Activity


From: Rob Leclerc
Subject: Synchronized Activity
Date: Tue, 20 Feb 2001 02:35:17 -0700

For the record, I am using a stripped down version of the java tutorial source code from Swarm Fest as my basic framework for this model.
 
 
    I am having some difficulties synchronizing the movement of my agents on the 2D Grid.  Currently I have each agent extending SwarmImpl and each has its own schedule and each executes its own "stepAgent" method.  Currently there seems to be no difficulty in moving an agent to an unoccupied point in the grid.  That is, just like the code in the java tutorial example, when moving an agent to a new coordinate on the grid it seems to have a lock on some global schedule as there doesn't seem to be a problem of multiple collisions on the grid. 
 
    The problem I am having with my implementation is that I have each agent linked with each of its two neighbors so that the larger structure forms a circle.  I am allowing movement of the agent so long as it stays directly adjacent to both of its neighbors.  Right now I have a method to do a check on the two adjacent neighbors current coordinates and compare them to the position I would *like* to move.  If this is an acceptable move it returns true, otherwise it returns false.  Now it seems that in between checking to see if the move is okay, and then by the time I am actually making the move, one of the other agents has moved as well.  Thus although no agent should be more than one x/y coordinate away, they both end up moving away from each other and then locking. 
   
    Now I am wondering if there is any way around this problem, and am curious as to why this might do this as there doesn't seem to ever be a collision problem with two agents attempting to move to the same grid coordinate.
 
Thanks,
RDL
 
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]