Jump to content

  • Log In with Google      Sign In   
  • Create Account


How do I update text (or anything) in a game, in real time?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Cappa Games   Members   -  Reputation: 125

Like
0Likes
Like

Posted 03 March 2013 - 01:02 PM

If I wanted to add a news section to my game so I could update it in real time, how would I go about that? If I could get some direction that would be great. I'm good at researching things and figuring them out for myself, but I don't know enough to even know where to start.

 

Purpose: I want to be able to add updates (Ex. News Update) to a game in real time. These could be done through text, links, pictures....i want it to be pretty flexible.

 

I just need a general idea of how that would work and all the parts that are needed.

 

Thanks



Sponsor:

#2 SimonForsman   Crossbones+   -  Reputation: 6034

Like
1Likes
Like

Posted 03 March 2013 - 01:27 PM

a fairly simple and flexible approach is to just embed a html renderer (Webkit, Gecko, etc) in the game and display the newsfeed as a html page (Which you can retrieve from a webserver using curl (or some equivalent library)), You could also do the same with a custom renderer and json or xml data.

If updates need to arrive alot quicker (if you fetch http data you can't really have your client ask for updates too frequently or it will kill your server) you pretty much have to write a custom server and have the game open a connection to that (And then push out updates from the server rather than have the client ask for updates)

Edited by SimonForsman, 03 March 2013 - 01:29 PM.

I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#3 Cappa Games   Members   -  Reputation: 125

Like
0Likes
Like

Posted 03 March 2013 - 03:43 PM

Thanks for your reply! Very helpful.

 

If I'm understanding correctly:

 

  • Have the game link to an HTML5 page with the news feed
  • Use this HTML5 page to change text, images, etc on the fly
  • Have a server running this HTML5 file and link the game to it
  • Preferably only update when a change is made to this page, rather than load the page every time someone loads the game up

 

Hopefully I can pull this off with Game Maker somehow...either way it looks like I'm going to have to learn a little bit of HTML5.

 

 

Thanks a lot for your help, I was completely lost, but now I have a rough idea of what I need to do.



#4 Bubsy   Members   -  Reputation: 407

Like
1Likes
Like

Posted 03 March 2013 - 06:40 PM

Preferably only update when a change is made to this page, rather than load the page every time someone loads the game up

 

Just load the page at startup, It'll be easier to implement and it's a relatively cheap operation. (To prevent UI blockage during the load-time, you should load the page on a background thread)



#5 hplus0603   Moderators   -  Reputation: 5155

Like
1Likes
Like

Posted 03 March 2013 - 08:28 PM

Hopefully I can pull this off with Game Maker somehow.

If the requirement is "has to be implemented within Game Maker" then that may be a pretty harsh requirement.

I agree with others: Spin up a web server that serves the "news and information" page. Web servers are great at distributing semi-static content. Load this from the game and display it. If you don't need the full HTML DOM / CSS / JavaScript engine, you could probably write a simple text-and-image renderer that understood just enough HTML to display your news blurb correctly.

Most web browsers pay attention to cache control headers, so you can mark your news data to expire a few hours from when it's fetched. That way, a client will re-load news only if it's been several hours since it last saw it.
enum Bool { True, False, FileNotFound };




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS