|
You last visited: Today at 14:01
Advertisement
C# or Python?
Discussion on C# or Python? within the CO2 Programming forum part of the Conquer Online 2 category.
06/05/2013, 22:27
|
#16
|
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
|
Wrong copypaste...
|
|
|
06/06/2013, 01:54
|
#17
|
elite*gold: 0
Join Date: Mar 2005
Posts: 1,430
Received Thanks: 1,587
|
what i really like with Lua is lets say you want to access the calling players class (ima call it Client wich is GameClient class).
IN your LUA initialization you can add engine["Player"] = Client;
This tells lua to allow you access to the whole GameClient class.
Then later on in your script you can do something like...
Dialog("Welcome "..Player.Name.." What can i do for you?");
or
Player.Teleport(1002,400,400);
or
Player.Kill();
these are just examples To show you that with LUA you dont need to write your whole class over to a scriptable object.
Regards
|
|
|
06/06/2013, 02:43
|
#18
|
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
|
Quote:
Originally Posted by Ultimation
what i really like with Lua is lets say you want to access the calling players class (ima call it Client wich is GameClient class).
IN your LUA initialization you can add engine["Player"] = Client;
This tells lua to allow you access to the whole GameClient class.
Then later on in your script you can do something like...
Dialog("Welcome "..Player.Name.." What can i do for you?");
or
Player.Teleport(1002,400,400);
or
Player.Kill();
these are just examples To show you that with LUA you dont need to write your whole class over to a scriptable object.
Regards
|
The same thing applies to (Iron)Python, you only have to register you object, like you did with your LUA script, and it has knowledge of the whole class.
|
|
|
06/06/2013, 09:11
|
#19
|
elite*gold: 0
Join Date: Nov 2009
Posts: 390
Received Thanks: 321
|
Guess I'd go with what almost everyone else said, it's either Lua or Python. Reflection on the other hand can get quite messy, let alone that the performance *might* not be the best.
IMO though, you should make sure that reflection isn't slow in critical parts, and somehow measure relative performances of the possible routes that you may take (to my experience, not exactly the easiest task when you're dealing with a crapload of I/O). At the end of the day you should ultimately choose something that you're comfortable with and that doesn't impact the performance of the server.
|
|
|
06/06/2013, 10:29
|
#20
|
elite*gold: 0
Join Date: Apr 2008
Posts: 759
Received Thanks: 285
|
when I first used Lua as NpcScripting language it was great , but there is a down part there!
as Ult. mentioned you can register a whole class to Lua and use it's fields/properties , but if lets say you registered a class called Hero, and that class has a property called Life.
Code:
uint Life{
get{
return this.life; //db arg
}
set{
this.life = value;
UpdateNotifier.Status(this.Id, Status.HP, value);// so it send a packet to update your health.
}
}
it sets the value , but it does not call the method UpdateStatus , not sure why, when I used IronPython it worked fine...
|
|
|
06/06/2013, 15:24
|
#21
|
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
|
Quote:
Originally Posted by Nullable
Guess I'd go with what almost everyone else said, it's either Lua or Python. Reflection on the other hand can get quite messy, let alone that the performance *might* not be the best.
IMO though, you should make sure that reflection isn't slow in critical parts, and somehow measure relative performances of the possible routes that you may take (to my experience, not exactly the easiest task when you're dealing with a crapload of I/O). At the end of the day you should ultimately choose something that you're comfortable with and that doesn't impact the performance of the server.
|
What I'm doing in my current source using reflection for C# scripting is loading the methods into a collection and simply calling upon that, but not loading them every time an action is required for it, but rather just having some form of update command which will update the collection with changes. Works pretty fine for me at least.
|
|
|
06/06/2013, 19:05
|
#22
|
elite*gold: 28
Join Date: Jun 2010
Posts: 2,226
Received Thanks: 868
|
Quote:
Originally Posted by Super Aids
What I'm doing in my current source using reflection for C# scripting is loading the methods into a collection and simply calling upon that, but not loading them every time an action is required for it, but rather just having some form of update command which will update the collection with changes. Works pretty fine for me at least.
|
Just do a quick hash check on the script files and update the appropriate ones every few minutes. (Would take what, 2 seconds to hash check 300 files? not done any tests myself, but I doubt it'd take long, depending on what hash you use)
|
|
|
06/06/2013, 19:55
|
#23
|
elite*gold: 0
Join Date: Jan 2008
Posts: 1,445
Received Thanks: 1,176
|
Quote:
Originally Posted by _DreadNought_
Just do a quick hash check on the script files and update the appropriate ones every few minutes. (Would take what, 2 seconds to hash check 300 files? not done any tests myself, but I doubt it'd take long, depending on what hash you use)
|
The biggest bottleneck would be to place the head of the drive for each file. Else, hashing around 125 MB with MD5 is REALLY negligible.
Code:
real 0m1.456s
user 0m0.437s
sys 0m0.125s
|
|
|
06/06/2013, 22:12
|
#24
|
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
|
Quote:
Originally Posted by _DreadNought_
Just do a quick hash check on the script files and update the appropriate ones every few minutes. (Would take what, 2 seconds to hash check 300 files? not done any tests myself, but I doubt it'd take long, depending on what hash you use)
|
Would that count empty files or files with actual content?
Also when the website is finished the scripts will be stored in an actual database and through the websites admin panel you'd edit the script. Everytime you saves a script it would notify the server about it and thus causing it to update.
|
|
|
 |
|
Similar Threads
|
[Python-Modul]EXP-Donator (kompatibel mit Python Loader)
11/23/2013 - Metin2 Hacks, Bots, Cheats, Exploits & Macros - 27 Replies
Moin,
da man mich danach gefragt hat und ich sowieso mal ein Beispiel für die Benutzung meines Python Loaders veröffentlichen wollte, habe ich die Gelegenheit genutzt und euch eben einen EXP-Spendebot geschrieben.
Man kann ihn einfach mit dem oben verlinkten Python Module Loader laden und ihn mit F5 aktivieren/deaktivieren.
Sobald ihr mehr als 99 Erfahrungspunkte habt (man kann nur in 100er Schritten spenden), werden alle Erfahrungspunkte an eure Gilde gespendet.
Wer Lust hat und...
|
Help to make a python file works with python loader
03/03/2013 - Metin2 - 2 Replies
Hey epvp! I want make a very. Little hack works on pythonn loader can anybody help me please?
|
Python
02/18/2013 - General Coding - 0 Replies
i make a program with python.
ciao--->Hi
Inserisci il primo numero---->1° number
Inserisci il secondo numero----->2°number
+ - * / options with button
thx :D
|
Metin2 - Python - Wie Python Hacks verschlüsseln und Server überprüfen (GF/PServe)
09/23/2012 - Metin2 - 2 Replies
Ich wollte fragen,
wie man Python Hacks am besten Verschlüsselt ?
und wie man feststellen kann ob man auf einem GF / Pserver spielt. ?
|
Python + Eric Python IDE installieren ?!
07/05/2011 - General Coding - 0 Replies
hat sich erledigt.
|
All times are GMT +1. The time now is 14:02.
|
|