Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  howto implement FTL 'movement' in a scifi turn based strategy idea ?  (Read 1146 times)
0 Members and 1 Guest are viewing this topic.
Offline ops

JGO n00b
*

Posts: 2



« on: 2005-06-14 23:02:38 »

from a student a request for guidance ..

from various scifi novels ops has aggregated a science fiction future to model as a game or 'simulation'.

in this alternate faster than light transits are a little less convenient than ones normal star wars, star trek or battlestar galactica variants.

In our present design every stellar system keeps a record of all insystem assets. to 'move' from a to b involves removing assets from a stellar systems records and adding them to the destinations systems records in some future turn.

while a spine or complex is subject to the 'rules' of FTL interstellar transit that asset is effectively 'frozen' and can neithr react to real space demands nor engage in normal activity. Think the sleepers in 2001 or aliens.

So it would seem to our poor addld wits that while asleep in transit these concrete instantiations cannot allow anything to call their methods ? How does one put an object to sleep ? Ops is toying with doing an 'intransit' exception ?

Comments and/or suggestions ?
Offline kevglass
« League of Dukes »

JGO Kernel
*****

Posts: 5214
Medals: 49


Mentally unstable, best avoided.


« Reply #1 on: 2005-06-15 03:15:01 »

Depends how complicated you objects are I guess.

- If they're simple and a small number then the exception idea is pretty sound. Similar to InvalidStateException thats existed for donkeys years.

- If there are loads of complicated classes that you want to "sleep" you could consider generating dynamic proxies for them that can be shut off at the proxy level. Basically just generate another class that proxies all the methods of the target automatically.

- Or change you stuff to a facade pattern and use the single point of entry to check the sleeping state.

Just ideas..

Kev

Offline Daire Quinlan

Full Member
**

Posts: 146
Medals: 1



« Reply #2 on: 2005-06-15 03:39:48 »


 Or stick the reference into an 'inTransit' object that has a record of where the asset has come from, where its going, and what time its going to get there at, and stick the 'insTransit' object into a 'TransitBuffer' thats polled once a turn to see if you have to pop anything out and place the contained reference into the destiniation system assetlist. I reckon thats probably the -simplest- way to do it ...

D.
Games published by our own members! Go get 'em!
Offline ops

JGO n00b
*

Posts: 2



« Reply #3 on: 2005-06-15 12:47:03 »

thank you daire, your suggestion was our first approach but we felt uneasy about the shuffling of references between too many structures ?

thank kevglass.

we were reluctant to define exceptions as that approach seemed to imply lots of try/catch blocks so ops appreciates and will devote further study to the suggestion to investigate dynamic proxies.

most useful, as example, that a proxy object seems able to not only isolate but also override an in transit asset's methods. very handy as in our model assets consume resources at different rates depending upon whether they exist in real space or are 'in transit'.


Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.069 seconds with 20 queries.