-
Re: [RELEASE] My server files
fsockopen you seem really dedicated to learning, and ill give you a chance if you would like me to teach you some C#/Java because getting to where i am now, was taught from a great friend who just offered to help me out one time.
Pm me your msn if your interested.
-
Re: [RELEASE] My server files
-
Re: [RELEASE] My server files
Quote:
Originally Posted by
xEnt
Ultimation and Korvacs are right. I simply said NPC's are not coding. Yes you will need to hardcode some sort of methods, for example a quest npc, that would need to be hardcoded, or parsed from txt that runs a method which does it. NPCs (monsters that you kill) is definitively not coding.
There is little script-like engines people make, that are written and parsed from txt according to how it was written and loaded in the language its self.
But i was referring to James as he always talks about how he "coded" npcs when im guessing it was just some txt spawns.
Fsockopen is also correct, an npc that needs to calculate player values + some luck (tc artisan for example) would usually a Boolean formula. But even that NPC wouldent be running the thread for updating that. Clicking him would hand it over to UpgradeWindow handler.
If it was a script-engine for example
Npc333
START=ShowUpgradeWindow();
Or something like that, youd be limited to what you can use, and wouldent even understand how the methods work behind it, ur simply telling something to run something that you have to use. The script-engine designer would be the "coder" and the person doing the .txt would be more of a scripter.
Even a script-engine with very C#-like syntax would be very limited to what it can do, it wouldn't be able to use constructors, keywords, library, would not be able to communicate with any of the classes unless it was a very advanced script-engine which i don't see the point of even making because if you need to use things like constructors/keywords and other library then you might as well just code in C# and do it in a class.
Sorry if i didn't explain that well, but most people should understand.
i wasnt talking about npc spawns or monsters spawns moron also ive coded alot more then that now <_<
i maybe not pro like inf/korvacs/etc but i still can code lol
anywayz as for what korvacs said he said it comes down to what source ure using meaning coding the little If (NpcId == 1) NpcLink.xxx shit is coding its just RLLY simple and like i said thats over a yr ago and if ure gonna continue a pointless argument over the internet i aint even gonna reply anymore becuz its simply POINTLESS + i could careless what u think lol
-
Re: [RELEASE] My server files
I'm not arguing i am just saying that what your doing is scripting. Coding would be making the NpcLink.xxx part, ur just using whats there to use e.g scripting.
-
Re: [RELEASE] My server files
scripting - when something is interperated
coding - when something is compiled to a binary to be interperated
a simple if statment or variable assingment coded inside the .exe is coding no matter how little because it was compiled to a binary and then interperatd by the .net framework or whatever
-
Re: [RELEASE] My server files
Quote:
Originally Posted by
fsockopen
scripting - when something is interperated
coding - when something is compiled to a binary to be interperated
a simple if statment or variable assingment coded inside the .exe is coding no matter how little because it was compiled to a binary and then interperatd by the .net framework or whatever
ahh yes thats wat ive been trying 2 tell him or her the whole time but for some reason they aint smart enough 2 understand that but maybe now they will alltho i highly doubt it becuz whoever it seems like an idiot :P
-
Re: [RELEASE] My server files
can anyone help me get stamina to work on this source xD
-
Re: [RELEASE] My server files
Quote:
Originally Posted by
LegendX
can anyone help me get stamina to work on this source xD
ya i want to know this too :)
about spawning.. i found how to spawn mob's thnx for nothing xD
-
Re: [RELEASE] My server files
Put a timer on the action packet sit like foreach second you sit the stamina goes up by 20 or something.
-
Re: [RELEASE] My server files
hey can anyone tell me why when i do everything good i enter IP i tried with my IP and with hamachi IP and with Local IP when i write ID , PW it says connection with the server interrupted?
srry for my bad english
-
Re: [RELEASE] My server files
Quote:
Originally Posted by
zilvis89
hey can anyone tell me why when i do everything good i enter IP i tried with my IP and with hamachi IP and with Local IP when i write ID , PW it says connection with the server interrupted?
srry for my bad english
do you put port 9958??? :poster_ss
-
Re: [RELEASE] My server files
Quote:
Put a timer on the action packet sit like foreach second you sit the stamina goes up by 20 or something.
if you know a thing about what goes on under the hood and how a program works (aside from the code) and have studied the native windows dlls a bit, you should know that'll lead to utter disaster
if you have 100 people on, that means you have (100+x) threads running, one for each player
one timer per player for anything = not good
-
Re: [RELEASE] My server files
Quote:
Originally Posted by
fsockopen
if you know a thing about what goes on under the hood and how a program works (aside from the code) and have studied the native windows dlls a bit, you should know that'll lead to utter disaster
if you have 100 people on, that means you have (100+x) threads running, one for each player
one timer per player for anything = not good
ahh u seem to be learning fast lol where r u learning from or who's teaching u? or do u got previous experience with coding or something? :P
-
Re: [RELEASE] My server files
Does it matter? o.0 im not coding my own source so i don't need to make up perfect way's to get stamina working. Its only for LegendX ... just another member on rz =)
-
Re: [RELEASE] My server files
Also if he knew how to use a timer, he would not ask how to do it cause he would know some sort of way to get it working (even if its not the best way)
-
Re: [RELEASE] My server files
Quote:
ahh u seem to be learning fast lol where r u learning from or who's teaching u? or do u got previous experience with coding or something? :P
google's teaching me (yes'sir'e) and ive had previous knowledge of how computers work due to my research.
Quote:
Does it matter? o.0 im not coding my own source so i don't need to make up perfect way's to get stamina working. Its only for LegendX ... just another member on rz =)
yes it matters thats like telling someone the most painful way of doing something when there's a much less painful way
-
Re: [RELEASE] My server files
Then what are the alternative to timers? Thread.Sleep (apparently, that one sucks for being unaccurate)?
-
Re: [RELEASE] My server files
Never use Thread.Sleep because that stops every thread from running. Causes 100% CPU Usage and will freeze the entire server.
-
Re: [RELEASE] My server files
Then what should be used in multithreading to cause a SINGLE thread pause (or simply a timeout that does an action)?
-
Re: [RELEASE] My server files
no, im not saying timers are bad, but limit them as much as you can;
i prefer system.threading.timer it's nice and simple.
one global timer handling all major things, it would preform a 'foreach' loop on the clients and append to all the minor things such as removing stigma, giving stam, etc.
@ Thread.Sleep
Thread.Sleep ONLY freezes the thread that it's in, for example;
Code:
Console.WriteLine("Hello");
new Thread(new ThreadStart(
delegate()
{
Thread.Sleep(1000);
Console.WriteLine("Goodbye");
}
)).Start();
Console.WriteLine("I have to go bye!");
// output:
// Hello
// I have to go bye!
// Goodbye
-
Re: [RELEASE] My server files
Quote:
Originally Posted by
fsockopen
no, im not saying timers are bad, but limit them as much as you can;
i prefer system.threading.timer it's nice and simple.
one global timer handling all major things, it would preform a 'foreach' loop on the clients and append to all the minor things such as removing stigma, giving stam, etc.
@ Thread.Sleep
Thread.Sleep ONLY freezes the thread that it's in, for example;
Code:
Console.WriteLine("Hello");
new Thread(new ThreadStart(
delegate()
{
Thread.Sleep(1000);
Console.WriteLine("Goodbye");
}
)).Start();
Console.WriteLine("I have to go bye!");
// output:
// Hello
// I have to go bye!
// Goodbye
Thanks for answering.
I'll stick with timers for creating an AuthServer (socket check routine) as it seems to run smoother. I've seen somewhere that Thread.Sleep cause a large CPU usage (as you said xEnt) and that any other alternative possible should be used.
-
Re: [RELEASE] My server files
don't use Thread.Sleep, do this
Code:
public static void Sleep(DateTime Time)
{
while (Time > DateTime.Now)
Thread.Sleep(1);
}
what's your MSN? I can probably help you with more.
-
Re: [RELEASE] My server files
Quote:
Originally Posted by
fsockopen
google's teaching me (yes'sir'e) and ive had previous knowledge of how computers work due to my research.
yes it matters thats like telling someone the most painful way of doing something when there's a much less painful way
nice yea google can be ure best friend at times lol :P
-
Re: [RELEASE] My server files
Quote:
Originally Posted by
fsockopen
Don't use Thread.Sleep, do this; (THIS IS FROM C++ UNTESTED IN C#) what's your MSN? I can probably help you with more.
Code:
public static void Sleep(DateTime Time)
{
while (Time > DateTime.Now)
Thread.Sleep(1);
}
I adapted it for C#, it must work >.<
Code:
public static void Sleep(int millisecondsTimeout)
{
DateTime Time = DateTime.Now.AddMilliseconds(millisecondsTimeout);
while (Time > DateTime.Now)
{
// In C#, nothing is needed to do a while loop
}
}
Here is my routine to check the packets
Code:
// Start Check monitor - Check every 3 seconds
Timer state_monitor = new Timer(StateCheck, null, 0, 3000);
// ----------------------
private void StateCheck(object data)
{
try
{
Monitor.Enter(StateObjects);
for (int a = 0; a < StateObjects.Length; a++)
{
if (StateObjects[a].ID == -1 && (StateObjects[a].Connected == true || StateObjects[a].StateSocket != null))
{
DestroyState(StateObjects[a]);
continue;
}
if (StateObjects[a].StateSocket != null && StateObjects[a].TimeStamp.AddSeconds(30) < DateTime.Now)
{
StateObjects[a].StateSocket.BeginDisconnect(false, new AsyncCallback(Disconnect), StateObjects[a]);
Console.WriteLine(StateObjects[a].StateSocket.RemoteEndPoint + "/ID:" + a + " has been disconnected due to the 30 seconds timeout.");
continue;
}
}
Monitor.Exit(StateObjects);
}
catch (Exception e)
{
Console.Beep();
Console.WriteLine("CRITICAL ERROR IN StateCheck()!!!\n" + e.ToString());
}
}
As you can see, the timer is far more adapted than doing a while loop with Thread.Sleep(3000);
-
Re: [RELEASE] My server files
Your point is, just because you have your own way of doing timers (system.threading.timer) that isn't the main scripts that cause disaster. People have there own way of doing things. There are alot more things in issue here, sockets, packet structure, memory Its a bit like the people that say C# could'nt be anything as good as c++ simply the main reason being c# is managed memory and c++ isn't, i think infamous proved them wrong =).
Maybe that system.threading.timer is alot better, System.timers ill use, prolly use DateTime i dunno iv allready quit conquer xD.