|
||
|
|||||||
| Other Cant find a category above, use this one! Core mods not listed above go here! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) | ||
|
Forum Expert
Join Date: Nov 2004
Location: Southeast Missouri USA
Age: 34
Posts: 283
|
I recently started a thread in Modification Suggestions about an idea i had for reducing the amount of time it takes the server to compile.
You can find this thread at: A suggestion regarding the disparity of cache-nocache compile times This is mostly aimed at people like me that restart the server very, very often and get annoyed that the server has to recompile every script, not just the script i changed. Quote:
Quote:
You can find my additions in the attached file as: Code:
#region Workbench Mod 1 of 2 Code:
#region Workbench Mod 2 of 2 After looking at the code in ScriptCompiler.cs closely, i realized that it would be much simpiler to add in a new file extention and have it generate an assembly for the new extention like it already does for vb and cs files. Note: This mod is for c# code only. I don't use visual basic, so i didn't include a vb compiler version... If you don't know how to compile a new Server.exe, check out Penndragon's faq here: Easy how to compile new server...... Once you have the Server.exe built with the ScriptCompiler.cs i include here, using the mod works like this: 1. Any c# script file that ends in .wb (short for Workbench) will be compiled into a Scripts.WB.dll This allows you to edit your .wb files as often as you like and not have to re-compile the .cs scripts each time. If you only change a .wb file, the server will only compile the .wb and will load the .cs cache. 3. After you are done, just rename your script file back to .cs! ( If you use this mod, Please, please rename files back to .cs. I can hear the questions about .wb files now... ) Test server version of RunUO 2.0 anyone? Edit: Currently, if a script contains a class or method that is required to exist by another file, you cannot just rename the cs to a wb. This is because when you start the server, the cs scripts are compiled together and they have to all work together. I am working on the problem but until i can find a solution, there does exist two partial workarounds for this situation. 1. Make the rest of the dependant files wb. This is a partial solution because having too many files to keep track of sucks. 2. Copy the existing cs you want to edit and name the extention of the copy wb. This way, the original cs script exists for the other scripts that depend on it, and you have a copy that you can make changes in. This workaround is limited in that you can only check to see if your changes will compile. Your changes to the wb file will not appear in-game since the dependant files compiled against the cs version of the file in question. This is a partial solution because it does not work in all cases. An example is that this workaround works on BaseKnife, but not on BaseWeapon.
__________________
Ashlar, beloved of Morrigan Click here to goto a post containing links to each script i have released, each thread i have started and info about me. Last edited by Ashlar; 07-31-2006 at 05:02 PM. |
||
|
|
|
|
|
#3 (permalink) |
|
Forum Expert
|
Interesting idea.
I have a problem with it however. This is only good if you are adding a file that is not depended on by existing c# files, and does not work if your files are integrated with stock scripts. In other words, what files can you just simply rename with .wb extension, and still be able to compile your C# scripts? I don't have many files like that. I cannot change BaseWeapon.cs to BaseWeapon.wb and work just on that file, because the C# scripts will not compile without BaseWeapon.cs being there. EDIT: This WILL work OK if you are adding a completely 'Drag-n-drop' script or script system, where you are not modifying existing C# scripts (most of which depend on eachother to a degree.)
__________________
Advanced Player Gate with Shard Control - My Master Runebook - Linked Books & Bags - Full Toolbar (Fubar) - XML Bible system - Music Box - Enhancement Deeds - House Paints - Light Switch Last edited by Lokai; 07-31-2006 at 03:48 PM. |
|
|
|
|
|
#4 (permalink) | |
|
Forum Expert
Join Date: Nov 2004
Location: Southeast Missouri USA
Age: 34
Posts: 283
|
Quote:
I don't edit the distro files much myself since i am more concerned with making new scripts. And when you are making new scripts, the problem doesn't appear at all. There is a partial workaround that works in some cases... Copy BaseKnife.cs to a new folder, and change the extention on the copy to a .wb ( i.e. BaseKnife.cs.wb ). You still have the original file as a cs so the server will compile, and a wb file to make your changes in and restart the server quickly. Doing this however will only show you if the server will compile, since any knives created in game will not use values from the wb BaseKnife. But, just knowing that your changes will compile as a .cs script will still save time. I said earlier that this workaround will work in "some cases". Your BaseWeapon example will still not work due to abstract class protection levels in IDurability. But, as i have shown (and tested) with the BaseKnife, it doesn't take much time to find out if the workaround will work on a particular script file. This mod will not work for everything unfortunately. I didnt understand Phantom's concern until just today, but i still see this as an invaluable tool - it has saved me hours and hours already! Like any tool however, it doesn't work for every job.... Just most of em ![]() I am going to be looking into seeing if i can fix this problem by getting the wb scriptcompiler to load the Scripts.cs.dll as a resource. Edit: err, reverse that... In the meantime, I hope that the workaround i suggested helps you Lokai. P.S. Thanks for trying this out!
__________________
Ashlar, beloved of Morrigan Click here to goto a post containing links to each script i have released, each thread i have started and info about me. Last edited by Ashlar; 07-31-2006 at 05:05 PM. Reason: Formatting/Color |
|
|
|
|
|
|
#5 (permalink) |
|
Forum Expert
|
I think this tool is wonderful, its saving me tons of time working on some new stuff. I don't really see or understand the problem you guys are describing, however.
I've just made some new mobs, which are derived from BaseCreature, and I didn't need to rename my BaseCreature.cs to .wb. Seems like a great tool to me, I was really getting tired of recompiling everything everytime I made a little change. ![]() Thanks Ashlar! |
|
|
|
|
|
#6 (permalink) |
|
Forum Expert
|
Glad to hear that Cheetah.
Here is where the problem comes in: I am working on several big systems at the moment. Each one has about 20-30 files in it. Now, if they were self-contained, or were based on other files, but "NOTHING DEPENDED ON THEM" then I could just rename them all with the .WB extension, and it would work fine. But for example, one of the systems I am working on also makes a change and addition to the AI system. So, if I rename the files, BaseAI says it "misses" them, and if I rename BaseAI, there are about 1000 files that miss that. etc. etc. etc. Don't get me wrong. I was maybe the first one to create a brand new server to test this out. I think its a very cool idea. It is just frustrating that it doesnt work for me yet. |
|
|
|
|
|
#7 (permalink) | |
|
Forum Expert
Join Date: Nov 2004
Location: Southeast Missouri USA
Age: 34
Posts: 283
|
Glad you like it Cheetah2003
For the first day or so i kept wanting to yell either "station" or "workbench" everytime i restarted the server. This is only for those having problems like Lokai was desribing... If you are having no problems with using this mod, dont bother to read on because this only occurs when editing WB files that CS scripts are dependant on. Lokai, I have been working on this, trying to get it where you could use it with no problems. Like you said, it works great for smaller projects, but for larger ones that change lots of code throughout the scripts... yech! I have been making a lot of tests and suchlike and while i have figured out how to create a "trailing effect" (See next paragraph), it isn't something that i recommend for use because it gets.... err, complex to know what is going on where. What i am calling a "trailing effect" is that; I have been able to get the cs compiler to load the wb.dll as a resource if it exists. Meaning that: 1. You copy the cs and name the copy a wb. 2. Compile, the cs is still there, so it loads the cs cache and compiles the wb. 3. Shut the server back down. 4. Rename or remove the cs that you copied. 5. Restart the server to re-compile. (It has to compile the cs scripts since you deleted one of them, but it loads the Scripts.WB.dll as a resource.) From this point on, the wb file IS the cs script as far as the cs compiler is concerned since it loads it. Problem: If you cannot compile a script as a wb, (the baseweapon problem), you cannot get a dll of it and the whole thing breaks down.... grr! On the plus side, from this effect i believe it is possible to get the compiler to loop through all the scripts in the \Scripts folder, compiling them one at a time and creating assemblys for each of them as it goes and then using the dll's of them as resources for suceeding compiles. I believe that code that does this would be the ultimate word in a developers test shard. This way, the server would only compile scripts that have changed and load everything else. Now, the only problem is that i do not know enough about the CSharpCodeProvider to code this 'Dynamic, hierarchical, compile and load in-line loop'! *Ashlar sends out a plea for help to those who know more than he.* Attached is the version that loads the wb.dll as a resource for the cs compiler in case you want to see it. I also have in it that the wb compiler loads the cs.dll as a resource in hopes that it would help on the baseweapon problem. It gives different warnings, but the error remains. Quote:
__________________
Ashlar, beloved of Morrigan Click here to goto a post containing links to each script i have released, each thread i have started and info about me. Last edited by Ashlar; 08-03-2006 at 08:28 PM. |
|
|
|
|
|
|
#9 (permalink) |
|
Forum Newbie
|
Hey there,
Trying to get the new Server.exe working, but I get this feedback: Code:
RunUO - [www.runuo.com] Version 2.0, Build 2424.3593 Core: Running on .NET Framework Version 2.0.50727 Scripts: Compiling C# scripts...done (cached) Scripts: Compiling VB.NET scripts...no files found. Scripts: Compiling Workbench C# scripts...no files found. Scripts: Verifying...done (4 items, 0 mobiles) Error: System.Reflection.TargetInvocationException: Exception has been thrown by the ta rget of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Server.Admin.AdminNetwork.Configure() --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] argum ents, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] argume nts, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwn er) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke Attr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisib ilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke Attr, Binder binder, Object[] parameters, CultureInfo culture) at Server.ScriptCompiler.Compile(Boolean debug) at Server.Core.Main(String[] args) This exception is fatal, press return to exit
__________________
- nickfly (aka Gorgan) |
|
|
|
|
|
#10 (permalink) |
|
Forum Expert
Join Date: Nov 2004
Location: Southeast Missouri USA
Age: 34
Posts: 283
|
Hey there
![]() I just rebuilt the server to svn ver 74 myself to make sure that it still works. It does, so my guess is that you probably forgot to delete the contents of \Scripts\Output before you started your new server build. What the problem seems to be is that the scripts.dll was compiled with a different server.exe, and the new one cannot use it. If you delete the files in \Scripts\Output does it still have the error?
__________________
Ashlar, beloved of Morrigan Click here to goto a post containing links to each script i have released, each thread i have started and info about me. |
|
|
|
|
|
#11 (permalink) |
|
Forum Expert
Join Date: Dec 2005
Location: Missouri , USA
Age: 38
Posts: 256
|
Server compile time before .WB aprox 10 minutes
Server compile time After adding a new .wb aprox 2 seconds Running this package has made my life alot smoother, running this on 2 servers at this time and going to add it to the 3rd soon i used to dread adding or changing one simple line of code now i hit [restart and just simply log back in and with a brief little burp the shard is running again!Thanks Ashlar +++ Karma to you man |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|