Hi there, I’ve wanted to check my old test-project with live-update feature:
when trying to start download the manifest, I see: ERROR:LIVEUPDATE: Loaded manifest does not support current engine version (1.2.179)
but nothing about this in manual, still see official example about it:
and 2nd question, about live-updating in HTML5:
Does it possible to find a solution to download resources from local directory of HTML5 build? not via remote link of ZIP or Amazon server. Sometimes I want to be sure that the files are loaded very quickly, and will not depend on remote servers.
Yes, we should make this fact clearer in the documentation.
As for testing content locally, I use this server script, that just serves the folder given to it as an argument:
cors_server.py
#!/usr/bin/env python3
# encoding: utf-8
"""Use instead of `python3 -m http.server` when you need CORS"""
import sys, socket
from http.server import HTTPServer, SimpleHTTPRequestHandler
hostname = socket.gethostname()
local_ip = '192.168.0.210'# socket.gethostbyname(hostname)
class CORSRequestHandler(SimpleHTTPRequestHandler):
def end_headers(self):
self.send_header('Access-Control-Allow-Origin', '*')
SimpleHTTPRequestHandler.end_headers(self)
port = 8000
if len(sys.argv) > 1:
port = int(sys.argv[1],10)
print("Listening on", local_ip, port)
httpd = HTTPServer((local_ip, port), CORSRequestHandler)
httpd.serve_forever()
And I also have a helper script to unpack and serve the latest defold.resourcepack_*.zip. It really helps testing a lot faster. It invokes the cors_server-pyscript. Feel free to make any changes necessary to make it work for your use case:
liveupdate.sh
#!/usr/bin/env bash
set -e
SCRIPTDIR=$(pwd)
DIR=./liveupdate
if [ -d "$DIR" ]; then
rm -rf $DIR
echo Removed $DIR
fi
ZIP=$(ls -t defold.resourcepack*.zip | head -1)
if [ "$ZIP" == "" ]; then
echo "No resourcepack found!"
exit 1
fi
echo "Found $ZIP"
ls -la $ZIP
unzip -q $ZIP -d $DIR
cp -v $ZIP $DIR/defold.resourcepack.zip
cp /Users/mawe/work/projects/users/denis.smirnov/issue-5499/liveupdate_version $DIR
(cd $DIR && python3 $SCRIPTDIR/cors_server.py)
EDIT: You can ofc use python -m http.server but then the 304 messages won’t be handled properly and it will always download the data.
May be I wrote my 2nd question wrong, but under “downloading from local directory of HTML5 build”,
I mean in production also, not for testing only.
let me describe the reason:
usually during making HTML5 games need to make sure the first scene loads very quickly, and then we can download resources (ogg files, assets of graphics later)
In Phaser (and other JS frameworks) it’s very easy to control and use, I want to be able to download resources “locally” in the web-build.
for example in case above, instead of:
just to write: local URL_RESOURCES = '/resources/'