Answers is deprecated.

Please use Forum to participate in community by asking and answering questions!

I followed the multiplayer tutorial and made some very small changes to it. The game works without any errors when I launch it from the editor.

When I publish the game (or download it and run it on my own server), it gives the following error:

"Uncaught ReferenceError: p is not defined" in __game-scripts.js.

If I publish without "Concatenate Scripts" then it works.

You can see the error for yourself at the published game here:

https://playcanv.as/p/0gA5oUmd/

How can I get script concatenation working with the realtime multiplayer example?

asked 10 Feb, 15:45

beanstalkblue's gravatar image

beanstalkblue
20334
accept rate: 0%

edited 10 Feb, 16:28


Looks like you're library is expecting some other data to be defined first. Two possible problems:

a) Your scripts are loaded in the wrong order. Change the script order. b) The library is designed for node not for browser

link

answered 10 Feb, 16:34

dave's gravatar image

dave ♦♦
4.3k1530
accept rate: 42%

a) Changing the script load order makes the example run, but with both errors and warnings.

There is no script load order that solves all of the errors, if you use concatenate scripts.

Running the Realtime Multiplayer Example (when published with concatenate scripts) will demonstrate this for you.

(10 Feb, 18:52) beanstalkblue

b) The socket.io library is designed for browser. There is a client library as well as a server library, the realtime multiplayer example uses the client library.

Note again BTW that the game works if you don't concatenate scripts (though it gives warnings like "script 'socketIo' is not found, awaiting it to be added to registry").

(10 Feb, 18:53) beanstalkblue
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×30
×7

Asked: 10 Feb, 15:45

Seen: 425 times

Last updated: 10 Feb, 18:53

about | privacy | support | contact

playcanvas