- Home /
Deploy Unity Web Application to Google App Engine
Hi all,
I am trying to host my game on Google App Engine. I don know what type of build settings should i use regarding the Web Player (Streamed, Offline Deployment, .... ) ???
Any additional precautions or details i should notice, will be appreciated.
Thanks,
Samer Samy
Answer by BerggreenDK · Sep 13, 2011 at 09:08 AM
I havent tried to use Google App engine for running Unity, but when you use the Webplayer, the settings you mention (as far as I know) has the following meaning:
1) Streamed, means that the first scene (can be configured) will be show before the whole file is downloaded to the webplayer. This can speed up some of the feeling + later scenes/levels can load in the back while the game starts up faster.
2) Offline, generates/copies the UnityObject.js file into the same folder as where you publish instead of linking to the latest online version at Unity servers.
Look for the details here. Google is your friend. I used: "unity3d web publish" to find this link. http://unity3d.com/support/documentation/Manual/Publishing%20Builds.html
Answer by ThatsAMorais · Nov 14, 2013 at 05:31 AM
I have used GAE to host a game many times.
My GAE app directory for the given app I'm deploying contains the following...
/GAEGame
/WebPlayer
WebPlayer.html
WebPlayer.unity3d
app.yaml
favicon.ico
index.yaml
main.py
I like to take the same directory structure and reuse it for other projects which is why I have the "WebPlayer" directory. All that needs doing is to copy it from one of my previous projects to my current project, redeploy the new game's webplayer to "WebPlayer"
app.yaml:
application: webroleplay <---- Change this to match your appspot URL
version: 1
runtime: python27 <---- This is what GAE requires, currently
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /WebPlayer\.unity3d
static_files: WebPlayer/WebPlayer.unity3d
upload: WebPlayer/WebPlayer\.unity3d
- url: .*
script: main.app
libraries:
- name: webapp2
version: "2.5.1"
from google.appengine.ext.webapp import template
import webapp2
import os
class MainHandler(webapp2.RequestHandler):
def get(self):
template_values = {
'greetings': 'greetings',
}
path = os.path.join('WebPlayer', 'WebPlayer.html')
self.response.out.write(template.render(path, template_values))
app = webapp2.WSGIApplication([('/', MainHandler)],
debug=True
Not a plug, but http://webroleplay.appspot.com is one that I have running, now.
I am using the same structure to update my Unity Web Player content but I am getting 500 server error at appspot.com domain.
Hi. Were you commenting on my answer?
What I know about 500 Server error is that it relates to an unhandled exception in your python code. Python being sensitive to whitespace tells me that you should ensure that the tabs are all formatted properly. For example, if you copy-pasted my python code from above, you might get spaces ins$$anonymous$$d of tabs.
$$anonymous$$y Folder Structure is: /GAEGame
/WebPlayer
WebPlayer.html
WebPlayer.unity3d
app.yaml
favicon.ico
index.yaml
main.py The app.yaml file
application: gcdc2013-space3d
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /WebPlayer\.unity3d
static_files: WebPlayer/WebPlayer.unity3d
upload: WebPlayer/WebPlayer\.unity3d
- url: .*
script: main.app
libraries:
- name: webapp2
version: "2.5.2"
from google.appengine.ext.webapp import template
import webapp2
import os
class $$anonymous$$ainHandler(webapp2.RequestHandler):
def get(self):
template_values = {
'greetings': 'greetings',
}
path = os.path.join('WebPlayer', 'WebPlayer.html')
self.response.out.write(template.render(path, template_values))
app = webapp2.WSGIApplication([
('/', $$anonymous$$ainHandler)
], debug=True)
Is there any modifications i need to do.I have copied index.yaml and favicon.ico from another demo app i created.Any Help will be appreciated
Can you confirm that the indentation in your file is exactly what you have pasted here? It appears that the lines starting at
"'greetings':'greetings',"
and going all the way to
"self.response.out..."
needs to be indented to the same level as
"template_values = {"
You know what I am saying? The indentation matters in Python, and parts of what should be in "get" are unindented to the global scope.
File "/base/data/home/apps/s~gcdc2013-space3d/1.371793060412129756/main.py", line 27, in get self.response.out.write(template.render(path, template_values))
Your error is suggesting that "templates" does not contain "WebPlayer.html". Initially, I can't imagine why it is looking in the templates for this string. Did you forget a comma?
The template is "greetings", not "WebPlayer.html", so that is puzzling and I'll have to see your code. Paste your current code again.
I am updating my code: app.yaml
application: gcdc2013-space3d
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /WebPlayer\.unity3d
static_files: WebPlayer/WebPlayer.unity3d
upload: WebPlayer/WebPlayer\.unity3d
- url: .*
script: main.app
libraries:
- name: webapp2
version: "2.5.2"
from google.appengine.ext.webapp import template
import webapp2
import os
class $$anonymous$$ainHandler(webapp2.RequestHandler):
def get(self):
template_values = {
'greetings': 'greetings',
}
path = os.path.join('WebPlayer', 'WebPlayer.html')
self.response.out.write(template.render(path, template_values))
app = webapp2.WSGIApplication([
('/', $$anonymous$$ainHandler)
], debug=True)
that last little bit is still looking a little strange. Try changing the "app" line (line 13 - 15) to the following
app = webapp2.WSGIApplication([('/', $$anonymous$$ainHandler)], debug=True)
Still not working.Some sites have suggested that you can use webapp2/jinja2 templates still trying..
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Getting a standalone project to run on a webpage? 0 Answers
Naming web player 1 Answer
Putting game on website 2 Answers
Build in Gradle 0 Answers