Online Game using HTML Object - Theory

This forum is currently in read-only mode.
0 favourites
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I had this theory that I could make a complex multiplayer game suing the HTML object, and I was wondering what everyone's opinions were on the feasibility of it working properly.

    My plan is to make an overhead view game like the old GTA games. The player will run around shooting at things, picking things up etc. There will also be other players that can join the game and run around with the other players.

    My overall idea is this:

    Knowing that the HTML object is way too slow for accurate and real-time movement I was planning on "faking" it. The player will move around as normal on his/her screen, while the other players will use a pseudo AI to control the more complex actions. The HTML objects comes in to play by sending the players X and Y coordinates every few seconds, and data such as "is shooting" and "is searching" etc.

    In between the pings of data, the AI takes over and moves the player towards the coordinates the last ping data was set to. There will also be some correction data so if the players coordinates don't update correctly for any reason, the character may appear to "teleport" nearer the actual location of the real player. This may look and feel like the old-school lag from dial-up days, but I was thinking it may just work.

    Any thoughts or ideas to add to this?

    I will also be using Rich's early alpha online plugin he has made for a chat system since it seems to work just fine for that as it is.

    The only problem I can foresee at this point is how the client and server will communicate? Should it be made to work as a straight peer to peer data transfer? Is a server required at all? Will it even work?

    Any input or considerations is much appreciated. Thanks in advance.

    ~Sol

  • You could do something based on nodes, or way points, like if another player gets to building A it sends an update. Then the individual clients could use some sort of interpolation using last know coords updated to the new one.

  • So, if I shoot at a player, I'm not even sure I'm really hitting that player? And I also wouldn't be sure that a player is shooting at me? I think the HTML object can be used just for online card games, etc. Interpolation between the last known coords is way too inaccurate.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Obviously you couldn't do anything even remotely resembling real time. That is a given.... duh.

  • I will also be using Rich's early alpha online plugin he has made for a chat system since it seems to work just fine for that as it is.

    Whoah, wait, did he release an early version in chat or something? I don't remember anything being released.

  • You need a proper online object, it won't work via the HTML object. It's the wrong technology, it's based on clients making requests to servers, which then respond with a document. There's no way for the server to notify the client out of the blue. You might get a turn based game or something working but still - it's like using a SQL database for a todo list. Way too much technology involved, which is going to make it clumsy and slow.

  • You could do something based on nodes, or way points, like if another player gets to building A it sends an update. Then the individual clients could use some sort of interpolation using last know coords updated to the new one.

    Yeah that's pretty much what I was thinking. Using nodes or target waypoints, and the players "AI" will move them to the next updated position. Sort of like a real-time game using turn based node updates.

    So, if I shoot at a player, I'm not even sure I'm really hitting that player? And I also wouldn't be sure that a player is shooting at me? I think the HTML object can be used just for online card games, etc. Interpolation between the last known coords is way too inaccurate.

    It's going to be a cooperative game, so shooting at other players will not be an issue.

    Linkman: There was an alpha test of the online object that was being worked on in the chat room one night. It was never officially released but seems to work ok for a chat program.

    You need a proper online object, it won't work via the HTML object. It's the wrong technology, it's based on clients making requests to servers, which then respond with a document. There's no way for the server to notify the client out of the blue. You might get a turn based game or something working but still - it's like using a SQL database for a todo list. Way too much technology involved, which is going to make it clumsy and slow.

    So... you are saying it won't work at all? Or just not work very well?

    Slow won't really matter... that's what the AI will be for. As long as the other players are kept relatively close to their intended position, and shoot when they are pressing the shoot key (specific number of rounds fired etc won't matter... it will be shooting until the clip is empty for all I care.) then it would be fine.

    How slow are we talking here? Would updating the player location every 2-3 seconds be too much?

    Cheers all!

    ~Sol

  • Updating the player position every 2-3 seconds is way too slow. Your game will probably be unplayable. At a big stretch you can only interpolate (guess) the player's movements for about 250ms before weirdness starts happening, like teleporting because the system guessed wrong. Network programming is hard, and I'm sure it'll be harder if you force it through the wrong technology.

  • A cross between GTA, and checkers might be a better way to think of it. I know that makes it sound real dull, but there are a lot of cool things you can do in a turn based system. Look at some of the older turn based rpg's out there. I know of several that take a few minutes just to show a magic spell.

  • You could use weapon/spell effects to hide latency perhaps? but yeah, HTTP means definitely turn based.

    Consider that big games like UT3 do the same "AI in between" (called interpolation there) but between UDP packets.... and still you get some lag. With HTTP your lag would go out of control and clients would desynchronize... unless you make them wait for a synch on each turn

  • I think the correct term would be dead reckoning, which is essentially making educated guesses as to where an object might be at any point in time between data packets. I don't really think a system like this would work for such high latencies, though.

  • Hmmm...

    I might still have to test it at least... The position of the players aren't super crucial anyway since the AI will take over for the other players and make them "help" your player.

    The location of each player only has to be very approximate (say a 300 pixel margin of error).

    The proposed AI idea would involve the other players characters sticking close to you... only if they leave the immediate screen area, go into a building, or leave the screen and go to another screen all together would it really need to "adjust" the players location.

    "Teleporting" the player in the event of them doing one of the above things wouldn't be such a bad thing... I'm just really keen to get something at least functional until such time that we get a full online object that can track things better.

    Am I still barking up the wrong tree or is it worth testing out? I don't want to waste a bunch of time if it's just not going to work, but I also don't want to wait forever for an online plugin.

    ~Sol

  • I still don't think it's going to work. What do you mean, having AI control other players and make them help you? Won't you end up with horribly conflicting events if one player sees their friend shoot an enemy because the AI tried to help, but that person never did that and the enemy is still alive for them?

    Wrong tool for the job, sorry - best put off till there's a real networking plugin. (don't know when that will be though)

  • I still don't think it's going to work. What do you mean, having AI control other players and make them help you? Won't you end up with horribly conflicting events if one player sees their friend shoot an enemy because the AI tried to help, but that person never did that and the enemy is still alive for them?

    Wrong tool for the job, sorry - best put off till there's a real networking plugin. (don't know when that will be though)

    The plan is to not have sync between the games.

    It is designed to be more like a single player experience, but with your "friends" being able to join in, simply by logging in to the game. Basically people you meet in the game and become friends with, when they log in, their character will basically help you in the game much like a completely computer controlled AI would. The placement of enemies will be irrelevant to anyone else apart from the each indivdual player in relation to thier character. Obviously I wanted to do it like this so you still get a multiplayer "feel" to the game since players would be able to chat and cooperate to a degree, while getting around the issue of having no online plugin.

    ~Sol

  • What if you tied it to parts of IRC? Was an idea I had way long ago, before modern methods had been invented, and everything was a lot more complicated and annoying. Basically special rooms could be used as the backend of an online area, but rather than people chatting in there, their messages contained coordinates and other useful info. That's all sent to logs as you know, and those are also timestamped. Each message sent by someone could include a brief message also, which could allow for basic chatting inside the game.

    So couldn't it simply use what amounts to nothing more than text files, to control the positions of various sprites?

    As for sending it to IRC. A simple script could be used to just send the contents of a text file, or something along those lines. Construct can read and write to external files. It's granted, a very basic way of doing it. But it would work for the more simple games, and the more basic RPG kind, or even just visual chatroom applications.

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