CrowdGaming - your smartphone is your controller

  • Sure, no problem!

    Thx!

    Can't wait to test it!

  • This is what's new in the next release:

    • Avatar (controlled character) is visible in controller
    • Score tracking, in main game highest score = first place
    • Added animations, and changed sprites (in the example game collectItems).

    Server

    • Cleaned up the code, removing quite a bit of unused code.
    • Some optimizations to let the most common actions execute quicker

    ----------------------------------------

    Also since the first "Setup" video, I've changed so that you no longer need to separate construct 2 instances. The controller and the game are both in the same capx-file. In short the setup should be:

    • Install Construct 2
    • Install Nodejs
    • restart computer (if needed)
    • open a command prompt (winkey+r and type cmd)
    • type: cd "C:\Games\CrowdGaming Beta-v3" <----------- path to the directory where you have the CrowdGaming beta pack.
    • type: npm install nodejs-websocket
    • type: node server.js

    the server is now started, to stop it, click on the command prompt window and hit ctrl+c

    • Start Construct 2 (Run as administrator) set up so that you can preview over lan
    • Open the event sheet called Start and change the variable called "prodUrl" to match your ip (do not remove the port number, :8002)
    • You may need to restart Construct 2 once if you changed the preview on LAN address, setting
    • Run Construct 2 as Administrator
    • Make sure you are in the "Start" layout when you hit "Play"
    • The first browser-tab will be the MainGame, the following will be controllers, if you access the same address with a smart phone that too will be a controller.

    The test/development-cycle is very quick once you have done this initial setup, because you can code you changes and hit play and instantly play the game.

  • OneMuppet this awesome so far! Really enjoying messing with this and coming up with some fun ideas for it. I have had no problem setting it up at home on my PC with Construct 2 on it using my IP address. But I have had some trouble this morning trying to figure out what to use if I wanted to run it on my work laptop which is a Mac. I have VMware and able to use Construct 2 on there but not sure how to set it up for other computers to run on. I know you mentioned exporting as html, but when I tried that and put them on my Mac it tries to use the whole file//: stuff instead of an IP address. Any kind of suggestions would help a lot!

    Thanks again and keep up the awesome work!

  • Djfuzion,

    Download and install xampp on your mac. Use the xampp control panel to start apache. Then export Onemuppets package as html5 to the xampp htdocs directory (D:\xampp\htdocs on my windows PC). You should then be able to browse to your macs ip address and see the game/ controller.

  • Hi! I'm also running this on a virtual windows machine on my mac. I'm using parallels, which is similar to VMware, if I remember correctly you can also use a bridged connection when setting up the network between your host machine and VM. This is the network setting that I'm using which allows me to connect to my VM from my Mac, and also connect to my VM with my smartphone/ipad etc.

    ---------------

    Other wise just do this.

    • Get the mac.s ip and add it to the prodUrl variable.
    • Add the server.js file as a file in the construct 2 project (so that it will be exported with the project).
    • Export from Construct 2 to some folder that you can access from your mac (so that don't have to copy paste anything).
    • Switch over to your mac, and open the terminal, cd into the directory where you exported the game to
    • type: npm install nodejs-websocket
    • type: node server.js
    • type: python -m SimpleHTTPServer 8080

    now you can browse: http://<ipOfYourMac>:8080 and everything should work fine. It will most likely run much better on the mac with the python Simple http server than it does on the VM, at least it does for me

    (or maybe it's just my mac being jealous that I spend so much time in windows?)

    use: cmd + . to stop the node and python webserver (you probably already knew that but I tend to forget those key combos so I'd figure I'll throw it in here).

  • oldandgrey

    Thanks! I had my answer in preview while watching tv so I missed that you answered. More options are good

  • OneMuppet

    Thanks! I just try it and it works fine! I was also able to play on my connected TV! (but the browser is shit and it was very laggy...)

    BTW, hope I'll have some time this weekend to dig more to see how it works and experiment some ideas!

    Great work!

  • Sorry if this is a dumb question but I'm curious why you are using a nodejs game server instead of the webrtc multiplayer plugin?

  • russpuppy

    That is a great question! WebRTC was my initial choice. Unfortunately there is very limited support in the browsers on iOS for webRTC. There is a browser called Bowser that supports it, but the thought about CrowdGaming is that you should only need your smart phone and not have to download any specific app to make it work. Most smartphone browsers supports websocket, which is why I went with the nodejs websocket server. When the world is ready I'll look into doing this with webRTC

    http://caniuse.com/#search=webrtc

    http://caniuse.com/#search=websockets

  • OneMuppet

    Oh, that is unfortunate—I didn't know about iOS not supporting it because I've only been testing with Android. I hope iOS Safari gets on board soon.

    So, next question. let's say hypothetically you wanted to make a game that anyone could download so they could run their own party game. With the nodejs websocket server do they have to set up nodejs stuff themselves or could they run a single executable to get the game up and running? Watching your video it looks like the host player would have to open the command line up to get nodejs going. Seems like that would be a complicated step for lots of users (if you were to distribute the game on Steam or something, for example).

    Thanks

  • russpuppy

    Hi,

    I just try it, so I also asked myself this question but I think nodejs can be run with a .bat easily.

    OneMuppet

    The question is more how to get user IP and modify the game to host the game on this IP and send it to the player (maybe via a QR Code). Also how to easily force windows firewall to open the needed port...

    By now, you need to do this yourself, (modifying the capx file) so, on a standalone version, this need to be automatic and completly invisible for user.

    I also wander, for a web hosted game, what kind of ping we can have with nodejs? with wifi connection and with 3GS... I don't know if this can be reactive enough for a platformer or a shooter game...

    Some idea : In this version, the first device connected show the game screen, any other device connected after will be controllers. I wander if it's possible to add a button on the controller to switch to game view. So we can have several game screen and several controller, playing the same game.

    Exemple1 : I play with 2 friends on my PC in my living room, and 3 others friends play in another room on another computer (like Team1 vs Team2)

    Another idea would be to create different game view and different controllers.

    Exemple2 : on a RolePlay game, 1 player is Master and have a specific controller (maybe specific game screen too), the other players play on a different screen (on another computer) with different controllers (maybe each player would have a specific controller with specific info, characters sheets, inventory, etc...)

    That could be really fun ! The Master may modify the map in realtime, add PNJ, items, etc...

    And each player may have his own character sheets, stats, inventory, secret objectives, etc.. maybe a chat between players to send secret message or exchange items...

    Sorry to ask so many questions But I really think it has a great potential, cause many "traditionnal" board game or roleplay game can be "digitalized" using this concept.

    Thanks for reading

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have a three line text file saved with Windows word pad.

    It looks like this...

    cd C:\CrowdGaming Beta-v3

    npm install nodejs-websocket

    node server.js

    I start the word processor and 'cut' then 'paste' into cmd.exe opened in administrative mode...

    Adjust to suit your install. Have not tried it as a .bat file yet.

    As development continues documentation will catch up to it.

    WebRTC is still used by only a few browsers. Moreover, you need a specific web server. If that server

    goes down for any reason your program will no longer function. Ability to run off the internet with any reasonably current browser is a defining feature offered by this innovation.

    Co-operative games whereby players need the help of others to accomplish a goal is another way in which this could be used.

  • russpuppy

    I think it could be possible to distribute the nodejs binaries together with your game, it's not something I've tried yet. If anyone knows more please share.

    I also think that the NW.js exporter could be a good choice since we could start files from the OS with the nwjs plugin. Hypothetically we should be able to run a .bat file or equivalent On Start of layout in the "Start" layout and when running that bat command try to find out the ip (ipconfig) and then start the nodejs server (node server.js) then instead of having prodUrl as a static variable in the construct 2 project we could read this from a file which we modify in the start.bat with something like:

    for /f "delims=[] tokens=2" %%a in ('ping %computername% -n 1 ^| findstr "["') do (set thisip=%%a) echo %thisip% So then the user would just click on the CrowdGaming.exe file from the NW.js export and everything would setup itself. That's just from the top of my head and that will need quite a bit of work and tuning to be streamlined but it should be possible. I'll look into a bit more regarding the server pushing out messages, I'll probably rewrite the nodejs abit to make it more generic, so messages starting with p are interpreted as from p(layers) and messages starting with a s are from the s(erver) and if it comes from the server without specifying to whom it is for it will be interpreted as a broadcast message, that will be sent to all clients. I'm also very interested in knowing if @Ashley are considering looking into adding binary data sending into the websocket plugin? What are the know issues and the reason it has not been added yet? With binary data it would be a lot easier to minimize the load sent between the controllers and the server. Thanks for all the great ideas everyone keep messing around with the beta package and I'll send out an update when I have something new. Next I will keep adding to the example game, making the server more generic and also add new example controllers. But it's great that people are thinking ahead about steam publishing and so on, it's always good to consider those things early.

  • Trying version 3 beta - I run node server.js and adjusting the IP in the event sheet. Then after starting the construct preview, it starts the game but no logs are showing up in the command prompt window.

    i tried disabling my firewall and also adding exceptions for port 50000, and 50001 like in the video.

    doesnt seem to connect to nodejs

    EDIT: ok im dumb. In case anyone else runs across this issue. Make sure you are running the "Start" layout first. duh. i was running the main game one.

  • OneMuppet says: "I'm also very interested in knowing if Ashley are considering looking into adding binary data sending into the websocket plugin? What are the know issues and the reason it has not been added yet? With binary data it would be a lot easier to minimize the load sent between the controllers and the server."

    Totally agree with that.. any news?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)