rogerfgay's Recent Forum Activity

  • Mozilla Launches Online Game Using HTML5, WebSockets

    tomshardware.com/news/Mozilla-WebSocket-HTML5-BrowserQuest-MMOG,15136.html

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So, my next question is: How does the HTML 5 page work? c2runtime is rather small. Does that load and provide all the needed support? Even for the webocket calls? Or does anyone who uses this have to have a game engine installed first?

  • Now I've even exported to HTML 5 and put it on my dev system's server. Only works when I have the two servers running though. Dev system isn't the same as the demo computer I'm running for the other WebSocket demo ... which is full time.

    Arrows cause movement but do nothing with websocket. czsx send r, l, u, d websocket commands which are returned as JSON strings. You get approx. the same movement with both.

    isr.servequake.com/WSGameTest

  • Yeah you can either have the server send a 0 after x amount of time, or have the client do it.

    Of course if the client does it you run the chance of getting out of sink.

    Then again the ideal method would be to do all the movement on the server, and just update the position data, then all the client would do is interpolate the xys, etc.

    Seems like I always have to think at least twice whenever you post. :)

    I recalculated and kept track of position in a robot control center I built to demo the prototype of the HLL Framework ... at that time using a workaround for websockets since they didn't exist yet. Then passed position information to the browser that controlled an SVG object that moved around in an image of rooms (walls and doors).

    That was ok.

  • Adding a wait in between makes the simple demo more convincing. It's not performing the same operation as the arrow keys. I think that's the core problem here. Anyways ... this may be enough for my very first proof of concept experiment. You're right on track newt ... next step is to think about what it would take to assure things are in sync.

    Whether or not this can work really well can depend on whether I can get a solid understanding of how Construct 2 works and whether I'll be able to perform the operations of the game via server input (if I may think in print by stating the obvious).

    It seems quite oriented to people who don't program so I'm wondering if they're just not going to be interested in sharing any detailed technical information. I know there's an SDK. Maybe that's enough.

  • TCP is the problem. By hanging I mean all transmission was held up, so remote players stopped moving. It's the OS waiting for a dropped packet to be retransmitted.

    WebRTC supports DataChannels, allowing arbitrary data (not just media) to be transmitted, and can use a UDP-based transport as well.

    So, you've got a command like "move right" and it's hung up in transmission somewhere. How does WebRTC solve that?

  • Yeah you can either have the server send a 0 after x amount of time, or have the client do it.

    Of course if the client does it you run the chance of getting out of sink.

    Then again the ideal method would be to do all the movement on the server, and just update the position data, then all the client would do is interpolate the xys, etc.

    Would rather not try to keep the server in sync with game calculations. It would seem practical if I could just yank the new pos info and send it to the server for distribution.

    In order to make this work really well, maybe I'll have to dive into the SDK and build a plugin. I'd rather not make that decision at this point though ... with so little experience with Construct 2. I'm starting to wonder how cooperative the Scirra team might be if I get all fired up about doing this.

  • Tried initializing dictionary values to 0 and conditioning movement on a value = 1. That in itself still works as above .. continues movement until another key is pressed. Then I added Set &Key& = 0 after the 8Direction simulation in each.

    I can tell that the event is still triggered because the sprite changes shape to indicate direction. But it doesn't move at all now. I'm guessing that the reset happens before the movement occurs and stops the movement.

  • You can add an action to the on start of layout to download the contents of the dictionary as json.

    This is what that string would look like:

    {"c2dictionary":true,"data":{"right":0,"left":0,"up":0,"down":0}}

    So basically you could just concatenate your data with an &:

    {"c2dictionary":true,"data":{&your data&}}

    SUCCESS! of a sort. Had to escape the double quotes to make it work and I apologize for my initial confusion. I've been using JSON like objects for many years without ever calling them JSON or using any special JSON processing objects. They're JavaScript objects. Easy enough to roll my own. :)

    I'm now using czsx for right,left,up, down to send websocket messages. "right" "left" etc. are defined in the dictionary and Key "up" = 0 ... event triggers sprite simulate 8Direction up as per the first suggestion.

    I can use the arrow keys and they work locally but do not send any websocket message. Since I haven't coded for multiplayer (all I'm doing on the server end is sending back a JSON string with right, left or whatever in it) ... using different keys to send the websocket message avoids the infinite looping.

    What I'm getting now though is if I press S for up, for example, the sprite continues moving up until I click another button. I'll start looking. I think maybe there's a way to reset the value or something.

  • I've set up another server and am modifying the responses. If I'm not mistaken, the JSON command is in the form Keyboard.OnKeyPressed.Right or something like that.

  • Your games hang when waiting for a tcp response? That sounds like the days before browsers supported AJAX?

    RTC is for media files.

    UDP has packets up to 64K for IPv4 and greater for IPv6, which is way more than needed for most command transfers. So ... I won't be waiting for anything more than a packet, a single packet, which if lost is gone. You don't want that. it means the other players' moves are not recognized.

    I don't think TCP is the problem.

  • this sounds juicy...

    :) .... Seems to be getting there.

    step by agonizing step (lol)

rogerfgay's avatar

rogerfgay

Member since 7 Sep, 2013

None one is following rogerfgay yet!

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies