A beginner with modding/code

Started by Falken, August 22, 2014, 01:40:01 PM

Previous topic - Next topic

Falken

I've never modded any games before and I'm eager to learn coding mods for Rimworld. The problem is that my overall programming skills is very basic and I'm having a tough start to beginn learning to code. I've read Haplo's tutorial on how to make DLL's, but it gives only information about how to make a file rather then to code. The other tutorials are mostly about XML. I need tip from you where I need to start. It seems like everyone was born with the information which methods to use in their own code from the unity/rimworld packages and what to extend classes with.

Is there a way I can get information about where and which methods I can use?

Also where should I start learning about making a mod in rimworld?
-Learn more about Unity?
-Make a mod in another game that use c#?
-Do c# tutorials and eventually I will learn?

mrofa

If you want dll read Halpos darkmatter generation tourtial, you got the basic of getting VS and setting it up, it also got the darkmatter.cs file in there to open with VS, to show you code examples.
As for XML well... due game often changes, that often change xml namings here and there its a bit like a detective work :D
You mostly just download a mod that have smilar thing to what you want to do and check thier xml.
All i do is clutter all around.

Falken

I've read the code and I understand it. What I dont understand with the code is how he knows where to get the methods like "SpawnSetup(){}" and CompPowerTrader object. I bet it's not built in with c#.

Again, the tutorial only explains how to make a DLL file. I want to make more then just darkmatter generators.

Haplo

What you want is a look into the Assembly-CSharp.dll :)
That is the place where you can find all the functions, that RimWorld uses. You need a Decompiler to take a look inside.
Most people use ILSpy or my personal favorite Telerik JustDecompile.
But what you use is your decision, you just need one decompiler to take a look into all of the functions in there ;)

RawCode

1) You don't need to know Unity as long as not going to write custom rendering or custom GUI or play with sound.
RimWorld uses unity for rendering and sound only, everything else is pure c#.

2) Since you not coded before it will be impossible for you to learn from decompiled source code directly, you will waste your time.
My suggestion is to download every single mod posted (only few have no source embedded) and research source code of that mods.
After dark matter generator you should code dark matter battery, dark matter food dispencer and so on.
After you mastered basics - go to source code.

3) There is no need in tutorials dedicated directly to RimWorld, open any tutorial about c# on web and read it.

4) SpawnSetup(){} is build in c#.
you can understand how code flow by simply invoking code like "log.error(enviroment.stacktrace)" inside method you do not understand.
Stacktrace will give you source of invocation and allow you to trace how it works without debugger.

but this only after you tapped into basics.

Haplo

Ah, thanks. Didn't know about the stacktrace.

ToDo:
Learn something new today -> checked  ;D

Iwillbenicetou

I need help. I know basic xml, and I've been trying to learn. Can anyone help me?
Mod Help! The basics on how to download mods!

RawCode

post thread and ask your questions.

"private" lessons are bad for community since contribute nothing to public knowledge pool

noone

Just to add my bit to the story, my RimWorld C# knowledge expanded massively once I realized that I could use 'auto-completion' of commands in MonoDevelop to show me all the possible variables and functions associated with a class.

That's how I managed to turn Haplo's Dark Matter code into a conveyor belt mod - which frankly has not much in common with it anymore ;)

As other have pointed out, looking at other source code gives you ideas about possible classes/functions, and I then try to make my way from there ...