Live data from Hacker News

SimCity UI Code + DRM

gist.github.com

1–10 of 66 posts

Re: SimCity UI Code + DRM

#2
What parts of SimCity were written in Javascript?

(Before you say "The UI, obvs", I'm wondering if it's a common practice to write UI code in games in javascript. I know that Gnome has a lot of JS that's tied into UI, I didn't expect the practice to make itself into game dev).

And if this code is actually from SimCity, does SimCity have some type of v8 or other js engine packaged with it?

Re: SimCity UI Code + DRM

#4

What parts of SimCity were written in Javascript? (Before you say "The UI, obvs", I'm wondering if it's a common practice to write UI code in games in javascript. I know that Gnome has a lot of JS that's tied into UI, I didn't expect the practice to make itself into game dev). And if this code is actually from SimCity, does SimCity have some type of v8 or other js engine packaged with it?

I can't really speak for how common it is, but the Battlefield Play4Free server browser is written in Javascript [1].

[1] http://documentcloud.github.com/backbone/#examples-battlefie...

Re: SimCity UI Code + DRM

#9
3.5 mb of Javascript. Glug. Looks like just the game ui. I cannot really find references to DRM like the title says.

Lots of nice references to cheats though! They all rely on simcity.DEBUG being true,

  if (simcity.DEBUG)
      switch (a) {
      case scrui.kKeyCodeDigit1:
        c && (e && !d) && scrui.RunCheat("scgameui -unlockalltools");
        break;
      case scrui.kKeyCodeLetterW:
        c && (e && !d) && simcity.CreateUnit("T_RCI_AddHourlyIncomeCheat")
      }
Also pretty nifty: There's a rest api built into the game for communication, (as wel as websockets) and the name and email of one of the programmers are still in the code.

  simcity.TutorialFakeUserData.creator = {
    uri : "/rest/user/0",
    tutorialState : 1,
    id : 0,
    screenName : "Chet Keno",
    email : "mayorkeno@simcity.com",
    nucleusId : 0,
    lastLogin : 0,
    isOnline : "true",
    avatarImage :     "Graphics/Tutorial/tutorial_avatar_keno.png",
    cities_count : 1
  };
Also interesting is that it seems that this is not just a stripped v8 engine. There's things in the code that make me think the whole game UI is actually a pretty decent webkit engine:

  simcity.gEventManager = new simcity.cEventManger;
  simcity.gEventTypes = {
    CLICK : "click",
    MOUSEUP : "mouseUp",
    MOUSEDOWN : "mouseDown",
    MOUSEOVER : "mouseOver",
    MOUSEOUT : "mouseOut",
    ITEMSELECTED : "itemSelected",
    KEYUP : "keyup",
    KEYDOWN : "keydown",
    DATACHANGED : "dataChanged",
    HASHCHANGED : "hashChanged",
    GENERICEVENT : "genericEvent",
    SOCKETEVENT : "socketEvent",
    SOCKETCONNECT : "socketConnect",
    SOCKETDISCONNECT : "socketDisconnect"
  };
  simcity.SocketManager = {};
  simcity.cSocketManager = function () {
    this.mSocketListeners = [];
    this.mSocketRequests = [];

update: It could be leftovers, but this indicates that this is code from a prerelease/debug build.

    simcity.SetUpDemoScreen = function () {
      simcity.persistentLayout = gUIManager.LoadLayout("Layouts/PersistentPreAlpha.js", gUIManager.GetRootWindow());
      simcity.SetTextOnElement(simcity.DemoExitButtonTxt, new scrui.cLocaleString("Tutorials.json", "0x0eaf7bc9", "EXIT"));
      simcity.SetTextOnElement(simcity.DemoAvailableReleaseDateTxt, new scrui.cLocaleString("Tutorials.json", "0x0eaf7bb2", "AVAILABLE FEBRUARY 2013"));
      simcity.SetTextOnElement(simcity.DemoThanksForPlayingTxt, new scrui.cLocaleString("Tutorials.json", "0x0eaf7b4b",
      "THANKS for PLAYING"));
      simcity.SetTextOnElement(simcity.DemoPreOrderTxt, new scrui.cLocaleString("Tutorials.json", "0x0eaf7bb1", "PRE-ORDER AT SIMCITY.COM"));
      simcity.SetTextOnElement(simcity.DemoNotFinalSoftwareTxt, new scrui.cLocaleString("Tutorials.json", "0x0eaf7b3c", "Not Final Software"))
    };

Re: SimCity UI Code + DRM

#10
post #8

Misleading title. This is obviously a formatted version of minified JS, presumably extracted from the shipping game, not a leak.

obviously? care to share for those of us who don't read JS fluently?
Post reply on HN