kunaraj's Forum Posts

  • 9 posts
  • It is working, You such a life saver. Thanks.

  • Ashley Thanks for the support as always.

    I create a new project with simple worker.js script and still having the same issues.

    Construct 3 Editor (Expected Result)

    Window Build

    Following is my window build setting:

    c3p Project File

    https://drive.google.com/file/d/1jU7Li1XbZJWjpMQNl8vRB8g-46hcxFBr/view?usp=sharing

  • Hi, I am having issues where my exported Windows build game does not run properly and does not produce any errors.

    I am not using the advanced Worker properties in Construct 3.

    However, I wrote my own script to run the worker. I tested it on the Construct 3 editor, and it work and run as intended. However, once I exported it to a Windows build without minify mode, it runs but does not respond or show any error from the script in worker.js.

    //main.js

    	console.log("main call worker.js");
    
    	const worker = new Worker('worker.js');
    	worker.postMessage({ 
    		type: 'processMoves', 
    	});
    		
    	worker.onmessage = (event) => { 
    		if (event.data.type === 'bestMove') {
    			//Do Something 
    			}
    		}
    			
    	worker.terminate();
    

    //worker.js

    	 self.addEventListener('message', async function(event) {
     if (event.data.type === 'processMoves') {
    	console.log("Worker start");
    	try {
    		// Do somthing
    		console.log("Worker end");
     	self.postMessage({ type: 'bestMove', bestMove: bestMove});
     	} catch (error) {
     console.error('Error processing moves:', error);
     }
     }
    });
    

    Expected it to print out "Worker start" and "Worker end" in the window build, however nothing happen.

    Did i miss something or worker does not work on window build ?

  • Hello,

    I am currently making a game that requires a lot of bots. I plan to use Web Workers to offload tasks from the main thread.

    However, for my game to work, I need to read the URL parameters.

    I have always been using the Browser plugin to execute JavaScript with "window.location.href". However, when using a Web Worker, window is no longer defined.

    I have tried using JavaScript with the following code to get the result but still failed:

    globalThis.location.href

    document.location.href

    Example: The return from globalThis.location.href is preview.construct.net/previewworker.js

    But the actual Base URL should be preview.construct.net/local.html

    I hope someone can help me with this. Thanks!

  • Previous construct 3 version my game seem running fine.

    However lately i try again it broken after update to 407.2.

    Current i am using this method to get the url in event editor

    Browser Execute javascript "window.location.href"

    However i been getting this error

    Anyone can provide me the alternative of getting url, or do i miss something?

  • thanks for the info.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi, i been working on a multiplayer game quite a while i notice, when open a new tab on browser the game will suspend, but when click on the game tab it fail to resume.

    I create a demo project to recreate the issues as show below.

    Running with remote preview.

    I open up 3 tabs, for 3 players

    After selected name and other setting, following show all loaded in scene

    I press send message on each of the player browser.

    Then i trigger auto send message from host(every 1s) and open a new tab on player 2

    When i select back the game tab, the game remain suspend.

    CS3 file:

    drive.google.com/file/d/1WnB-VloB8hRVGpXqrUVA2z5hIrDTOer2/view

  • Thanks for the reply, then i will wait longer.

  • Sorry for posting here, I tried to send email twice to supportgnk@construct.net but they never respond and it almost a week. I hope someone can help me reach out to the support team.

  • 9 posts