howto implement FTL 'movement' in a scifi turn based strategy idea ?

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 ?

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

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.

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’.