CrowdGaming - your smartphone is your controller

0 favourites
From the Asset Store
Small pixel icons for the 3 most popular controller types.
  • - Is there a way to be able to make the server connection stuff lookup a dynamic IP address instead of pre-filling it in the project properties?

    Imagine a situation where you export the app to nw.js for example and when you run it you would need to main program to show you the connection information where the players will need connect to. If it could display in a text field the main games local ip address that would be awesome.

    thanks!

  • russpuppy

    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% > > @OneMuppet - I was playing around with this idea, but can't get nwjs to run a bat file, it seems to only like .exe's

  • Hi,

    just a question...

    Anyway to display several maingame on several devices ?

    For now it's always the first connected which is maingame, and all the others are controllers.

    in the start sheet, it's "on connected to server / Is Controller => Goto ctrlJoystick

    Else goto Space"

    how to "not be Controller" anymore, and just display the main game screen ?

    Thx

  • justifun I'm not sure if I ever got the bat file to work or not, but you will have to do an export and then run the exe-file to test the "Run file" action. But you probably already tried that since you were able to run exe-files.

    I did some research about nwjs and learned that it doesn't use any web server (which I originally thought) but instead it reads directly from disk. The export produces a file called package.nw if you rename this to package.zip and look in the zip-archive you find all your files there. However these files only work when run in the nodewebkit environment, which means I can't just "server" these file from a web server because there would be dependency errors.

    So why do we need a web server? Well we need the "controllers" to be able to connect to something. What I have done to make this work is:

    • add server.js as a project file
    • modified the nwjs plugin and added a start web server action
    • In the Start event sheet I've added Start Web Server and Run "node server.js"
    • Export with Nwjs exporter
    • Open package.nw (rename to zip and open)
    • Export with html5 exported
    • Create a directory called "controller" and add html5 export to it
    • Add the "controller" directory to the package.zip file
    • rename package.zip to package.nw
    • run the exe

    When you run the exe it will start a web server that will "serve" the html5 export on port 50000, so when you connect to ip-of-host-machine:50000 you will see the controller, as you normally would. The main game also starts the server.js file so the main game an controllers can connect to one another.

    This is a step in the right direction towards being able to package CrowdGaming games to the masses. The problem with showing the ip-that the "controllers" should connect to still remains.

  • Amadeus The server doesn't know much about the game, it's basically the main game that has all the info, plus we only send actions and preferably only delta actions (when anything changes), . So if we want a controller to act/show the main game screen we would have to the that info from the main game. Only the main game know the exact state of the game.

    I would suggest that we use the System Save to send the entire state of the main game, and then use load from json in the controller to draw the state of the main game.

    You could do this with the CrowdGaming plugin as it is today, but it will require some well placed events. Or we could make this into a plugin feature. So that the main game could use an action like "Update Main Game State" which would take a string (the saveStateJson), and when this is sent to the server it will broadcast it to every controller that has activated the ListenForMainGameChanges. In the controller a On Main Game State Changed condition would be triggered with a Main Game State Json, that can be use to load the game.

    Your thoughts?

  • Yeah being able to save and load the state would be awesome. Can't wait to show you what I have made so far with the plug in. It's been a lot of fun.

  • justifun I would love to see it! I'm too tired right now though. Not that many hours before my kids will wake me up, I will try to turn on skype once in awhile to see if you're there

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • good idea.

    I don't have any specific requirement, I just wonder if this was possible, cause it may be veryusefull to have multiple game screen

    Actually, i found free server where you can host nodejs server : https://www.heroku.com/home

    I didn't try it by now...

    so i just wander if it was possible to have a game hosted on the web, and multiple players playing on multiple computers and devices. My idea was a Menu at start when you connect the URL, where you choose if your device is a screen game or a controller for a new player.

  • There's some new progress on the "getting your local IP address" front

    Thanks to Noncentz705 in a different thread, a much simpler cleaner solution has been provided.

    https://dl.dropboxusercontent.com/u/139 ... tIPc2.capx

    Old messy method:

    I made a tiny exe file that gets the local IP of your machine, then adds it to a txt file and stores it in the same location as where you ran it from.

    So. Copy the GetIP.exe file i've included and put it in the same folder as your exported NW.JS project .exe file (https://dl.dropboxusercontent.com/u/403350/LocalIP/GetIP.exe)

    Then checkout the capx i've included to see how to execute and read the IP into your project.

    Now you can tell the controller players which IP to connect to once the main game window starts!

    Edit: Also, if you are Testing using NW.JS for previewing, put the GetIP.exe also in your C:\Program Files\NWjsForC2\win32 folder

    Capx: https://dl.dropboxusercontent.com/u/403350/LocalIP/WorkingMakeIPaddress.capx

  • Great!! That's awesome! I'll check this out tomorrow! Thanks for sharing!

  • Question for you, What does this mean in the nodejs console

    Some of the lines specify just one broadcast to all players, eg: "Alert" as you can see in the example.

    Some of them have multiple broadcasted signals, like the last line.

    The issue i'm having is that, the last line for example, should be broadcasting the world "EventDeactivate", but it seems to be truncating the end of it. I tried shortening the broadcast word, but it still seems to drop a letter or two at the end.

    Any idea what's going on ? Is it trying to broadcast more then one thing at a time?

    Are the commands between each | line a seperate "action#" signal?

    thankx

  • justifun PoisonDarts, sounds like fun!

    That is most likely a bug in my getSendToObject method which does some parsing. I'll have a look at it.

  • justifun I had tangled myself into a substring mess, I've cleaned it up now, thanks for spotting it!

    function getSendToObject(str) {

    var pieces = str.split('|'), to = pieces.splice(0, 2)[1], msg = pieces.join("|");

    return {to: to, msg: msg};

    }

    I'll try to update the latest beta package, or if I can't do that I'll upload a new one and notify everyone.

  • justifun I've shared the 4.4 release with you. I have change some names of actions, due to spelling mistakes. This could cause a lot of problems for you if you use an old capx, with this new crowdgaming plugin. I had to rename my capx to zip, then open the archive and rename the action/conditions/expressions that had changed. Basically you start your capx, see which error C2 throws at you and then to correct these in the mgbase.xml located in the crowdgaming.capx zip archive.

    Let me know if anyone want help you clean up your capx? I don't want you to go nuts and stop using the CrowdGaming plugin since you've invested time in it.

    I will share the 4.4 release everyone else soon, wait for the email.

  • New release 4.4.1!

    • Added a simple drawing "game"
    • minor bugfixes
    • Action1 through 4 are now string only, make sure you update your event sheets and change Action1 = 2 to Action1 = str(2) or Action1 = "2"
Jump to:
Active Users
There are 2 visitors browsing this topic (0 users and 2 guests)