Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pn is not defined #3

Open
nasjarta opened this issue May 6, 2022 · 6 comments
Open

pn is not defined #3

nasjarta opened this issue May 6, 2022 · 6 comments

Comments

@nasjarta
Copy link

nasjarta commented May 6, 2022

hello

When following the instructions in the readme to run the project I get the following error when hitting launch on the playcanvas editor after running the server.

https://forum.playcanvas.com/t/creating-an-authoritative-server-logic-for-fps-physics/25509/4

Did i do something wrong?

Thanks

@nasjarta
Copy link
Author

nasjarta commented May 8, 2022

I couldn't get it to work on my local machine so instead I imported the project to glitch along with all the required packages (playnetwork, express etc).

Then I started getting lots of unexpected identifier import errors even though I have all the relevant packages imported.

Also in the playcanvas project I made sure pn loader was directed to the glitch server instead of local however there is no pn.js folder.

Can anyone please help me how to get this example project running on my own environment?

@Sarletor
Copy link
Contributor

Can you provide a link to playcanvas project?

@flyingbaba
Copy link

Managed to launch it on my localhost environment. I was paying attention to what @Sarletor said about cheking if https://localhost:8080/pn.js url is working.

@nasjarta
Copy link
Author

nasjarta commented May 17, 2022

playcanvas project link: https://playcanvas.com/project/929930/overview/playnetwork-example

glitch project for server side: https://glitch.com/edit/#!/pointed-confirmed-muskmelon

I changed the pn_src inside pn_loader to the glitch project but I can not find the pn folder. Also inside the glitch project I have installed the playnetwork and express modules but I am getting import errors

@Sarletor
Copy link
Contributor

Sarletor commented May 17, 2022

pn.js is served by

app.get('/pn.js', (_, res) => {
res.sendFile(path.resolve('node_modules/playnetwork/dist/pn.js'));
});

Check if path is valid, by default it is 'node_modules/playnetwork/dist/pn.js'

@Sarletor
Copy link
Contributor

You can use pn.js library directly in the project instead of pn-loader.js. Just add it to the project script and set loading type - 'After Engine'. And remove pn-loader.js after that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants