Go Back   RunUO - Ultima Online Emulation > RunUO > Core Modifications > Other

Other Cant find a category above, use this one! Core mods not listed above go here!

Reply
 
Thread Tools Display Modes
Old 09-06-2005, 06:45 PM   #1 (permalink)
Forum Expert
 
Join Date: Dec 2002
Posts: 730
Default Merging of core and scripts

I'm thinking about making an executable that compiles the scripts subfolder and a core one(with the core code) into an executable only. The compiler would be removed from the core code, which would only load the world, making starting the server up faster and recompiles optional. Other advantages:
-Being able to remove some extra interface code (like IAccount) that makes some casts mandatory to integrate core and scripts
-Being able to use code defined in scripts in the core (for example, using a check in the item packet to see if the PlayerMobile has IsHallucinating true..)
-Being able to change stuff in the core easily (like accesslevels), recompiling with just a double click
-Making it easier to send just a Server.exe file and the Data/Saves to your host, instead of sending the entire scripts folder

So, what do you guys think about it?



EDIT:
Did it! With only one method modified in the core It isn't half as optimized as it could be, and definately not well tested but it does the job :P

With this mod the server still verifies scripts on startup, dunno if I should move that to the compiler to make it even faster...

WARNING: Do not try this out on a real shard, this is test only, only try it if you know what you're doing..

On ScriptCompiler.cs, use this Compile method instead of the original one:
Code:
		public static bool Compile( bool debug )
		{
			int a = 0;
			m_Assemblies = new Assembly[] { Core.Assembly };

			Console.Write( "Scripts: Verifying..." );
			Core.VerifySerialization();
			Console.WriteLine( "done ({0} items, {1} mobiles)", Core.ScriptItems, Core.ScriptMobiles );

			ArrayList invoke = new ArrayList();

			for (a=0;a<m_Assemblies.Length;++a)
			{
				Type[] types = m_Assemblies[a].GetTypes();

				for ( int i = 0; i < types.Length; ++i )
				{
					MethodInfo m = types[i].GetMethod( "Configure", BindingFlags.Static | BindingFlags.Public );

					if ( m != null )
						invoke.Add( m );
						//m.Invoke( null, null );
				}
			}

			invoke.Sort( new CallPriorityComparer() );

			for ( int i = 0; i < invoke.Count; ++i )
					((MethodInfo)invoke[i]).Invoke( null, null );

			invoke.Clear();

			World.Load();

			for (a=0;a<m_Assemblies.Length;++a)
			{
				Type[] types = m_Assemblies[a].GetTypes();

				for ( int i = 0; i < types.Length; ++i )
				{
					if ( !types[i].Equals( typeof( Server.Network.NetState ) ) )
					{
						MethodInfo m = types[i].GetMethod( "Initialize", BindingFlags.Static | BindingFlags.Public );

						if ( m != null )
							invoke.Add( m );
							//m.Invoke( null, null );
					}
				}
			}

			invoke.Sort( new CallPriorityComparer() );

			for ( int i = 0; i < invoke.Count; ++i )
				((MethodInfo)invoke[i]).Invoke( null, null );

			return true;
		}
And you can get the Source/Project for VS2003 of the compiler (most of it was straight from the core and could use some useless-method-deletion to leave only the needed parts):
http://www.nogard.net/Compiler.zip
Atomic is offline   Reply With Quote
Old 09-06-2005, 06:56 PM   #2 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

I think your going to go to alot of trouble for little to no gain.
Phantom is offline   Reply With Quote
Old 09-06-2005, 07:14 PM   #3 (permalink)
Forum Expert
 
Join Date: Dec 2002
Posts: 730
Default

Not much trouble at all, basically just taking scriptcompiler and putting it out of the core
And I dont have anything better to do anyways
Atomic is offline   Reply With Quote
Old 09-06-2005, 08:16 PM   #4 (permalink)
The noob formerly known as Jakob
 
Serp's Avatar
 
Join Date: Jan 2005
Posts: 316
Default

Quote:
Originally Posted by Atomic
Not much trouble at all, basically just taking scriptcompiler and putting it out of the core
And I dont have anything better to do anyways
As long as you learn something it's a successful project! Good luck! :-)
Serp is offline   Reply With Quote
Old 09-06-2005, 11:24 PM   #5 (permalink)
Forum Expert
 
Alis's Avatar
 
Join Date: Jun 2005
Location: Probably where people call it heaven
Posts: 1,452
Send a message via AIM to Alis Send a message via MSN to Alis
Default

Quote:
Originally Posted by Phantom
I think your going to go to alot of trouble for little to no gain.
gee phantom your allways approaching such ideas and projects in -negative way as to remember to my disscusiion about Save system you said it wouldnt be good to modify the core damn if you dont modify the core who will ? the dev ? is all the work done by the dev ? i dont think so no one is superb exchanging ideas and methods makes all the people superb this why Runuo site is online so that people exchange their suggestions.

And you you also support maybe with everything but don allways start your posts with negative way dont act like a robot just say no or yes say something else will you im not flaming you but im telling my suggestion just to remember on the hack topic what ever.
Alis is offline   Reply With Quote
Old 09-07-2005, 12:14 AM   #6 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

Quote:
Originally Posted by Alis
gee phantom your allways approaching such ideas and projects in -negative way as to remember to my disscusiion about Save system you said it wouldnt be good to modify the core damn if you dont modify the core who will ? the dev ? is all the work done by the dev ? i dont think so no one is superb exchanging ideas and methods makes all the people superb this why Runuo site is online so that people exchange their suggestions.

And you you also support maybe with everything but don allways start your posts with negative way dont act like a robot just say no or yes say something else will you im not flaming you but im telling my suggestion just to remember on the hack topic what ever.
He asked for what we thought, I told him what I thought, nothing I said was negative.

Some advice, if you have to say your not attacking me, gues what you think there is a chance I will take it that way thus the reason it was said.

Guess what, you did attack me, and for what exactly? Because I don't agree with making this modification, the comment the author asked for?

Quote:
So, what do you guys think about it?
I do not think anything will be gained from it, infact I feel RunUO would become slower considering its using untested code to load dlls

Quote:
-Being able to use code defined in scripts in the core (for example, using a check in the item packet to see if the PlayerMobile has IsHallucinating true..)
-Being able to change stuff in the core easily (like accesslevels), recompiling with just a double click
The first one, can be done without any effort, and doesn't need a new core.

The second one, would require a small modification, to allow for the enum to be outside of the core. Then the same result will happen.

If you don't want everyones views on a particualar subject do not ask for it.
Phantom is offline   Reply With Quote
Old 09-07-2005, 12:37 AM   #7 (permalink)
RunUO Developer/Demise Person
 
ASayre's Avatar
 
Join Date: Mar 2003
Location: California
Age: 20
Posts: 1,700
Default

(or just compile the core with all of the script fles except for one into an EXE, no modification to RunUO code required)
__________________
Andre Sayre, Core Developer
The RunUO Software Team

The day we are born is the day Death inches ever closer...
E-mail: ASayre ( AT ) RunUO ( Dot ) c o m
I'm as graceful as a gazelle galloping over glistening green grass with it's head on fire.
ASayre is offline   Reply With Quote
Old 09-07-2005, 05:14 AM   #8 (permalink)
Forum Novice
 
Join Date: Oct 2003
Location: Vienna, Austria
Age: 21
Posts: 127
Send a message via ICQ to Arahil
Default

i also thought about such a modification, and i think i will do it in the near future. but my idea went a little further, i thought about a "core" executable, that just compiles the scripts and calls the mainloop, which is also in the scripts, via reflection. i do know, that this is not really a clean way and may cause a lot of trouble, but i'm sure it will work if you use it correctly.
it's pretty annoying for me to have 2 different projects to work on with some changes, 2 different versions, 2 different svn-repositories to maintain etc. another reason for me was, that i do not really think the core and the scripts are divided in the best way, especially concerning the playermobile. every mobile carries some properties it does not need (like the netstate, for example), which wastes some memory. and since i don't want to give the mobile even more properties it does not need anyway and using an interface for playermobiles causes annoying casts (like IAccount) i will do this merge.

if i'm successful, i will post my solution on these forums.
Arahil is offline   Reply With Quote
Old 09-07-2005, 11:40 AM   #9 (permalink)
Forum Expert
 
Join Date: Dec 2002
Posts: 730
Default

Quote:
Originally Posted by Phantom
He asked for what we thought, I told him what I thought, nothing I said was negative.

Some advice, if you have to say your not attacking me, gues what you think there is a chance I will take it that way thus the reason it was said.

Guess what, you did attack me, and for what exactly? Because I don't agree with making this modification, the comment the author asked for?



I do not think anything will be gained from it, infact I feel RunUO would become slower considering its using untested code to load dlls

---There is no way at all that RunUO wwould become slower.. Actually it would be faster, but only on startup

The first one, can be done without any effort, and doesn't need a new core.

---If i'm going to change one of the packets, it obviously is a core mod..

The second one, would require a small modification, to allow for the enum to be outside of the core. Then the same result will happen.

---With the modification I'm planning you won't even need that, which is exactly the point

If you don't want everyones views on a particualar subject do not ask for it.
Commented on the quote^

Quote:
(or just compile the core with all of the script fles except for one into an EXE, no modification to RunUO code required)
Sure, but that would take all the fun out of it :P

Quote:
i also thought about such a modification, and i think i will do it in the near future. but my idea went a little further, i thought about a "core" executable, that just compiles the scripts and calls the mainloop, which is also in the scripts, via reflection. i do know, that this is not really a clean way and may cause a lot of trouble, but i'm sure it will work if you use it correctly.
it's pretty annoying for me to have 2 different projects to work on with some changes, 2 different versions, 2 different svn-repositories to maintain etc. another reason for me was, that i do not really think the core and the scripts are divided in the best way, especially concerning the playermobile. every mobile carries some properties it does not need (like the netstate, for example), which wastes some memory. and since i don't want to give the mobile even more properties it does not need anyway and using an interface for playermobiles causes annoying casts (like IAccount) i will do this merge.

if i'm successful, i will post my solution on these forums.
Nice, good to see someone thinks like me
Atomic is offline   Reply With Quote
Old 09-08-2005, 11:52 PM   #10 (permalink)
Forum Expert
 
Ohms_Law's Avatar
 
Join Date: Sep 2004
Age: 37
Posts: 1,006
Default

Quote:
Originally Posted by ASayre8
(or just compile the core with all of the script fles except for one into an EXE, no modification to RunUO code required)
Andre (or anyone else for that matter),
I think I know why (being that the 'core' wasn't released originally), but I'm curious as to any other thinking behind why this wasn't done to begin with? Well, not really why it wasn't done to begin with, but maybe why it wasn't done since the core was released?
Ohms_Law is offline   Reply With Quote
Old 09-09-2005, 01:09 AM   #11 (permalink)
RunUO Developer/Demise Person
 
ASayre's Avatar
 
Join Date: Mar 2003
Location: California
Age: 20
Posts: 1,700
Default

Quote:
Originally Posted by Ohms_Law
Andre (or anyone else for that matter),
I think I know why (being that the 'core' wasn't released originally), but I'm curious as to any other thinking behind why this wasn't done to begin with? Well, not really why it wasn't done to begin with, but maybe why it wasn't done since the core was released?
Most people don't even know howto compile the core, and, the Core contains all the 'givens', things that would be standard between different people (assuming they don't change it themselves)

Fact of the matter is, 98% of the people don't need to recompile the core anyways.
__________________
Andre Sayre, Core Developer
The RunUO Software Team

The day we are born is the day Death inches ever closer...
E-mail: ASayre ( AT ) RunUO ( Dot ) c o m
I'm as graceful as a gazelle galloping over glistening green grass with it's head on fire.
ASayre is offline   Reply With Quote
Old 09-09-2005, 08:36 PM   #12 (permalink)
Forum Expert
 
Ohms_Law's Avatar
 
Join Date: Sep 2004
Age: 37
Posts: 1,006
Default

Quote:
Originally Posted by ASayre8
Most people don't even know howto compile the core, and, the Core contains all the 'givens', things that would be standard between different people (assuming they don't change it themselves)

Fact of the matter is, 98% of the people don't need to recompile the core anyways.
oh, you'll get no argument from me their. 90% of people shouldn't be recompiling their scripts either though.


The unfortunate side effect of that though is that most folks consider the core to be 'untouchable', event if they do know what their doing. It makes it rather difficult to contribute to the project as a whole in certain (albeit limited) cases.

That being said, it would be alot of work to change it now. Like I said at the beginning, I was really just curious anyway.
Ohms_Law is offline   Reply With Quote
Old 09-09-2005, 09:16 PM   #13 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

Quote:
Originally Posted by Ohms_Law
oh, you'll get no argument from me their. 90% of people shouldn't be recompiling their scripts either though.


The unfortunate side effect of that though is that most folks consider the core to be 'untouchable', event if they do know what their doing. It makes it rather difficult to contribute to the project as a whole in certain (albeit limited) cases.

That being said, it would be alot of work to change it now. Like I said at the beginning, I was really just curious anyway.
Its a matter of the fact, there is nothing any of us, can change thats really worth it.

Now if you change the core to support a custom client, and make basicly a new game, find its a great reason.

But making minor changes just because you can, shows you don't know a better way to do stuff, if of course there is another way.
Phantom is offline   Reply With Quote
Old 09-10-2005, 01:03 AM   #14 (permalink)
Forum Novice
 
Join Date: Nov 2003
Location: New Zealand
Age: 21
Posts: 151
Send a message via ICQ to Bmzx007 Send a message via AIM to Bmzx007 Send a message via MSN to Bmzx007 Send a message via Yahoo to Bmzx007
Default

Quote:
Originally Posted by Phantom
Its a matter of the fact, there is nothing any of us, can change thats really worth it.

Now if you change the core to support a custom client, and make basicly a new game, find its a great reason.

But making minor changes just because you can, shows you don't know a better way to do stuff, if of course there is another way.
Well for one, I disagree with the first line, there are things that can be changed in the core to make it worth it. Just because you dont think there is, doesnt mean there isnt.

And your last statement, Doesnt show they dont know a better way to do something, it shows they decided to put it in the core, rather than override it, Which in my opinion, is a better way of doing things.

If something in the core, was bugged (As an example purely) or something didnt function how you wanted it (Say, the Gender Packet reading as bool rather than byte for ML stuff) would you override and change it? or would you write directly into the core.

I'd change it in the core, because its cleaner, and more efficient. Im quite sick of your negative attitude towards core changes, The core was GPL'ed, and thats it. If people want to do it, they will, Everyone knows your against it, so you dont need to post in every small core modification post, and voice it again.
Bmzx007 is offline   Reply With Quote
Old 09-10-2005, 04:40 AM   #15 (permalink)
Forum Novice
 
Join Date: Oct 2003
Location: Vienna, Austria
Age: 21
Posts: 127
Send a message via ICQ to Arahil
Default

Quote:
Originally Posted by Phantom
Its a matter of the fact, there is nothing any of us, can change thats really worth it.

Now if you change the core to support a custom client, and make basicly a new game, find its a great reason.

But making minor changes just because you can, shows you don't know a better way to do stuff, if of course there is another way.
phantom, the fact that you do not know any reasons to change to core (or are not able to do it) does not mean that no one else does. i changed my core quite a lot, and if you really want to i can give you some examples of changes that are not even possible to do in the scripts. please stop fucking around in every single core mod thread - i think that prevents a lot of people from posting their stuff here and talk about pretty interesting things...
in this point you cannot even say you go with the devs - like this quote of zippy shows:
Quote:
Why does everyone think it's somehow frowned upon to talk about the core.

I am daily disappointed by lack of activity in the Core Mods forums. Really, I am.

Just because a person with a large post count says it, doesn't make it true.
http://www.runuo.com/forum/showthrea...176#post416176

and before you troll around in the next core mod thread i just want to remind you that some factions code was also in the core... does that mean that these changes were not "really worth it" or does that show that "you don't know a better way to do stuff"?
Arahil is offline   Reply With Quote
Old 09-10-2005, 10:37 AM   #16 (permalink)
Forum Expert
 
Join Date: Dec 2002
Posts: 730
Default

Phantom, please stay out of my posts.
Atomic is offline   Reply With Quote
Old 09-12-2005, 04:33 AM   #17 (permalink)
Forum Expert
 
Marak's Avatar
 
Join Date: Mar 2005
Location: Firmly Seated Infront of the Computer.
Age: 25
Posts: 429
Default

i could have sworn i posted this before?!? go figure. neway:

Any luck with this yet? id love to get a copy of it just for when im working on new scripts i dont have to keep an eye on it(go for a coffee instead) so i can stop it from completly loading.
Marak is offline   Reply With Quote
Old 09-12-2005, 02:35 PM   #18 (permalink)
Forum Novice
 
Join Date: Oct 2003
Location: Vienna, Austria
Age: 21
Posts: 127
Send a message via ICQ to Arahil
Default

well, as i said i will release my version here, too.
it's just a first try, so there might be bugs in it. i absolutely do not recommend it to use for somebody who is not experienced with using runuo and a custom core...

i went a step further than atomic did and wrote a program that precompiles both the scripts and the core, and start the runuo-server afterwards. i removed some of the mechanisms in scriptcompiler.cs, like directory checks and stuff, since i do not need them (actually i do not know if anyone does ). i used relative paths instead wherever i could.
i also removed compiling of *.vb scripts. don't use that, too, but should be no problem to insert for someone who knows the original scriptscompiler.cs.
since the server does not compile the code itself, i had to install a routine to load the compiled assemblies via filepath, which works fine, too. script verification and initialization are still in the server scripts - all the additional exe does is creating some assemblies (actually, just one ) and starts a given class.

starting the class works via reflection, you have to give the precompiler.exe the name of a class, in most cases "Core", as a parameter. the precompiler then loads the main-method out of this class if it exists - otherwise it shows an error pointing out what is wrong. of course the precompiler is passing on the other parameters given to it, like -debug or -service.

to use the precompiler you have to move the whole core directory in a subfolder of the scripts directory and change scriptcompiler.cs to the version i attached in this post.


well, i think that's all... but again, i do not recommend anyone to use this piece of code, especially since it is quite untested yet. seems to work fine, but who knows what bugs might come...
Attached Files
File Type: rar precompiler.rar (15.7 KB, 46 views)
File Type: cs scriptcompiler.cs (6.9 KB, 44 views)
Arahil is offline   Reply With Quote
Old 09-13-2005, 01:22 AM   #19 (permalink)
Forum Expert
 
Marak's Avatar
 
Join Date: Mar 2005
Location: Firmly Seated Infront of the Computer.
Age: 25
Posts: 429
Default

Thnx this will be usefull for when im testing
Marak is offline   Reply With Quote
Old 09-21-2005, 10:38 AM   #20 (permalink)
Forum Novice
 
Join Date: Oct 2003
Location: Vienna, Austria
Age: 21
Posts: 127
Send a message via ICQ to Arahil
Default

i did some tests, and it seems to work pretty well
so if you want to, feel free to use it...
Arahil is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5