Find User here you can look for a user

My Colony 2 News Server Spec for Developers

2y
#1
Beginning the My Colony 2 v0.29.0, the game adds a new news ticker to the bottom of the screen, similar to the one found in My Colony 1.


The difference from this news ticker though is that it supports custom news feeds from third party news servers, and the server owner can set up multiple news feed sources that it's players can utilize by setting them up in the Statistics window. This can be a fun way for an MC2 server to differentiate itself from the rest,add some fun for it's players, or even just offer news items in different languages.


Setting up a custom news server is not necessarily a beginner task, but it is not overly difficult either.

You can setup your news server however you like, it just needs to be able to accept a JSON object from the My Colony 2 client as post input, and to print out a JSON object as a result. You should also set the access-control-allow-origin: * header, so that the client can access your script no matter which platform it is running on, and probably the access-control-allow-headers: Content-Type header.

This post will be updated as the spec evolves and more features are added, and can also be used for questions, and feature requests.

Primary Call

When a My Colony 2 server first boots up, it will query it's news servers with the following post data:

{
"req": "networkinfo",
"extras": {
"hostOS": "os string",
"sid": "guid string for server",
"gid": "guid string for game/mod",
"un": "ape apps account username for player (string)"
}
}

Update 20231103: Added the un field to the extras object (example above updated). This is the username of the individual player who is requesting the news feed, not of the server owner.

Update 20230302: As of MC2 v0.33.0, the game client now also transmits the host operating system, world id (sid) and game identifier (gid) when requesting news feed data. The above code has been updated to reflect the change.

This request for network information expects a JSON formatted response, containing the following items:

{
"networkName": "My News Network",
"networkNameShort": "MNN",
"logoBackground": "#00ff00",
"logoText": "#000000",
"logoStroke": "#0000ff",
"taglines": [],
"responses": {
"healthcrisis": [],
"techunlock": [],
"highunemp": [],
"ollargestsettlement": [],
"starvation": [],
"lowapproval": [],
"lowsecurity": [],
"lowentertainment": [],
"loweducation": [],
"contractsales": []
}
}

taglines is a string array which can contain one or more "taglines," or random headlines that the news ticker will play when there is not much going on. An example could be something like: You are watching MNN - The most trusted name in news.

healthcrisis is a string array containing responses that will play when a settlement is having a low health crisis. It includes two properties that will be auto-populated by the engine. ex: There is an ongoing health crisis in #settlementname! Will #ownername do anything about it?

techunlock is a string array containing news items for when a player unlocks a new technology. ex: #name has unlocked #tech

highunemp is a string array containing items for when a settlement is experiencing high unemployment. ex: #settlementname workers struggle to make ends meet as unemployment soars, #ownername's failed leadership to blame?

ollargestsettlement is a string array for when the global MC2 server announces what the current largest settlement in the entire My Colony 2 online galaxy is. ex: With a population of #population, #settlementname on #worldname is the largest city in the galaxy!

starvation is a string array containing announcements that a settlement on the world is facing starvation, ex: #ownername goes into hiding as #settlementname residents resort to cannibalism!

lowapproval is a string array containing news articles about a settlement owner's low approval ratings, ex: Time for #ownername to go? #settlementname residents are fed up with current leadership.

lowsecurity is a string array containing news items about the low security rating in a settlement, ex: #ownername plays the fiddle while crime wave spreads through #settlementname!

lowentertainment is a string array containing items related to a low entertainment/morale rating in a settlement, ex: #settlementname residents blame #ownername as local colonist literally dies of boredom.

loweducation is a string array of news items related to a low education rating in a colony, ex: Brain dead in #settlementname? Residents demand education but #ownername fails to deliver.

contractsales is a string array for announcements that are made when a player on the server sells a contract through the Galactic Board of Trade, ex: #name sells #count contracts on the Galactic Board of Trade worth $#total.

The News Ticker is an exciting new feature for MC2, and the current feature set in this initial rollout is only the beginning. In the coming updates, the news ticker will also support positive news stories (most of the current ones are negative), as well as an option to query for stories that are unrelated to anything particular in the game, even stories that present a full news article when clicked on.

So let me know what questions/suggestions you have, and feel free to try to roll out your own news server, it really souldn't be too difficult!
Owner of Ape Apps, LLC
2y
#2
this is going to be very funny
Boat enjoyer
2y
#3
@bastecklein, what if the news system could be partially integrated into settlements themselves? You might be able to set rudimentary news messages in-game through the multimedia center, while also being able to access and choose channels from a large selection of "registered" third-party news sources for the game, similar to the mod menu in MC2.
Boat enjoyer
1y
#4
Update (at request of @spamdude if I remember right), the primary call to the news server (as of v0.33.0) will now transmit an "extras" object, containing host operating system, server id, and base game id. Code example in original post has been updated to reflect the change.
Owner of Ape Apps, LLC
Welcome
Ape Apps, LLC is an independent software development company founded in 2010 by Brandon Stecklein. Over the years, Ape Apps has published over 400 apps and games across various platforms. You can get in touch with Brandon on Twitter or by leaving a post on his wall @bastecklein
App of the Day