site banner

Wellness Wednesday for July 5, 2023

The Wednesday Wellness threads are meant to encourage users to ask for and provide advice and motivation to improve their lives. It isn't intended as a 'containment thread' and any content which could go here could instead be posted in its own thread. You could post:

  • Requests for advice and / or encouragement. On basically any topic and for any scale of problem.

  • Updates to let us know how you are doing. This provides valuable feedback on past advice / encouragement and will hopefully make people feel a little more motivated to follow through. If you want to be reminded to post your update, see the post titled 'update reminders', below.

  • Advice. This can be in response to a request for advice or just something that you think could be generally useful for many people here.

  • Encouragement. Probably best directed at specific users, but if you feel like just encouraging people in general I don't think anyone is going to object. I don't think I really need to say this, but just to be clear; encouragement should have a generally positive tone and not shame people (if people feel that shame might be an effective tool for motivating people, please discuss this so we can form a group consensus on how to use it rather than just trying it).

1
Jump in the discussion.

No email address required.

Not a wellness question, but I don't want it to get lost in the old small scale question thread:

I've always been mildly interested in programming, but my formal training in it was only in the absolute basics of Javascript in school. We didn't even get to pointers in C, to give you an idea where I bottomed out.

However, my fondness for rat-adjacent spaces makes me probably one of the people who sorta somewhat understand programming concepts as much as possible without actually being able to code well.

I can mostly follow code or pseudocode, but I've noticed that programmers mostly leverage existing functions in libraries or APIs to massively abstract their work.

My issue is that I simply don't know most of the interesting functions that might be relevant if I have a specific concept in mind. I don't know whether there's an existing function I can call, let alone something I can import as a library, like math.js. I know that there's plenty unknown to me, and unknown unknowns I couldn't possibly estimate.

I can definitely ask GPT-4 about such things, but leaving it aside, how do I understand the options available to me as best as I can?

For example, when I look at a little of the code for the few ML models I've learned, it seems simple enough if you can abstract a lot of it. I simply don't know what to abstract.

How do I build this fundamental knowledge? I suspect it involves something I'd find mildly unpleasant like reading documentation, textbooks, or trawling through code on Github. But I'm asking just in case a more interesting alternative exists that I'm not aware of.

I'll pre-emptively tag @DaseindustriesLtd, because of course I will haha. But I know there are plenty of you programmers out there, don't be shy!

If it helps, I have the following concrete interests-

  1. Modding games. I'm aware reading documentation or code is mandatory here. I'm sure @ZorbaTHut would be mildly pleased to hear that I'd like to make small mods for Rimworld, especially if AI makes generating art assets easier.

  2. Small automation tasks on my PC. GPT is helpful here if I know what to ask.

  3. ML, just enough so I could apply it to medicine if I needed to. I'd like to think upskilling myself there might lead to more money if I can leverage my medical degree into a career involving it.

For modding games take a look at dnSpy. It lets you open any .net assembly (compiled c# dll) and decompiles it into surprisingly readable code*. Comments and variable names are missing but class structures, method and attribute names are present so it's easy enough to tell what's going on with some digging. You can modify and recompile the code into a new assembly dll file.

This effectively means you can mod most games that use the Unity engine. In all the games I looked, Game_Data/Managed/Assembly-CSharp.dll will contain the game entry point, but larger games may sprawl out into their own assemblies that are referenced by this file. dnSpy should open those automatically.

I used this method to patch the recent Derail Valley update where they introduced a new difficulty system. I picked the "realistic" setting in a new game but found the teleport feature was limited to about two metres ahead, versus the twenty or so metres it used to be before. This feature is meant for VR to avoid motion sickness but I just use it walk faster between the train and track switches. I eventually traced it to a hardcoded class initializer for all the difficulties and modified one attribute (it was easiest to look at the IL assembly and change one instruction). Saved the assembly and now I was happily teleporting from one end of the train to the other in a tenth of the number of hops as before.

This method won't work if you see references to il2cpp as that's an optimization where the original assembly was turned into c++ code and compiled into native machine code. This is much harder to reverse engineer and is effectively impossible to meaningfully decompile as entire class structures and functions can disappear and type information is lost during compilation.

  • Curiously you can even pick between c#, visual basic and f# (iirc), as all three compile into Intermediate Language and can be decompiled back seamlessly, making them interchangeable. You can't even tell what the original source language was.

You can't even tell what the original source language was.

Maybe not if it was VB code, but F# code is obvious when decompiled into C#.