summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-08-16 10:17:39 -0300
committerJesusaves <cpntb1@ymail.com>2021-08-16 10:17:39 -0300
commitb91e19f813f5ee7d581f98cce36345efd16664b2 (patch)
treeecfe423c7a6c7fa19c783b2923da351d4bdf5838
parente3234c5ebb683950764ecd46dc27f50dfc490ee3 (diff)
downloadclient-b91e19f813f5ee7d581f98cce36345efd16664b2.tar.gz
client-b91e19f813f5ee7d581f98cce36345efd16664b2.tar.bz2
client-b91e19f813f5ee7d581f98cce36345efd16664b2.tar.xz
client-b91e19f813f5ee7d581f98cce36345efd16664b2.zip
Load all downloaded images to RAM at login time in an async manner
This should make gameplay smoother (at cost of RAM, obviously) FIXME: User should be able to disable this. Specially for low-end phones (and PCs).
-rw-r--r--game/misc.rpy9
-rw-r--r--game/script.rpy5
2 files changed, 14 insertions, 0 deletions
diff --git a/game/misc.rpy b/game/misc.rpy
index 68ac6f9..305f736 100644
--- a/game/misc.rpy
+++ b/game/misc.rpy
@@ -259,6 +259,15 @@ init python:
def readjust_status(lvl, val):
return val+int(val*(max(lvl-1, 0)/100.0))
+ def async_loader():
+ print("Now loading images to RAM...")
+ t = now()
+ for c in persistent.allfiles:
+ try:
+ show_img(c[0], False)
+ except:
+ print("Unable to load %s" % c)
+ print("Loaded %d images in %d seconds." % (len(persistent.allfiles), now() - t))
label add_server:
centered "This allows you to add a new custom server.\n\
diff --git a/game/script.rpy b/game/script.rpy
index 0b4fa11..619d532 100644
--- a/game/script.rpy
+++ b/game/script.rpy
@@ -32,6 +32,11 @@ label start:
$ stdout("Connection established!")
+ # FIXME: This be bad for old phones
+ # Load all downloaded images to RAM
+ # (For a smoother gameplay)
+ $ renpy.invoke_in_thread(async_loader)
+
# Open game
scene bg town with Dissolve(0.3)
pause 0.1