From: Stefan F. <ste...@we...> - 2012-02-16 06:32:48
|
Some more details on that: The method Erik refers to below is getInstance() of GameManager. This method will only work from the thread that created the GameManager instance. So be aware that in essence any call to the Rails main core methods can fail if done outside the main thread. This is one of the reasons why the RevenueAdapter object is created and evaluated inside the main thread so that the revenue calculation is isolated from any calls to the core Rails engine and can run in a separate thread. This mechanism will be dropped moving onto Rails 2.0 and is replaced by a thread-safe mechanism (essentially be giving all items access to a GameManager equivalent by placing all Rails objects into a tree hierarchy). Stefan On 02/16/2012 12:24 AM, Erik Vos wrote: > No. The goal is to provide access to the current GameManager for objects > that don't have a reference to it: via a thread property. That is what NDC > provides. > > Originally GameManager was a singleton, and in those times it was easy. > But at some point we decided that we should be prepared for multiple games > running in the same JVM, and NDC was the only mechanism I knew about that > could help me out to identify which GM any object would belong to. > > Currently the implementation is still rudimentary, as the GM key given to > NDC is fixed. But in a multi-game server, that key should be derivable, for > instance from the identity of the stream over which an incoming player > action would arrive. > > I hope this is a bit clear... > > Erik. > >> -----Original Message----- >> From: Frederick Weld [mailto:fre...@go...] >> Sent: Wednesday, February 15, 2012 7:58 PM >> To: Development list for Rails: an 18xx game >> Subject: [Rails-devel] Game Initialization within the EDT / AWT EventQueue >> >> In RunGame, I've found the following comment: >> "We have to run loadGame on an AWT EventQueue to make sure that NDC >> will properly initialize game key so that GameManager instance can be >> properly queried for. This is a consequence of NDC abuse." >> >> New games are also initialized within EDT since this is triggered by the > button >> pressed event. >> >> So my question to Erik/Stefan/Brett: >> What is the goal of (ab)using the EDT? Is it that only one game may be > started >> at the same time? >> >> -- Frederick >> >> > ---------------------------------------------------------------------------- > -- >> Virtualization& Cloud Management Using Capacity Planning Cloud computing >> makes use of virtualization - but cloud computing also focuses on allowing >> computing to be delivered as a service. >> http://www.accelacomm.com/jaw/sfnl/114/51521223/ >> _______________________________________________ >> Rails-devel mailing list >> Rai...@li... >> https://lists.sourceforge.net/lists/listinfo/rails-devel > > > ------------------------------------------------------------------------------ > Virtualization& Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel |