a friend , making game engine, in 2 ai's fighting each other. trying set game engine thread in such way ai threads cannot things slow down game, or destroy unit @ etc.
the problem having need share data between game engine , ai's. until used synchronize
, ai can block variable , game engine cannot proceed anymore. or ai choose not synchronize , crash game, not want.
we have been looking @ implementations of lock, seems assume ai check see if variable locked before using, bad ai can of course fail do.
what @ predictable time if our data locked. if locked, disqualify ai. otherwise proceed game. problem synchronized proceeding default , game engine wait until variable unlocked , possibly hangs.
question
how lock variable/share data in such way can see if variable locked , force lock? or there solution not involve locking?
the way guarantee ais share information in neutral area neither system has control on code. way can use synchronized or lock or concurrent collection since neither ai can access code holds information cannot negatively impact 1 another. make sure locking not exposed , controlled shared store.
Comments
Post a Comment