|
Post by mordechai on Aug 4, 2011 6:11:25 GMT -5
Information is retained regarding the buy/sell price of goods of visited urban zones. Even if somewhat inaccurate, it's accurate enough to base trading decision on, at least in the absence of useful rumors. It appears though, that this data is only cached, but not saves. Besides crashes, there are multiple extra-game events which can cause this information to be lost. Is it intentional that this happens? While I can think a of few (weak) justifications for this to be intentional, it seems to me that this "feature" is really a bug.
|
|
|
Post by slayernz on Aug 5, 2011 1:36:22 GMT -5
If you use app killers then yes, your caches can be well and truly flushed. Perhaps a phone restart while game is in memory might also cause clearing of cache. Other than that, we'll have to get Cory's comments.
|
|
|
Post by Cory Trese on Aug 5, 2011 13:11:23 GMT -5
"While I can think a of few (weak) justifications"
Ouch!
|
|
|
Post by Cory Trese on Aug 5, 2011 13:17:07 GMT -5
If you use app killers then yes, your caches can be well and truly flushed. Perhaps a phone restart while game is in memory might also cause clearing of cache. Other than that, we'll have to get Cory's comments. I cannot help anyone who insists on running a Task Killer. They're missing one of the huge features of Android OS and I do not see any good justifications to write "combative" code to fight against Task Killers because by definition, that code would be fighting the Android OS (and I don't do that.) There is an unbounded list of reasons why Android would reclaim memory from a process. If the Android OS says "I want this memory back" I never say no. The phone might need that memory for a phone call, your media player or good lord, who knows what else! Along those same lines I made a design choice about 7 months ago that limited the "current exchange stack" to the current Captain. If you switch Captains, the "exchange stack" is cleared. I was previously re-using it but the players on the forum half a year ago made a clear preference known that they'd prefer to clear the cache between Captains than pollute between games. So that is the only "explicit" clear that I do -- when you change games. Otherwise, your phone asked me for the memory back and I gave it back. ST RPG is by design the very best Android OS citizen I can make it. ST RPG started as a learning project for me to understand Android OS and building it I've read too much Google documentation. Brainwashed, I am.
|
|
|
Post by mordechai on Aug 7, 2011 15:19:44 GMT -5
While I'm not running a task killer, and I rarely switch (live) Captains, I do run other apps and occasionally need to reboot my phone. My question is, knowing that the cache is volatile, why isn't the information saved just as other data related to a Captain and the socioeconomic state of his universe are saved?
|
|
|
Post by Cory Trese on Aug 7, 2011 20:35:15 GMT -5
because the developer is an idiot i guess
|
|
|
Post by Cory Trese on Aug 7, 2011 21:39:49 GMT -5
There are many compromises in Android applications. The different types of storage, volatile and non-volatile. Each storage system has different performance and behavioral profiles. developer.android.com/guide/topics/data/data-storage.htmlStar Traders uses a set of simulation threads to manage the game's internal state. These threads work outside of the primary UI thread, to ensure responsiveness of the UI. developer.android.com/guide/practices/design/responsiveness.htmlSo one compromise that is made is that several of the "high write count" data segments are stored in volatile (and thread-safe) Java memory structures. Using a simple set of thread mutexes, ST RPG is able to maintain a responsive, high performance memory structure that does not block the UI thread, provides the game's internals enough data to remain interesting. I understand that most engineers who make software are better at it than I am -- so I fall back on my original response -- "the developer is an idiot" and the way it works today is the best he could come up with AND work on all 546 phones that ST RPG is played on.
|
|
|
Post by mordechai on Aug 8, 2011 2:58:45 GMT -5
I understand that most engineers who make software are better at it than I am -- so I fall back on my original response -- "the developer is an idiot" and the way it works today is the best he could come up with AND work on all 546 phones that ST RPG is played on. An "idiot"? Hardly. Certainly humble, though. While I'm just starting to learn Android development, I'm not new to programming (I started, as a hobby, back in '79) and I can say with certainty that what you've accomplished is impressive. Perhaps you could use a SQLite database, if you're not using one already. Or perhaps put the writing in a separate thread. In Linux, writes are often cached and written to the hard drive in the background. The list could be updated during transit. Prior to leaving a world there's no need to update the current world's info. (On a slightly related note, it would be nice if the current world's info was at the top of the list.) As far as working "on all 546 phones that ST RPG is played on" goes, if you make it an option, phones which can't handle it could have it disabled. One more thing, I've noticed that if I die and restart I still have the old list. I know, the simple answer is just not dying, but that doesn't seem to be working at the moment.
|
|
|
Post by Cory Trese on Aug 8, 2011 10:46:43 GMT -5
Linux and Android have very different file system constraints.
Great suggestions I will see what I can do. Thanks!
PS: Best of luck with your Android projects!
|
|
|
Post by mordechai on Aug 8, 2011 14:24:39 GMT -5
Linux and Android have very different file system constraints. I know. I was using the Linux method (which is not unique to Linux) as an example of write caching. Thank you.
|
|