More jobs for Orcs and Amberstone

#21

Alright :merry:

I’ve worked on it a little and got it to a working state! It works perfectly with or without ACE :jubilant:
bunny_jobs.zip (43.2 KB)

Here is a picture without ACE, as you can see on the Entity debug, there is no “head” item, only the outfit:

And here is it with ACE. When your mod detects ACE now, it will use separate body & hat models and fit the standards of ACE:

By the way, the reason we did that is basically good practice. By splitting outfits, we allow other mods to create things like custom hats without ever glitching a hat anymore!

Now, the mod itself could serve as an example for you - but if that’s ok I’ll also try to make a short write-up about the things I did/changed/added to achieve the results. Hopefully this can help you and others :merry:

The models

The first thing I did was check the models themselves because that last picture you posted (with all the parts floating around) is usually caused by model issues when the matrixes/boxes are not properly positioned for the rigs (and animations).

Indeed I found a couple of issues with the models - so here’s a couple of tips! I don’t know what software you use, but I know that although different, it is possible to obtain the desired results in all of them!

Model Position

The first issue is the position of the models. When modelling voxels for SH, not only you have to preserve the matrixes (boxes) and their names but you also have to preserve their position on the global coordinates of the model. As you can see here, your models were slightly offset and that completely breaks the animations and rigs. One tip to properly position them is to copy your model, load up a model that works from the base game (for example, a base game outfit) and then paste your model. You’ll notice the difference - position your model in the correct way, copy it again, delete, then delete the original model and paste yours again – it will be pasted in the exact same spot :merry:

Model Optimization

Another thing I noticed is that some of the models had really huge matrixes/empty boxes. This is useful for when we are working, but when we are done and we export to .qb, it is important to optimize the models so we don’t have huge models. This is a common mistake (I’ve done that several times :jubilant:) but it’s always good to try to improve it! Some software have an “Optimize” button that will shrink matrixes for you, so just use it before exporting!

Matrix naming

And finally, as I’ve mentioned before, keeping the correct names for the matrixes is very important! The Blacksmith hat was not working until I noticed it had a wrong matrix name. Matrixes that do not match their rig names will not show up properly and are likely to cause you headache, so remember to always be careful with them :merry:
Particularly when we do things like “splitting” or “union” during work, these will rename our matrixes and we have to rename them back.

Mod Structure

The next thing I polished/cleaned a little was the mod structure. I’ve noticed that you made the same “mistake” that I did when I started (some of my mods like Glassworks and Trapper+ still carry this issue, by the way). Luckily I had nice people like Bruno to show me better/cleaner ways of doing things! Anyway, the mistake is: putting everything you’re mixing into something else in a “mixins” folder. This gets confusing for people that will open/work with your mod, etc. It’s not wrong, but it’s considered nicer to have the structure be cleaner and “mirror” the game’s own structure. So I’ve moved things around, placed all the files on their respective folders, etc. Some of them are a bit annoying (like the campaign mixins) because they’re all far away from each other now… But others like the job outfit mixins are much better positioned like this. It’s just a nicer policy to have :merry: it makes “reading” your mod much better and in a way the cool thing about modding is being able to tinker/look into other people’s mods so you can learn :merry:

File changes

And finally, to make it all work, I had to change several files. Placing the outfit .jsons alongside their models allows you to link them like this again:

{
   "components": {
      "model_variants": {
         "rabbit_male": {
            "layer": "clothing",
            "models": [
               "file(farmer_outfit_rabbit.qb)"
            ]
         },
         "rabbit_female": {
            "layer": "clothing",
            "models": [
               "file(farmer_outfit_rabbit.qb)"
            ]
         }
     }
   }
}

And I’ve also created mixins for the hats (I’ll explain how it works)

{
   "components": {
      "model_variants": {
         "rabbit_male": {
            "layer": "clothing",
            "models": [
               "file(farmer_outfit_hat_rabbit.qb)"
            ]
         },
         "rabbit_female": {
            "layer": "clothing",
            "models": [
               "file(farmer_outfit_hat_rabbit.qb)"
            ]
         }
     }
   }
}

Alright, the hats!
Like I said, breaking all the outfits into two parts: body and hat, is important and also a good policy because it gives the game greater flexibility. People can now create custom hats and such and they’ll never glitch again like it happened before when you tried to create hats for archers, etc.

So, I basically made your mod to work in the following way: if there is ACE it will break into body and hat; if there is no ACE, it will keep the game’s default standard.

This is done through some manifest magic!
For the models, all outfits now have 3 models:
1- The complete outfit
2- The outfit without the hat (it has an _ace at the end of the name)
3- Only the hat, inside a subfolder (like in ACE)

And this is done in the manifest:

Under Mixintos (just the farmer, as an example)

	"stonehearth_ace/jobs/farmer/farmer_outfit/farmer_outfit_hat/farmer_outfit_hat.json": "file(jobs/farmer/farmer_outfit/farmer_outfit_hat/farmer_outfit_hat.json)",
	"stonehearth_ace/jobs/farmer/rc_farmer_outfit/rc_farmer_outfit_hat/rc_farmer_outfit_hat.json": "file(jobs/farmer/farmer_outfit/farmer_outfit_hat/farmer_outfit_hat.json)",
	"stonehearth_ace/jobs/farmer/na_farmer_outfit/na_farmer_outfit_hat/na_farmer_outfit_hat.json": "file(jobs/farmer/farmer_outfit/farmer_outfit_hat/farmer_outfit_hat.json)"

And then under Overrides

"overrides": {
		"stonehearth_ace/jobs/farmer/farmer_outfit/farmer_outfit_rabbit.qb": "file(jobs/farmer/farmer_outfit/farmer_outfit_rabbit_ace.qb)",
		"stonehearth_ace/jobs/blacksmith/blacksmith_outfit/blacksmith_outfit_orc_male.qb": "file(jobs/blacksmith/blacksmith_outfit/blacksmith_outfit_orc_male_ace.qb)",
		"stonehearth_ace/jobs/trapper/trapper_outfit/trapper_outfit_orc_female.qb": "file(jobs/trapper/trapper_outfit/trapper_outfit_orc_female_ace.qb)",
		"stonehearth_ace/jobs/trapper/trapper_outfit/trapper_outfit_orc_male.qb": "file(jobs/trapper/trapper_outfit/trapper_outfit_orc_male_ace.qb)",
		
		"bunny_jobs/jobs/farmer/farmer_outfit/farmer_outfit_rabbit.qb": "/stonehearth_ace/jobs/farmer/farmer_outfit/farmer_outfit_rabbit.qb",
		"bunny_jobs/jobs/blacksmith/blacksmith_outfit/blacksmith_outfit_orc_male.qb": "/stonehearth_ace/jobs/blacksmith/blacksmith_outfit/blacksmith_outfit_orc_male.qb",
		"bunny_jobs/jobs/trapper/trapper_outfit/trapper_outfit_orc_female.qb": "/stonehearth_ace/jobs/trapper/trapper_outfit/trapper_outfit_orc_female.qb",
		"bunny_jobs/jobs/trapper/trapper_outfit/trapper_outfit_orc_male.qb": "/stonehearth_ace/jobs/trapper/trapper_outfit/trapper_outfit_orc_male.qb"
	}

Alright, what is happening there is:
The mixinto just mixes the hat JSON into the ACE hat JSON. If ACE is not present, nothing happens and it doesn’t change anything. If ACE is present, your hats are mixed so ACE outfits now have the respective bunny/orc hats.

( About it needing 3 mixins, one for each faction – this is my fault. :forlorn: I should’ve made the ACE hats “mixins” just like the bodies are. I’ll fix that for the next release and then you’ll be able to use only one mixinto for each hat )

Then what happens next - in the overrides - is a “magic trick”. The trick is: you try to override a file that doesn’t exist. When you do that, what the game actually does is create that file. So you are basically injecting your models inside ACE.

The reason you do that is because what you do next is the opposite, you replace your own models with the ones you just injected. Why? Because the ones you just injected - with the _ace on their names - are the models without the hats. The magic bit here is that if ACE is not present, the “injection” doesn’t work, so overriding inside another mod and then pulling it back is how you make sure something is only changed if the other mod is present. So basically, if ACE is present, you inject the models without hats inside of ACE and then pulls them back, overriding your own models with hats.

I hope this is clear enough and with it (plus the mod itself) you can learn, master the techniques and continue your awesome mod!
Your models are really, really good! :jubilant: :sparkles:
I look forward to subscribing and using your mod in my game :heart:

Feel free to post any doubts or issues you run into!

EDIT
A couple of things I just came up with that could make it even more optimized!
Feel free to try to implement them - for practice :merry:

1 - If the manifest mixintos seem to big, you can mix into the URIs instead. That is, instead of mixing into the JSON itself, try mixing into stonehearth:blacksmith:outfit for example! It works :merry:

2 - You can actually reduce the number of models to 2 instead of 3. Instead of having a model without a hat, a complete one and just the hat, you can have two models be used in the outfit mixins (the body and the hat) belonging to the same item.

This creates a new challenge, however - to make the ACE hats work, you’d have to inject a JSON to override your own mixintos instead of overriding the models. So maybe it would be too much hassle for little difference. Just pointing out that sometimes there are multiple ways to achieve the same results :merry:

5 Likes
#22

Thank you so much for this pointer. I’m going to add this trick into my ever-growing toolbox. Helpful modders like you are invaluable to the new blood modders like myself.

2 Likes
#23

Dani! You just gave me a free education. I’m going to re-read this post over and over and then dig through your edits for several hours until I can absorb every bit of knowledge.

You really went above and beyond to show me the ropes and I can’t thank you enough. If I could hit that heart button a hundred times it would show one 100th of my appreciation.

From the initial read through, I’m going to study closely how you worked in the ACE compatibility because I would love to make bunny/orc versions of relevant ACE equipment for this mod (trapper+ and glassworks too for that matter).

I want it to look natural for anyone; who should be everyone, that uses the ACE mod.

I owe you a debt of gratitude. If you need any kind of model work, I’m your guy.

4 Likes
#24

Hi Dani

I tried to use your instructions to add the female blacksmith outfit and this is what I got:

and here are my changes: bunny_jobs.smod (13.7 KB)

I can’t tell if it’s my model, the export settings, or the code. If you wouldn’t mind to take a peak, I would really appreciate it.

Thank you

1 Like
#25

It seems to be the model – whenever you see it “exploded” like this it is the model that is not correctly positioned.

What software are you using for voxel modelling? :smiley:

#26

I use Qubicle 3.0. It could be my export settings. I’ll try to export it differently or maybe try one of the free softwares.

#27

Good! I use Qubicle too :slight_smile: so I can help you!

When you click to export to .QB, there are only two things from the default you should change:
Change the “Left-Handed” to “Right-Handed” and untick compression.

Export settings should look like this:

image

Also, always make sure to not have a single matrix selected when you save, otherwise it will save only that matrix and you’ll lose the rest of the model!

#28

i seem to remember something about optimising the model can you show a screenshot of how the model looks in qubicle?

#29

I’d still bet my gold coins on the model position :smiley:

#30

It was the position. Your gold coins are safe.

I added the archer outfits and placed the updated file in the top post if anyone would like to playtest it.

3 Likes
#31

I added a couple more outfits for the bunnies. My next step is to modify the vanilla armors to fit the other races. Then after that I’ll be doing the same to the ACE armors and maybe a couple more mods.

4 Likes
#32

Awesome work! :merry:

Might I ask you (if possible) to also publish your mod in the Steam Workshop? :jubilant:
Unless you’re waiting for a more finished/complete version, in that case I’ll gladly wait!

If you want it there but can’t for any other reasons (ie: you don’t own the game on Steam) let me know and we can figure out a way :merry:

4 Likes
#33

Thank you Dani!

I was going to wait until I had all the models done, but I can publish it after I finish the vanilla models.

Thank you for the offer to help. You’ve already done tons.

2 Likes
#34

I started repositioning the vanilla armor helmets to fit the new races and noticed they were all similar so I figured it would be a wasted opportunity not to rework them to be more appropriate for the Amberstone and Red Kiln so I did a thing.

I don’t want to change any of the ACE helmets or any of the ones from other mods, just the vanilla ones.

I do need to make new armors to fit the bunny footman still.

3 Likes