transactional threading in xtalk - the game

MisterX b.xavier at internet.lu
Thu Jun 2 22:49:46 EDT 2005


Game challenges are nice, they teach you something (i wrote a game and only
one person gave a crap despite it's educational and practical value for ANY
age! OK, no prob ;) so since we're all professionals here, im more inclined
towards suggesting a practical threading model...
 
The threading is not the problem... it's the transactional queuing and
reporting that is interesting... The same "game model" applies to many many
applications - waiting cabinets, post/mail-sending, delayed update
synchronizations, cache cleaning, etc... 
 
The threading transaction script is the following:
 
-- The bartending example just used in memory to the old thinkC OOP
class/event model ;)
-- i dare not say here which was the first C compiler i used!
 
on bartender customerObj
  send "MakeDrink" &&CustomerObj to me in GetQueueTime(me)
on taskdoer
 
on MakeDrink obj
  get ObjectBestCandidateDrink(obj)
  if is it empty 
  then send "ask \"Drink Sir\" to" obj
  put MakeDrink(obj) into drinkObj
  ServeDrink drinkObj
  StartTwoBitChatWith Obj
end MakeDrink
 
-- end of script
 
Now, this will surely thread-whizz a few drinks on the bar's tabletop nicely
given few clients without "in GetQueueTime(me)" question... 
 
But if it's friday night and you have to serve both drinks, chips bowls,
clean dishes, check drink stock + order disminishing fast, do checks,
collect and account checks, you see that it gets quite different - and more
down to earth than just a game... The barSim game in Rev, why not?
 
OK,  What if even with just drink making, you get many clients more than one
drink... It gets crowded on weekends, how do you prepare?
 
The best GetQueueTime() function wins no matter how many clients and drinks
are thrown at the bartender...
What if we have more than one bartender (move the request drink script to
the bar group holding the bartender buttons... You can generalize or
individualize the bartender scripts as you wish naturally ;) 
 
Seen the AI article on Wired? 
http://www.wired.com/news/culture/0,1284,67659,00.html
Cool! But hey, IT industry is kind of sterile now and it's time to wake up
the industry to RunRev... Can RunRev do threading? No, I do have a working
solution though. Of course, no one will listen but it's part of the strategy
to overturn the IT empires with TAOO ;)
 
If this script is well optimized we have a better chance at making Real time
simulators or RPG/FPS games in RunRev too.
 
maillist perenial netTip:
 
Here's how to make time-synchronized events in RunRev - however there's no
guarantee that the event will happen at the right time if another even is
running (grrr). But with the right queuing, we can make it work... We do
have more processing power than old mainframes PDP11 dont we? 
 
Send "drawyourself" to thisgraphic in 40 milliseconds 
-- 40 ms = 25 FPS frames per second = video - 80 = 12 FPS is animation
quality. Would a binary-easy number work better?
 
OK, so now, how do you schedule it all? And have enough "send" bandwidth? 
 
We can make this into a cool game too later... But the real benefits is that
you can thread anything. This also works for web site client serving btw... 
 
Tip: while there are polynomial ways of doing this kind of optimization,
RunRev's speed of calculation in matrices or arrays prohibits this (though
it helps compared to hypercard times ;) - There is simpler geometric way...
 
I've been sitting on this one for about 9 years but it's the clustering
event model in TAOO which im proud to describe here - as i read on a sig
today - information is only of value if it is shared... How true...
 
Any Game Theory adepts in the list?
 
cheers from Lulucity
Xavier
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.runrev.com/pipermail/metacard/attachments/20050602/129b7824/attachment.htm


More information about the metacard mailing list