Basic Startup Tips for n00bs

edited May 2014 in JavaScript
Hi All,

I'm really excited to see Photon Cloud and Javascript/HTML5. Super exciting stuff! Unfortunately, I'm not as strong with HTML5/JS as I am with Unity/C#.

I'd like to create, at first, just a simple multiplayer chat, but I can't seem to find the right place to start. Seeing as there's no documentation as yet for that, I was wondering if you could help me with the following:

1) What scripts do I definitely need to include in the index.html page? photon.js or photon-javascript_SDK.js? Are those the same thing?

2) once that's set up, how do I create a new Photon Peer instance in my JS script? I tried "var pp = new Photon.PhotonPeer("...url here as a string", "app id as a string", "1.0") but still undefined so I'm guessing that's wrong.

3) How do I then handle "players"? Do I hold them in an array of Photon.players[] or something?

4) How is information broadcast to all the players? Which function handles that? In Unity, there were different data types that you could send, but I'm guessing with Photon.js it's all more ambiguous or string-like?

Any pointers would be greatly appreciated! Thanks so much!

Best,
- Eric

Comments

  • vadimvadim admin
    Sorry for so late reply.

    Good starting point for exploring Javascript photon sdk is samples which you can find in sdk package: basic 'demo-loadbalancing' and advanced 'demo-particle'.
    You need to load only Photon/Photon-Javascript_SDK.js . Other scripts marked as <!--dev--> in sample's default.html are for internal development use only and can be safely removed. It's even recommended to do so since they generate errors in log (we plan to remove them automatically during packaging in future).

    If you need chat application then you might be interested in our new Chat API feature. Check 'demo-chat' sample.

    Note: all samples require setting your app id in cloud-app-info.js file to run. Samples provided with both typescript and javascript (compiled from typescript) sources. Also typescript vs projects included.

    Please feel free to ask if something still not clear from samples or documentation provided with sdk package.
Sign In or Register to comment.