Forum Announcement, Click Here to Read More From EA_Cade.

@SIMGURUMODSQUAD : Converting pyo files to py

2...Next

Comments

  • redpriestredpriest Posts: 15 New Member
    edited August 2014
    .pyo files skip the interpreter's translation step.
  • jtravers88jtravers88 Posts: 591 Member
    edited September 2014
    We have a modified version of unpyc3 that is decompiling most of the pyo files in the simulation.zip file. Not sure how accurate they are. But it displays most if not all of the script. So now we can wait for the documentation on how they would like us to do it. Hopefully it means that we can use their methods on more data than just what they would like us to be able to play with. And since I have no plans to try to replace a game pyo file, complete accuracy might not be necessary... At least not initially. :)
  • MyreMylarMyreMylar Posts: 80 Member
    Good news!

    I saw there was even some talk in the other thread of being able to 'hot load' some scripts while the game was running which sounds promising for tweaking and debugging scripting. Can @SimGuruModSquad confirm whether any of that is at all possible? Do scripting modders need to take down and reload the game each time we we change a script or is there some clever way to force a script reload ingame?
  • MaclimesMaclimes Posts: 513 Member
    As a programmer myself, I love seeing that I'm not the only one who subconsciously lowballs expectations.

    Boss: "Can you do X?"
    Me: "No, that's physically impossible."
    Boss: "I'll ask again in an hour."
    Me: "But it's literally impossible. Can't be done. The very laws of computers, programming, and even physics disallow it. We'll have to do something else."
    Boss: "Un-hunh".

    *one hour later*

    Boss: "Can you do X?"
    Me: "I thought about it, and figured out a way to do it. I'll have it done today."
    Boss: "You do this every plumming time."
  • SpiceweaselSpiceweasel Posts: 11 New Member
    > @Maclimes said:
    > As a programmer myself, I love seeing that I'm not the only one who subconsciously lowballs expectations.
    >
    > Boss: "Can you do X?"
    > Me: "No, that's physically impossible."
    > Boss: "I'll ask again in an hour."
    > Me: "But it's literally impossible. Can't be done. The very laws of computers, programming, and even physics disallow it. We'll have to do something else."
    > Boss: "Un-hunh".
    >
    > *one hour later*
    >
    > Boss: "Can you do X?"
    > Me: "I thought about it, and figured out a way to do it. I'll have it done today."
    > Boss: "You do this every plumming time."

    I appreciate the story - the Scotty approach. :) But truthfully, I consider giving accurate estimates an important skill as a developer. It takes experience, but too many people just shrug it off, saying "I suck at estimates" without ever trying.
  • MaclimesMaclimes Posts: 513 Member
    But truthfully, I consider giving accurate estimates an important skill as a developer. It takes experience, but too many people just shrug it off, saying "I suck at estimates" without ever trying.

    Fair point! It's something I'm working on. ;)

  • granthesgranthes Posts: 93 Member
    Maclimes wrote: »
    But truthfully, I consider giving accurate estimates an important skill as a developer. It takes experience, but too many people just shrug it off, saying "I suck at estimates" without ever trying.

    Fair point! It's something I'm working on. ;)
    In many shops, giving an overly low estimate or an overly high estimate can really slow down the process :smile:

    In our shop, we have one guy who always answers "30 to 60 days" for a new feature, no matter how trivial. We have another that says "Give me an afternoon and I'll have it ready." Neither of them get asked for estimates much anymore.
    Grant (granthes)
    Developer of Sims 4 Modding Tools -- Sims 4 Stuff n Things
  • TheHologramTheHologram Posts: 4 New Member
    edited September 2014
    Update my script posted in the ModTheSims thread probably for last time as game is close to release. I've been able to use it fairly well with a properly configured Intellij for browsing the source. I suspect that is enough for most modders to get by for a while. Surprisingly only had to create about a dozen stubs that are probably the C++ classes in the engine to load the code in python which means that they skewed toward a lot of the source in python files rather than just exposing wrappers which is likely good for modders.

    Regarding time estimates, I only expect someone to give a reasonably accurate estimate if its an activity they have done before. Too often I'm asked to estimate something like "How long will it take to create a dashboard for tracking convoluted company metric x?" but without any of the useful stuff like what visualization tool do you want it in and where is the data and what is x anyway?

    Edit: Doesn't seem like the most popular thread but some findings on the hot reloader (maybe this should be its own thread). Looks like it will not be enabled by default event if __debug__ is True as we are loading from zip files which sets SCRIPT_ROOT to None where that variable controls the root folder for reloading. I suspect some monkey patchable may be sufficient to troubleshoot stuff in the future but not out of the box. Some interesting files for those that are interested: core.zip\paths.py, core.zip\sims4\core_services.py, core.zip\sims4\core_services.py. Looks like user script mods will load from either zip or as loose py files though only the later are reloadable.

    I actually cannot determine how user scripts are loaded at the moment as it looks like it uses USER_SCRIPT_ROOTS which currently is pointed squarely at core.zip. Some other zip files that are of interest are the tests.zip, debug.zip, lib.zip, build.zip which might be usable to bootstrap loading custom scripts since they do not exist in the deployed game. Hopefully I'm just overlooking something obvious but looks like they expect either all source files or all zip files and not a mixture. That might be reasonable for the developers but my not be so good for us. I'm sure that they will help out when we starting hitting these blocks.
    Post edited by TheHologram on
  • gibbedgibbed Posts: 3 New Member
    edited September 2014
    User scripts go into Documents\Electronic Arts\The Sims 4\Mods\Scripts as zip files. No clue to structure.
  • SimGuruModSquadSimGuruModSquad Posts: 597 Member
    MyreMylar wrote: »
    I saw there was even some talk in the other thread of being able to 'hot load' some scripts while the game was running which sounds promising for tweaking and debugging scripting. Can @SimGuruModSquad confirm whether any of that is at all possible? Do scripting modders need to take down and reload the game each time we we change a script or is there some clever way to force a script reload ingame?

    Hey there! Here's the deal on hotloading:

    By default modders will need to restart the game to see their script changes update in game, BUT hot loading is a feature that is supported by the engine so it is possible you may be able to get it working. Off the top of my head I actually do not know how difficult it would be for you guys to add hotloading back in.

    I am open to having this added as a shipping feature if you guys need it - it will need some work, but it's not impossible. Looking for feedback from you guys on how important this is for you.

    A bit more detail: For us, most workflows work fine with hotloading - but when reloading happens it does not recreate already instantiated python objects, it just updates the code. So if the existing object somehow become incompatible with the new code, you will experience a lot of exceptions :) . As I say, in practice this is fine most of the time for the types of things we iterate on, but for certain changes it will not. Also, hotloading only works on loose python files (not zips) - as @TheHologram noted above. Loose .py files are supported out of the "Mods" folder.

  • pboxpbox Posts: 630 Member
    I am open to having this added as a shipping feature if you guys need it - it will need some work, but it's not impossible. Looking for feedback from you guys on how important this is for you.

    Well I’m only watching from the sidelines – but even so it seems pretty obvious to me that anything that would make it easier to mod the game would be a big win. So, yay!
    Stuff for TS2 · TS3 · TS4
  • IngeJonesIngeJones Posts: 3,247 Member
    edited September 2014
    but when reloading happens it does not recreate already instantiated python objects, it just updates the code. So if the existing object somehow become incompatible with the new code, you will experience a lot of exceptions :)



    That's not much different from not hotloading - and it was worse with the open world as you didn't really ever know whether one of the affected objects might have been in existence on another lot. Anyway, yeah if you reloaded the game with a code change you could still get exceptions. as the sims tried to continue to do something to your object that was no longer the right thing :D
  • MyreMylarMyreMylar Posts: 80 Member
    It's a little difficult to say for certain exactly how useful it would be before digging into scripting seriously (still awaiting my copy here in the UK :D), but from general experience with game programming, I'd say that if ingame script reloading could be added as a console command or something similar, then it would see a lot of use.

    I'm imagining, reloading the scripts, tweaking a few values, reloading again... and so on in a loop to get some effect exactly right. In the past I've used this kind of technique a lot for things that are very visual e.g. lighting. If that sort of tweaking is commonplace with customising stuff then the time savings versus rebooting the entire game quickly add up. Right now the kind of scripting/data mods I was pondering adding vary from probably well supported things; like adding new careers to more esoteric things like adding superpowers!

    So, I would welcome such a feature - but without spending more time looking at the scripts, or knowing how much time investment it is on the Maxis end to add I can't guess at how 'worth doing' it is yet.
  • TheHologramTheHologram Posts: 4 New Member
    I agree that it is hard not to imagine this being useful to someone if not us. But I would really like it. I think that having it enabled via a config file that is slightly obscure maybe with a comment about the risk should help mitigate it as well as an obscure console command. Obviously, its not going to work correctly all of the time and is not expected to but anything that cuts down testing cycle times is a win for the modders. Looks like it might also hot reload resources as well so the two together would be great even if it causes the occasional crash or error.
  • tycox94tycox94 Posts: 12 New Member
    > @SimGuruModSquad said:
    > MyreMylar wrote: »
    >
    > I saw there was even some talk in the other thread of being able to 'hot load' some scripts while the game was running which sounds promising for tweaking and debugging scripting. Can SimGuruModSquad confirm whether any of that is at all possible? Do scripting modders need to take down and reload the game each time we we change a script or is there some clever way to force a script reload ingame?
    >
    >
    >
    >
    > Hey there! Here's the deal on hotloading:
    >
    > By default modders will need to restart the game to see their script changes update in game, BUT hot loading is a feature that is supported by the engine so it is possible you may be able to get it working. Off the top of my head I actually do not know how difficult it would be for you guys to add hotloading back in.
    >
    > I am open to having this added as a shipping feature if you guys need it - it will need some work, but it's not impossible. Looking for feedback from you guys on how important this is for you.
    >
    > A bit more detail: For us, most workflows work fine with hotloading - but when reloading happens it does not recreate already instantiated python objects, it just updates the code. So if the existing object somehow become incompatible with the new code, you will experience a lot of exceptions . As I say, in practice this is fine most of the time for the types of things we iterate on, but for certain changes it will not. Also, hotloading only works on loose python files (not zips) - as TheHologram noted above. Loose .py files are supported out of the "Mods" folder.

    After I heard about the possibility of hotloading scripts into the game I decided I'd put my efforts in and help build a better simulation. Please assist in the community to make sure this happens.
Sign In or Register to comment.
Return to top