Jump to content


Photo

Communicating a HTML5 game with another HTML5 game


  • Please log in to reply
8 replies to this topic

#1 Debels

Debels

    GMC Member

  • GMC Member
  • 2778 posts
  • Version:GM:Studio

Posted 08 March 2012 - 12:53 AM

Is there a way to communicate a HTML5 game with another HTML5 game with out using a server?

I know i can use JavaScript, but I don't know any JavaScript Yet :unsure:

Can you please help me with this :), +1 for the user that helps me with the JavaScript code
  • 0

#2 Desert Dog

Desert Dog

    GMC Member

  • GMC Elder
  • 6409 posts
  • Version:Unknown

Posted 08 March 2012 - 01:36 AM

How do you mean? Better give an example of what you want to do.

GM can read web-pages. So all you'd need to do is write to a page somewhere online, and makes sure the other game knows where.

A bit like how an online highscore would work, only your not saving highscores.
  • 0

#3 Debels

Debels

    GMC Member

  • GMC Member
  • 2778 posts
  • Version:GM:Studio

Posted 08 March 2012 - 01:40 AM

How do you mean? Better give an example of what you want to do.

GM can read web-pages. So all you'd need to do is write to a page somewhere online, and makes sure the other game knows where.

A bit like how an online highscore would work, only your not saving highscores.

What i mean is like a Chat thing that send packages with the name and message.

Like i write hi and all the people with that page opened see a pop-out message saying debels: hi

edit: i already thought of a way to write a message in a .txt file and make the game read it every second, but i think that would create lag some I'm looking for another option :/

Edited by Debels, 08 March 2012 - 01:53 AM.

  • 0

#4 Desert Dog

Desert Dog

    GMC Member

  • GMC Elder
  • 6409 posts
  • Version:Unknown

Posted 08 March 2012 - 01:55 AM

Same thing(or idea) should do it, only add a time-stamp, (so the game doesn't try retrieve every bit of conversation, everytime)
  • 0

#5 Debels

Debels

    GMC Member

  • GMC Member
  • 2778 posts
  • Version:GM:Studio

Posted 08 March 2012 - 01:55 AM

Same thing(or idea) should do it, only add a time-stamp, (so the game doesn't try retrieve every bit of conversation, everytime)

What do you mean?, can you give me an example?
  • 0

#6 True Valhalla

True Valhalla

    ಠ_ಠ

  • GMC Member
  • 5277 posts
  • Version:Unknown

Posted 08 March 2012 - 02:22 AM

I think he's asking about online functionality.
  • 0

#7 azcodon

azcodon

    GMC Member

  • GMC Member
  • 201 posts
  • Version:Unknown

Posted 08 March 2012 - 02:23 AM

Is there a way to communicate a HTML5 game with another HTML5 game with out using a server?

I know i can use JavaScript, but I don't know any JavaScript Yet :unsure:

Can you please help me with this :), +1 for the user that helps me with the JavaScript code



haha ,you can not use gm to open other gm.i tried it :)),i sound that gm get asynchronize in next version,let patient.althought i can help you about this but my friend dont accept because code is his
  • 0

#8 Desert Dog

Desert Dog

    GMC Member

  • GMC Elder
  • 6409 posts
  • Version:Unknown

Posted 08 March 2012 - 03:20 AM


Same thing(or idea) should do it, only add a time-stamp, (so the game doesn't try retrieve every bit of conversation, everytime)

What do you mean?, can you give me an example?


Well, when a chatter load up the html5 chat game, you'll set a 'current time' variable, the game then checks the 'log' web page, reads the first line. If the first line's time stamp is older than our current time, then we don't want it.. we'll just keep checking until something pops up.

I'm not gonna write you an actual example. I'm not very good with javascript, and that sort of stuff. The function you'd want to use to check the page is xmlhttprequest, but also, you may find something like JSONP more suitable.

There are quite a few 'javascript' chat examples around the place, googling brought up a couple, like this one:
http://community.liv...m/docs/DOC-1039

Although, I don't think they use the method I outlined.
  • 0

#9 waxbulletgames

waxbulletgames

    GMC Member

  • New Member
  • 25 posts

Posted 09 June 2012 - 05:11 PM


Same thing(or idea) should do it, only add a time-stamp, (so the game doesn't try retrieve every bit of conversation, everytime)

What do you mean?, can you give me an example?

He means a way for the game to distinguish which chat came first. If it laggs one chat and the other isnt lagging than it will mix up the order of the two. if you have a little label on it like send_chat(global.time,message). message is what you typed and global.time is exactly when you hit send. thus when its recieved even if its delayed it knows which place to put it.

Can you explain how you made the game write into a txt doc on a webpage like you explained
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users