Textures

spaar

Active Member
#2
You could try to extract the textures from the asset files, I managed to do that using a tool called disunity (if I remember the name correctly). However, I don't know how you would need to go about putting new assets in there so that they are loaded. I also don't know if you could publish something like that while adhering to the modding permissions we have been given.
The other option would be to write a mod that brings it's own textures, loads them from some folder and then replaces the old textures via code. That should probably be fine and I'm pretty sure it can be done and although I haven't replaced any texture yet, I have managed to load texture files, for a new block in a mod I'm developing.
 

spaar

Active Member
#6
Yeah, those might work as well, I just happen to have used WWW already. Also, "something that could read .png files to make that into pixels" sounds a lot like exactly what the WWW class does :)
 
#7
spaar said:
You could try to extract the textures from the asset files, I managed to do that using a tool called disunity (if I remember the name correctly). However, I don't know how you would need to go about putting new assets in there so that they are loaded. I also don't know if you could publish something like that while adhering to the modding permissions we have been given.
The other option would be to write a mod that brings it's own textures, loads them from some folder and then replaces the old textures via code. That should probably be fine and I'm pretty sure it can be done and although I haven't replaced any texture yet, I have managed to load texture files, for a new block in a mod I'm developing.
Thanks, disunity worked for looking at the available textures. All I want for now is to change the visuals of the starting cube and was hoping to simply swap the texture it uses with a new one. Unfortunately it uses the metal textures from sharedassets4 which are also used in most blocks whatsoever. I'll have to look where the assignment of the starting cube texture happens.

EDIT:
BTW, take a look at Besiege\Besiege_Data\output_log_txt. It clearly indicates loading of the assets (at least for me). So there must be an asset loader which performs this process. This usually happens at the start of the game/level and if new textures are introduced they should be declared in there so that it doesn't look like an ugly patch.
 

spaar

Active Member
#8
=Ø= said:
Thanks, disunity worked for looking at the available textures. All I want for now is to change the visuals of the starting cube and was hoping to simply swap the texture it uses with a new one. Unfortunately it uses the metal textures from sharedassets4 which are also used in most blocks whatsoever. I'll have to look where the assignment of the starting cube texture happens.
You'll hardly have any luck finding where this is assigned. Usually this sort of stuff is set in the Unity editor and I'm pretty sure you won't find where it's assigned in Assembly-Unityscript.dll which is what we would be allowed to distribute. I believe this information is stored in the level files and then loaded by the Unity player, either in native code (which means you'll have a really hard time finding anything) or in UnityEngine.dll. So, if you do set those textures in code, I doubt it's possible to make it not look like an ugly patch. But at least the ugly patch approach would allow doing this in a mod that can easily be loaded by a mod loader and doesn't require replacing Assembly-Unityscript ;)
 
#9
Texture assignments are stored in the level file. Some people have reverse engineered the file structure, look around on the internet if you want to mess with that.

Alternatively, just make a tiny mod with the new texture in an asset bundle. Then find the starting cube prefab whenever a level is loaded and swap it. Every later instance of it in the current level should get the new texture until the level is changed. Ideadlly the mod loader would provide the methods necessary for this.
 

spaar

Active Member
#10
Zeblote said:
Alternatively, just make a tiny mod with the new texture in an asset bundle. Then find the starting cube prefab whenever a level is loaded and swap it. Every later instance of it in the current level should get the new texture until the level is changed. Ideadlly the mod loader would provide the methods necessary for this.
That's pretty much what I though. Except using an asset bundle, to me it seems much simpler to provide some .png file and load it directly with the WWW class, isn't it ? Also, what methods exactly should the mod loader provide ? I'm always open to suggestions for things to add to mine.
 
#11
Well you can also use a .png file. It doesn't really make a difference.
I use asset bundles because I can include them as an embedded resource in the dll and then load any type of resource or object structure from memory, like the entire editor gui skin with images and fonts.
Now with unity personal everyone can download unity 5 and export these (pro only in unity 4). As soon as besiege is updated to unity 5 they will start working.


As for the methods, you should provide a way to notify mods when a level is loaded. This can probably be done a bazillion ways, so I'm not sure which is the best.
 

spaar

Active Member
#12
Right, I forgot that once Unity 5 is here, we can all create Asset Bundles.

Regarding the level load: I believe MonoBehaviours can just have a void OnLevelWasLoaded(int level) method, Unity will automatically call that once a new level is loaded. I do plan to provide constants for block ids, level ids and things like that though.
 
Top