meta-space-org / playnetwork-example-3d-physics-topdown

Example project of PlayNetwork, implementing top-down 3D game with physics.
3 stars 2 forks source link

pn is not defined #3

Open nasjarta opened 2 years ago

nasjarta commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

Can you provide a link to playcanvas project?

flyingbaba commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

pn.js is served by https://github.com/meta-space-org/playnetwork-example-3d-physics-topdown/blob/c850134f479186fe553271d291778ef0f1e8fc68/index.js#L10-L12

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

Sarletor commented 2 years ago

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