• Advertisement
Sign in to follow this  

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

This topic is 1787 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement