|
Post by Zeblote on Feb 10, 2015 12:50:45 GMT
I don't know what decompiler you guys are using, but for me that code looks like this: Coroutines are very ugly to decompile due to the way they work, but you can make sense of it. The beginning state is default, then you have functions like Yield(nextState, stuff) and YieldDefault(nextState), they make the code continue at a different state in the next frame or after another coroutine finished. Above code would look about like this in C# if I remember how to use yield correctly: IEnumerator Load() { if (isLoading || !CheckFileExists(textFieldCode.fileName + ".bsg"))) yield break;
isLoading = true;
yield return StartCoroutine(saveCode.LoadName(textFieldCode.fileName)); yield return new WaitForSeconds(0.2f);
STATLORD.inMenu = false; Camera.main.GetComponent(typeof(BlurEffect)).enabled = false; isLoading = false; saveWindowObj.gameObject.SetActive(false); } Following the code through a few more (pointless) coroutines, we end up here: Though that only reads the file, the loading function is called by the same coroutine after this finishes. I recommend you switch to www.telerik.com/products/decompiler.aspx if you aren't using it already, best C# decompiler you can find. It sometimes generates a few more lines than other decompilers but that doesn't really make a difference. Make sure to enable "Show compiler generated types and members" in Tools>Settings in order to see coroutines, and install reflexil from Plugins>Plugins Manager
|
|
|
Post by spaar on Feb 10, 2015 13:11:00 GMT
I'm already using JustDecompile and Reflexil, but thanks for the tip for seeing the coroutines, that'll be useful.
|
|
|
Post by chance on Feb 10, 2015 19:10:34 GMT
God damn, that's cool. The game itself gives the player so much to do, but if modding support happens. OMG.
|
|
|
Post by Zeblote on Feb 10, 2015 19:23:22 GMT
God damn, that's cool. The game itself gives the player so much to do, but if modding support happens. OMG. There will be official modding support later.
|
|
|
Post by chance on Feb 10, 2015 22:51:09 GMT
God damn, that's cool. The game itself gives the player so much to do, but if modding support happens. OMG. There will be official modding support later. Awesome!
|
|
|
Post by Von on Feb 10, 2015 23:46:50 GMT
Moved to modding section.
|
|
|
Post by gOitRe on Feb 11, 2015 1:30:15 GMT
Very glad to see a (even unofficial) dedicated section, thanks Von! I'm still looking for answers to my concerns exposed in this post, i'd really like to hear your point on the matter. ~ Gratz to VapidLinus for the Modder hat
|
|
|
Post by Von on Feb 11, 2015 3:26:24 GMT
Very glad to see a (even unofficial) dedicated section, thanks Von! I'm still looking for answers to my concerns exposed in this post, i'd really like to hear your point on the matter. ~ Gratz to VapidLinus for the Modder hat Sorry for some reason I thought I had replied to your post but apparently I only did that in my head :S We're glad to have people interested enough in Besiege that they want to mod it. Modding is just another logical creative aspect to Besiege, we hope to provide official mod support in the future but for now we're happy to work with modders and help them wherever we can. Our only objection would be branding mods as official content or profiting from mod creation. We were honestly impressed when Vapid posted his first modding attempts and aspirations, we had not expected anyone to show that much interest so fast. There are only two things I'd have to warn you about, one of which I spoke to Vapid about; Firstly there are features such as a map editor, which we plan to add to the game in the future and we wouldn't want you guys to put in a lot of hard work on something only for us to replace it. If you don't have a problem with this then you are of course free to create something which we plan to add later.
Secondly, which I forgot to mention to Vapid :S, we are looking at porting Besiege to Unity 5. We don't know if or when this will happen, currently there is a bug with Unity 5 which is preventing us from doing so. We are not sure what kind of an impact changing to a newer version of the engine would have upon your work, it might be worth looking into.
|
|
|
Post by Zeblote on Feb 11, 2015 8:37:57 GMT
Secondly, which I forgot to mention to Vapid :S, we are looking at porting Besiege to Unity 5. We don't know if or when this will happen, currently there is a bug with Unity 5 which is preventing us from doing so. We are not sure what kind of an impact changing to a newer version of the engine would have upon your work, it might be worth looking into. That has no impact on modding, only a few renamed api functions. Unity 5 is just more awesome otherwise. Though it would be good to know when you're starting with that (maybe even have a passworded beta group on steam?) However, don't use IL2CPP should unity ever release that for desktop, it turns the easily reverse engineered c# into a native code nightmare and that would essentially break modding.
|
|
|
Post by zodium on Feb 11, 2015 12:06:45 GMT
Zeblote, I don't know if the Besiege devs should be making engine decisions based on users' ability to decompile it. It's a computationally expensive game as it is, so they should take the opportunity to optimize things when possible. I saw this modding project here more as exploring what kind of aspects of the game should be exposed to users, not a long-term modding solution.
|
|
|
Post by Zeblote on Feb 11, 2015 12:25:12 GMT
IL2CPP makes the scripts a bit faster (should unity even release it for desktop, they've said it's not a priority as mono works well) but the most expensive part of this game is physics. The physics engine in unity 5 gets a speed-up anyways with multi-core support.
There are of course other (better) ways to have modding support than having to decompile and modify the game, but that'd mean the devs have to spend a (probably long) time to implement an official mod loader, API, callbacks, etc.
|
|
|
Post by zodium on Feb 11, 2015 13:14:34 GMT
Decompiling and modifying the game code is not really a viable long-term modding system, partly because it's a too high barrier to entry and partly because it's a walking talking security risk, so they're going to have to develop those things if they want modding, anyway. I don't code in anything except R and Python, so I'm not qualified to say what effect IL2CPP would have on game performance--I'm just speaking generally.
|
|
|
Post by Zeblote on Feb 11, 2015 14:11:07 GMT
Decompiling and modifying the game code is not really a viable long-term modding system, partly because it's a too high barrier to entry and partly because it's a walking talking security risk, so they're going to have to develop those things if they want modding, anyway. Yes, as I said: There are of course other (better) ways to have modding support than having to decompile and modify the game, but that'd mean the devs have to spend a (probably long) time to implement an official mod loader, API, callbacks, etc. The current way to mod the game sucks, but I'd prefer they don't break it until there is official mod support.
|
|
|
Post by zodium on Feb 11, 2015 14:12:34 GMT
Oh, yeah, definitely.
|
|
|
Post by Zeblote on Feb 11, 2015 19:50:38 GMT
Anyways, the most important problem we need to get right first: a mod loader. A few people are creating mods but they can't work together if everyone requires his own modified game file to use them.
The easiest approach is to have one single mod that requires a modified file (the mod loader) and then loads all the others (each mod has a main component that is added to a child gameobject on the mod loader object, and then set to dontdestroyonload)
But... that doesn't really work as each mod might require a few hooks/callbacks or other edits. For example, in order to change the rotation steps of parts 2 opcodes have to be edited in AddPiece.Update. Or you want changes to be saved with the machines (like that colorize mod). The old version of mono unity uses doesn't have any of the .net methods implemented that you could use to modify the scripts at runtime.
I can't really think of a way to solve this.
|
|