ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Help with CopperCube
forum topic indicator Can I issue commands (like scene changes) from beyond CopperCube itself? (WebGL)
person icon
haydenstrauss
Registered User
Quote
2025-05-16 20:17:20

Forgive me if this has been addressed elsewhere, but I can't seem to find anything that directly answers my question. I'm sure this is because my use case is unique, or perhaps I'm just not looking in the right places.

Context:

I'm solo-developing a linear story-driven point-and-click adventure game, and CopperCube will live underneath my self-written 2D game engine as a glorified 3D WebGL renderer for anything that cannot be pre-rendered as PNG sequences for my engine, like 3D character movement. My game engine works by creating an internal web server when initialized, serving CopperCube scenes to itself for anything that cannot be achieved in my comparatively primitive engine.

While I would love to switch development fully to CopperCube for multi-platform support (my engine is windows-only, pure VB.NET code), I'm terrible at writing JavaScript, and my game utilizes a lot of complicated interfaces that are probably easiest to code manually. For example, the main character has a cell phone that's used for solving puzzles; one involves navigating a fictional version of the internet, while another involves using a photo editing app to reveal clues in user-taken images. Additionally, my engine has robust sound design tooling that I have yet to manage replicating in CopperCube. Even basic things like footstep sound effects have proven extremely cumbersome in CopperCube, despite otherwise being fantastic and user-friendly.

Issue:

My issue is that I'm unsure how to fully integrate CopperCube because I can't find a way to change the active scene (level) externally. My guess was to bind a unusual key combo to a scene change event in every level, then have my engine forward this as a key down event to the WebGL layer. Alternatively, I've considered making every scene it's own CopperCube project file, or manually exporting every scene from the main project file but changing the default scene before each export (thus making my engine responsible for which scene is displayed and when, as it currently does) but this would likely result in redundant storage of assets, and I'm trying very hard to optimize this game as much as possible.

If there's a more graceful way to switch scenes, like with some sort of API, I'm all ears. Currently CopperCube communicates with my engine by opening fake URLs in new tabs, which my engine intercepts and interprets as commands. Even a basic way to communicate like that, but in the other direction, would be so helpful.

person icon
okeoke
Registered User
Quote
2025-05-16 23:11:18

But you mentioned that you have server running to serve coppercube scene. Could it be possible to setup websocket connection between this server part and coppercube client?

https://github.com/websockets/ws

https://github.com/EagleAglow/vba-websocket

person icon
haydenstrauss
Registered User
Quote
2025-05-18 00:21:00

I'm unsure how that would work. I figured that, while my engine serves coppercube html files to itself, I wouldn't be able to do anything from the backend like that? Could you explain how a webserver could interact with coppercube scenes beyond merely serving them to a client?

person icon
okeoke
Registered User
Quote
2025-05-18 08:53:46

I don't know how exactly you got it implemented. But I assume, the webserver starts as a separate process, then your client somehow hits local url, i.e. something like localhost:PORT/getScene to get the coppercube scene.

You also say:
Currently CopperCube communicates with my engine by opening fake URLs in new tabs, which my engine intercepts and interprets as commands.


Which means you are able to expose different endpoints. So one of this endpoints can listen to ws connection like here:
https://stackoverflow.com/questions/60017338/get-data-from-websocket-using-vb-net-clientwebsocket

You can also try other approaches like: use file system to communicate. I.e. your game engine writes to file, while coppercube client reads from the same file. Or you can fetch data while calling "fake urls" that you now use as commands.


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |