What hinders YOU to start with modding?

i think the main reason for most people (including me) is that they play games, but have never modded a thing in their lives, and don’t know how it works (and it isn’t that easy to learn)

@shawnkeijsers… and that’s why we are all around to find out together :wink:.

So for those of you who say it isnt easy to learn, can I ask this:

  1. Do you know what a file, and folder are? (seriously trying to establish the benchmark here)
  2. Do you know about basic file extensions?
  3. Can you edit a text file?
  4. Do you know what words like syntax and array mean?
  5. Do you know about hexidecimal RGB ect at all?

Please answer if you can so we know where to start with these tutorials and guides.

  1. yes
  2. no
  3. yes
  4. no
  5. no
    so there is a lot of work to do i think :stuck_out_tongue:

While trying to help a few people fix errors in their mods I’ve sometimes come across difficulty trying to sift though their folders and file paths. To those who are making mod tutorials I have a suggestion: Try to use the same file structure as the stonehearth.smod.

I can tell you from experience it is a lot easier to make a more complex mod if the folder and paths are extremely similar to the stonehearth.smod. You don’t have to learn two different pathing styles while adding in new items.

It’s a lot eaiser to remember where the stonehearth chair files and for example my bamboo chair files. If they have diffrent paths such as this:

stonehearth/entities/furniture/simple_chair | nihonjin/models/chairs/bamboo_chair

They are a lot harder to read and remember than something similar like this

stonehearth/entities/furniture/simple_chair  | nihonjin/entities/furniture/bamboo_chair

I’ve spent countless hours trying to find pathing errors before I painfully upgraded my file format to emulate stonehearth.smod. Now debugging for me, and others trying to help me is a lot easier. Just wanted to throw in my two cents and I hope it helps. :moneybag: :smiley:

6 Likes

Quick primer time then…


File extensions are things like “.doc” or “.txt” in Windows. Basically tells the machine “I am an X, treat me like you would any other X”. For example, if you have a picture and change it from .jpg to .doc, MS Word will try to open it. It won’t look pretty. A lot of programs depend upon proper file extensions to work properly. You can show or hide file extensions via Windows’ Folder Options control panel, which will in turn let you change them simply by renaming the file.

Oh… folders don’t have file extensions, because they’re not files.


“Syntax” is basically “grammar”. An array is an ordered arrangement of things (usually refers to rows & columns of things, used a lot in maths). Most computer code has very strict rules for its syntax (ie grammar), and arrays help you arrange things in your code.

For example, I’m reading a book on the Napoleonic Wars at the moment. In it, it describes Napoleon’s attacks as “manoeuvre sur les derrieres”, followed by a translation - “manoeuvre in the rear”. Being human, I have the capacity to read further on to find its meaning, or even check the appendix or go online. This will rarely work for computers: they prefer to know things in advance. For example:

Alice: And so I was right in front when Barack Obama walked past.
Bob: Who?
Alice: The US President.
Bob: Really? Wow!

vs

Alice: And so I was right in front when Barack Obama walked past.
Computer: Error! You did not specify the variable “Barack Obama” before talking about it! Crash report #552 generated.

So… yeah. Basically you need to remember that computers are really dumb like that, and so you need to communicate with them using a very precise grammar. The rules of that grammar vary from programming language to programming language (some are designed to be more forgiving than others, for example), but the same principle applies.


Finally, the RGB thing refers to Red-Green-Blue, the colour system used on most even vaguely modern computers. For example in MS Paint, 0,0,0 is black: no red, no green, no blue. 255,255,255 is white: max red, max green, max blue. 255,0,0 is pure red, with no green or blue. The total number of colours you can make this way is 16.8 million (256 x 256 x 256).

The hexadecimal bit is… basically a way of writing numbers that uses “base 16” instead of “base 10”. We humans normally use base 10 - ie you count from 1 to 10, then start over to get to 20, then start over to get to 30, etc. In base 16, you count from 1 to 16, then start over to get to 32, then start over to get to 48, etc.

Because we don’t have 16 single-digit numbers (computer programmers count from 0, so 0,1,2,3,4,5,6,7,8,9 = 10 numbers), for base 16 / hexadecimal work we cheat and add in letters - in this case, A, B, C, D, E, F.

Websites often use hexadecimal codes for colours. For example, FFFFFF = 255,255,255 - ie, white, to use our above example.

How does this work? Well for colours, we can break up the six-digit hexadecimal number into 3 parts: FF,FF,FF. How does this help us? Well, start with a number line:

0 1 2 3 4 5 6 7 8 9 A B C D E F

The “F” is sixteenth in the line. Now, 16 x 16 is… you guessed it, 256. Subtract 1 (because we count from zero remember!) and you get 255. So FF,FF,FF = (256-1),(256-1),(256-1) = 255,255,255 = white.

Course, there are plenty of calculators out there to convert FFFFFF into 255,255,255 instantly for you, but that won’t teach you how to it works :wink: .


Well. That was a bit longer than I intended, and most certainly @RepeatPan and others will have cause to grumble at some of the things I wrote. Oh well: the main thing is that you grasp the fundamentals :slight_smile: .

6 Likes

thnx now i understand what everything means :stuck_out_tongue: this also makes it a lot easier to follow a toturial and stuff :stuck_out_tongue:

Great post! However, the rgb conversion part confused me out some so I just want to show how I’d do it.[quote=“Teleros, post:66, topic:5198”]
The “F” is sixteenth in the line. Now, 16 x 16 is… you guessed it, 256. Subtract 1 (because we count from zero remember!) and you get 255. So FF,FF,FF = (256-1),(256-1),(256-1) = 255,255,255 = white.
[/quote]
I’ll use a shade of purple for this: A2,3B,EC
A is after 9 so it’s worth 10.
10 * 16 + 2 = 162
B is after A so it’s worth 11
3 * 16 + 11 = 59
E is worth 14 and C is 12
14 * 16 + 12 = 236
So the RGB value is 162,59,236

What I do is I call the first symbol in the pair X (A,3 and E) which is multiply with 16
Then I add the second symbol which I call Y (2, B and C) and then I get the R,G or B Value.
So this is the expression for converting I use

( x * 16 ) + y

EDIT: I just wanted to write the value of them all down here
0=0, 1=1 … 9=9, A=10, B=11, C=12, D=13, E=14, F=15

Or if you’re lazy like me
http://www.javascripter.net/faq/rgbtohex.htm
http://www.rgbtohex.net/

2 Likes

[quote=“deakon, post:69, topic:5198, full:true”]Or if you’re lazy like me
http://www.javascripter.net/faq/rgbtohex.htm
http://www.rgbtohex.net/[/quote]
Oh absolutely - manually converting stuff like this isn’t something you should be doing on a regular basis. What’s important is that:

  1. You can.
  2. You understand the principles behind it.

Another example is binary. It can be handy to know how it works, because it’s the basis of literally everything going on in your computer*, but you’re unlikely to screw up your Stonehearth mod because you don’t know it :wink: .


Basically, binary uses just 2 numbers, 0 and 1, to write any possible number (ie, it’s base 2 mathematics, just like hexadecimal numbers are base 16, and we humans use base 10). Meanwhile, your computer sends electricity through various transistors in its CPU, and there are only 2 possible states: the electricity is either flowing or not flowing… which of course you can represent with just 2 numbers - 0 and 1 again. And finally, the most basic kind of logic gate is a simple “yes or no” model - which again, you can represent with 0 and 1.

So, when you’re playing Crysis 3 and gawping at the ultra-high-def graphics and hyper-realistic AI (or not, I’ve not played it :stuck_out_tongue: ), all of the stuff you see on your screen, hear from your speakers, and that the PC is doing behind the scenes comes down to whether a lot of electrical switches are on or off at any one moment.

Pretty damn cool if you ask me :slight_smile: .

1 Like

It is indeed if you thing about it. And the computer is not even really calculating anything, which is what people usually say they do. The current just travels where it can, and crysis 3 rolls out.

Great guide btw. :thumbsup:

2 Likes

Abstraction

8 Likes

To be honest, it’s the lack of time and my scarce imagination.

Btw, hi again everyone! I’ve been out for a long time. I’m back and trying to catch up.

1 Like

and for a fun facts is binary can be changed to hex ex.101=5 or 100=4
1111=8+4+2+1=15=F
and the max is 111111=63=3F
so to find out its just 2^x=dec=hex
so 10001 is 2^4+2^0=16+1=17=11
to find those out you can use Binary/Decimal/Hexadecimal Converter

Noting Hinders you to start. you are welcome and backed up .

My biggest obstacle right now is I don’t understand how to code. At all. I don’t even know what in the world is going on when people talk about code (like I know a boolean is something that’s important but I don’t know what it is or what it does even though I’ve been told.) I do however know a lot about art, and so there are a lot of ideas floating around in my head that I would want to put into the game, like horses and stables and dragon dungeons. And I know that I could make them look good and like they belong in the game. I just have no on earthly idea how I would successfully get them into the game.

Edit: There are lots of games I’ve wanted to mod but didn’t because I didn’t know how. Stonehearth gives me hope because it’s designed to be so modder friendly. So maybe one day :smile:

[quote=“daisyj201, post:76, topic:5198”]
My biggest obstacle right now is I don’t understand how to code.[/quote]
The question is, what do you want to change in the game? For many changes, you don’t need to know much about coding. Most work so far is making voxel-models. So if you don’t want to change the game completely, 99% of the time is about “art” :stuck_out_tongue:
And here are a lot of friendly modders, so all your code-problems should get solved… ^^

Well that makes me feel a lot better :smiley: I have a couple of ideas, but I don’t want to start modelling stuff yet in case some of it winds up in the base game. I mean I suppose if that happens, what I come up with could be better than what’s in base game, but I seriously doubt it, haha

Ask (or google) away. For example, when people use “0 = false or no, and 1 = true or yes”, that’s Boolean logic. For example…

cancraft=0

and…

cancraft=false

…will result in the same thing: whatever it is cannot be crafted.

Don’t be afraid to team up with someone good at the coding etc :wink: .

I started with Red Alert 2, which is possibly one of the easiest ones out there. Getting it to run on modern systems may be a bit iffy, but anyway… let’s look at some Stonehearth code. We’ll look at something easy - the basic wooden sword…

{
   "mixins": "stonehearth:mixins:item_properties",
   "type": "entity",
   "components": {
       "model_variants": {
         "default" : {
            "models": [
               "file(wooden_sword_equipped.qb)"
            ]
         }
      },
      "stonehearth:entity_forms" : {
         "iconic_form" : "file(wooden_sword_iconic.json)"
      },
      "stonehearth:equipment_piece" : {
         "slot" : "mainHand",
         "render_type" : "attach_to_bone",
         "postures" : [ "stonehearth:combat", "stonehearth:patrol" ]
      },
      "unit_info": {
         "name": "Wooden Sword",
         "description": "Thacks thine enemies with oaken might",
         "icon" : "file(wooden_sword.png)"
      },
      "stonehearth:material" : {
         "tags" : "wood melee_weapon"
      }
   },
   "entity_data" : {
      "stonehearth:combat:weapon_data" : {
         "base_damage" : 10,
         "reach" : 1.5
      },
      "stonehearth:combat:melee_attacks" : [
         {
            "name" : "combat_1h_backhand",
            "active_frame" : 17,
            "cooldown" : 0,
            "priority" : 0
         },
         {
            "name" : "combat_1h_forehand",
            "active_frame" : 16,
            "cooldown" : 0,
            "priority" : 0
         }      
      ],
      "stonehearth:combat:melee_defenses" : [
         {
            "name" : "combat_1h_parry",
            "active_frame" : 4,
            "cooldown" : 8000,
            "priority" : 0
         }
      ]
   }
}

Okay, so first we start defining it - hence the mixins bit, and the type bit. By referring to the item_properties.json file we are telling the game “hey, please load all the default item properties first” - we can override this later in this file, but for now it’s quicker to refer to this than copy/paste it for every single item (!).

Oh, note all those brackets. They’re used to divide the code up for the game into easily-digested chunks, a bit like paragraphs and such for text we read. (For example, the game will read this sentence until it gets to the end bracket, and view it all as one sentence (nested sentences like this have their own end bracket), so the lack of an end bracket means it’ll just keep on reading… humans of course just say "oh hey, Teleros forgot the end bracket, but computers aren’t that smart :wink: .

A similar thing often applies to commas, semi-colons, the spaces/tabs before each line of code, and quotation marks - coding languages have their own grammar and syntax just like real languages, and it’s just a case of learning the rules. “Within brackets, all lines but the last have a comma at the end” seems to be one rule from reading the above code.

Now, as for the rest of the code, most of it is common sense. For example, “slot” is very simple if you ever play any roleplaying games - you have a head (helmet) slot, a chest slot, etc. In this case, it slots into the mainHand one. How is it rendered (drawn) in-game? Attached to the bone - ie, the sword model is glued in place (well, firmly gripped :stuck_out_tongue: ).

What else do we have? Well most of it’s quite obvious - I’m personally not quite sure how the “active_frame” lines in the attack section works, but hey, that’s why we experiment (or ask :wink: ). The “cooldown” line must be in milliseconds (units can parry more rapidly than once every 8000 seconds/minutes/whatever, so once per 8 seconds seems likely). The unit_info section describes how it appears in the crafting system (name, description, icon to display etc).


The best thing I can recommend is to look at existing code for Stonehearth (see elsewhere for how to view it) and apply common sense and logic - you’ll soon work out what 80 to 90 percent of it means. The rest can be figured out with experimentation, Google, or simply asking people. For example, I wrote a bunch on hexadecimal code etc above:

And you can (in fact, you should) use the search function to find out how to access the default Stonehearth code (yourself - get in the habit of doing the work yourself :smiley: !).

Hope this all helps :slight_smile: .

3 Likes

[quote=“daisyj201, post:79, topic:5198”]
I have a couple of ideas, but I don’t want to start modelling stuff yet in case some of it winds up in the base game.[/quote]
If so start with something, that won’t come into the game. Or just do it no matter what. You will gain experience, which will help you reach your future goals. So if you think about modding stonehearth, don’t think so much about the problems. Just download/buy a version of Qubicle Constructor and try to make some simple models.

If it makes fun, go ahead. The rest is no problem, there are enough people like @Teleros :smiley:

3 Likes