• Dear Cerberus X User!

    As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.

    Important: If you accept the amended Terms and Rules, you agree to the transfer of your user data to the future forum owner!

    Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.

    Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!

    Accepting ensures:

    - Continued access to your account with a short break for the actual transfer.

    - Retention of your data under the same terms.

    Without consent:

    - You don't have further access to your forum user account.

    - Your account and personal data will be deleted after April 5, 2024.

    - Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.

    We hope to keep you in our community and see you on the forum soon!

    All the best

    Your Cerberus X Team

Problems opening from Build Folder

bonajkukoj

New member
Joined
May 21, 2020
Messages
6
Hello,

I'm having a problem concerning the HTML5 Target.
When I launch my game from the Cerberus Editor pressing F5, it works normally.
But if I try to open the CerberusGame.html from my build folder, I only get a black screen.

What could I have possibly messed up?

Any help is appreciated.
 
Html5 Target is technically Javascript code running within a html file. So you need an environment that can run Javascript. When you run it with F5 the IDE is starting cerberus server to run the app.
Other ways to run your app is to upload it on a webspace or to locally install a server on your machine (like Xampp, Mamp) and run it from there.
 
Thanks for your replies.

The thing is, that apparently this seems to be connected to mojo2.
When I use mojo, it works normally, also just clicking on the html in the build folder.

I'm just testing a basic game setup, loading a jpg as a background and moving around with the arrow keys.
Could it be the Canvas Object creating this? Because apart from that I don't see big differences.

My OnRender()-Method looks like this in mojo (no problem opening the game outside the IDE):

DrawImage(Background,X,Y)

While in the mojo2-Version I use this (after declaring a Field GameCanvas:Canvas):

GameCanvas.DrawImage(Background, X,Y)
GameCanvas.Flush()

But I'll try using the WebServer for Chrome, maybe it helps.
Edit: It helps:)
 
Last edited:
The solution (using XAMPP, MAMP, Web Server for Chrome...) already has been stated. But I'd just like to clarify:

It's only particularly connected to mojo2. Actually, it's connected to how some resources are loaded. When you open your cerberusgame.html file from explorer, it's loaded with the file:// protocol. Then, the javascript will try to load resources via XMLHttpRequest with the same protocol (file://) which - for very valid security reasons - will be blocked by the browser.

Now, why does it work with mojo? Apparently, images are loaded differently (if I understand the generated JS correctly, it simply creates an image element, sets the resource path and then the browser handles the image loading on its own). But other resources are loaded using the XMLHttpRequest - other resources like the mojo2_program.glsl shader which mojo2 depends on. But you'd run into the same problem with mojo when trying to load something different that image files (strings/data for levels, audio...).
 
Back
Top Bottom