[Development] 4267 conquer server.

03/08/2010 14:26 Nullable#196
Quote:
Originally Posted by ChingChong23 View Post
@Viscount S: i understand that you guys wish to keep memory usage low, but you wouldn't even sacrifice a couple of mb's at max (and not even that much if done correctly) of memory for a much better structure? Memory in this situation should not even be considered. For example you saying Millions of Dialog instances can be created, while that is possible if someone decided to spam a million packets to talk to an NPC, and that's even if you have not handled it to even have a delay or check if he's already interacting with an NPC, then yes. But that's not going to happen?

@CptSky: sorry, i don't know much about .net and/or it's collections but you get the point.
I get fussy about memory issues. Just because the GC handles memory compaction, that means that we should not care about memory and performance.
Also a switch statement isn't a series of if elses, it is more of a goto table:
Code:
switch(VAL)
{
goto case<VAL>;
 case 0:
 // code gets executed.
 goto END;
 case 1:
 //code gets executed
 goto END;
}
END:
03/08/2010 17:39 ImmuneOne#197
Quote:
Originally Posted by ChingChong23 View Post
@Viscount S: i understand that you guys wish to keep memory usage low, but you wouldn't even sacrifice a couple of mb's at max (and not even that much if done correctly) of memory for a much better structure? Memory in this situation should not even be considered. For example you saying Millions of Dialog instances can be created, while that is possible if someone decided to spam a million packets to talk to an NPC, and that's even if you have not handled it to even have a delay or check if he's already interacting with an NPC, then yes. But that's not going to happen?

@CptSky: sorry, i don't know much about .net and/or it's collections but you get the point.
Do you even understand the concept of memory usage and how it works with creating new instances and switch statements?
03/08/2010 17:59 zenos#198
i don't understand a crap of what you guys are talking about, but just keep up the good work :P, and can someone tell me how far the progress of the server is in %? tnx ;)
03/08/2010 19:47 ImmuneOne#199
Clear progress and plans on CPX;

Is the source ready yet?
We're basicly far enough to launch a beta, we're just fixing up little things.

How long will the beta last?
Till the summer.

What will happen then?
We will switch to native C++ instead.

How long will that take?
We have already done the dataserver and the defender. I'm currently working on the webserver with own scripting language; Current progress:
[Script]

Only thing left is the source.
03/09/2010 00:40 Viscount S#200
Quote:
Originally Posted by ChingChong23 View Post
@Viscount S: i understand that you guys wish to keep memory usage low, but you wouldn't even sacrifice a couple of mb's at max (and not even that much if done correctly) of memory for a much better structure? Memory in this situation should not even be considered. For example you saying Millions of Dialog instances can be created, while that is possible if someone decided to spam a million packets to talk to an NPC, and that's even if you have not handled it to even have a delay or check if he's already interacting with an NPC, then yes. But that's not going to happen?
I agree, there are better ways to approach the handling of NPCs, but the memory footprint of each class and its counterparts can play a key role in a server's stability. I will cede that memory usage shouldn't be an issue at the moment (because we all know premature optimization is the root of all evil), and sometimes object creation is more appropriate to create objects to enhance clarity or for simplicity. But it can also be expensive, which is the point I am trying to convey. My point is not memory usage or the garbage collector, but it can effect speed drastically.

I assume you have a background in Java, therefore I'll provide this example from Effective Java by Joshua Bloch:
Item 5: Avoid creating unnecessary objects
Code:
// Hideously slow program! Can you spot the object creation?
public static void main(String[] args) {
    Long sum = 0L;
    for (long i = 0; i <= Integer.MAX_VALUE; i++) {
        sum += i;
    }
    System.out.println(sum);
}
"Changing the declaration of sum from Long to long reduces the runtime from 43 seconds to 6.8 seconds on my machine."

It is considered good practice to treat your code as if it were a public API, especially now that you have released it. You don't know how that code will be used, anything could happen, even if it's accidental. The code above could be chalked up to a typographical error.
03/09/2010 03:31 _tao4229_#201
Quote:
Originally Posted by Nullable View Post
I get fussy about memory issues. Just because the GC handles memory compaction, that means that we should not care about memory and performance.
Also a switch statement isn't a series of if elses, it is more of a goto table:
Code:
switch(VAL)
{
goto case<VAL>;
 case 0:
 // code gets executed.
 goto END;
 case 1:
 //code gets executed
 goto END;
}
END:
It's more like a table of offsets and it has to "if check" to find the right one.
You can't just "goto" a case value if you don't know where it is.

Kindof a combination of both.
03/09/2010 04:47 ~*|Limbo|*~#202
Quote:
Originally Posted by ImmuneOne View Post
Clear progress and plans on CPX;

Is the source ready yet?
We're basicly far enough to launch a beta, we're just fixing up little things.

How long will the beta last?
Till the summer.

What will happen then?
We will switch to native C++ instead.

How long will that take?
We have already done the dataserver and the defender. I'm currently working on the webserver with own scripting language; Current progress:
[Script]

Only thing left is the source.
Sounds great I really do hope that the server lasts longer than Conquecide did :/ That server ended up shutting down due to lack of interest I believe but anyways like any 1.0 server ran by a good coder i'll be following this forum thread till the server beta is up :) Hope to see it soon, you guys seem determined and know what your doing so it makes a change, also glad it's going lvling server.

Regards,

Limbo.
03/09/2010 07:32 ChingChong23#203
Quote:
Originally Posted by Viscount S View Post
I agree, there are better ways to approach the handling of NPCs, but the memory footprint of each class and its counterparts can play a key role in a server's stability. I will cede that memory usage shouldn't be an issue at the moment (because we all know premature optimization is the root of all evil), and sometimes object creation is more appropriate to create objects to enhance clarity or for simplicity. But it can also be expensive, which is the point I am trying to convey. My point is not memory usage or the garbage collector, but it can effect speed drastically.

I assume you have a background in Java, therefore I'll provide this example from Effective Java by Joshua Bloch:
Item 5: Avoid creating unnecessary objects
Code:
// Hideously slow program! Can you spot the object creation?
public static void main(String[] args) {
    Long sum = 0L;
    for (long i = 0; i <= Integer.MAX_VALUE; i++) {
        sum += i;
    }
    System.out.println(sum);
}
"Changing the declaration of sum from Long to long reduces the runtime from 43 seconds to 6.8 seconds on my machine."

It is considered good practice to treat your code as if it were a public API, especially now that you have released it. You don't know how that code will be used, anything could happen, even if it's accidental. The code above could be chalked up to a typographical error.
I completely understand where your coming from, since I've proven memory is not an issue ill go on speed. I would not suggest using this if it was going to get called several thousands of times a second, but lets estimate how many of these objects would be created on a server been online for a week. ill estimate 1000 NPC interactions (and yes this is more than people would do) lets say they click 3 options, theres 3k dialog instances created. On my computer running this code

Code:
long curTime = System.currentTimeMillis();
	    Long sum = 0L;
	    for (long i = 0; i <= 5000; i++) {
	        sum += i;
	    }
	    System.out.println("Finished: " + (System.currentTimeMillis() - curTime));
Running this code takes 1millisecond, running it using long takes 0 milliseconds. Your not willing to drop a few milliseconds over your entire server time for a better structure?

I also like the amount of knowledge in this topic, don't see much of it on epvp.
03/09/2010 09:03 fishey07#204
So just wondering guys, Do you have a site where I can check to see updates and such?
03/09/2010 09:11 Korvacs#205
Quote:
Originally Posted by ChingChong23 View Post
I completely understand where your coming from, since I've proven memory is not an issue ill go on speed. I would not suggest using this if it was going to get called several thousands of times a second, but lets estimate how many of these objects would be created on a server been online for a week. ill estimate 1000 NPC interactions (and yes this is more than people would do) lets say they click 3 options, theres 3k dialog instances created. On my computer running this code

Code:
long curTime = System.currentTimeMillis();
	    Long sum = 0L;
	    for (long i = 0; i <= 5000; i++) {
	        sum += i;
	    }
	    System.out.println("Finished: " + (System.currentTimeMillis() - curTime));
Running this code takes 1millisecond, running it using long takes 0 milliseconds. Your not willing to drop a few milliseconds over your entire server time for a better structure?

I also like the amount of knowledge in this topic, don't see much of it on epvp.
Just try to keep in mind the fact that each programmer has their own style, and that he likes to do things a certain way, just like you like to do things a certain way, he doesnt have to drop a few milliseconds if he doesnt want to.

You have made your arguement, leave it at that, your starting to sound slightly pushy about it.
03/09/2010 10:49 ChingChong23#206
Sorry i didn't mean to sound pushy if it came off like that, this is constructive criticism/advice.
03/09/2010 15:54 zenos#207
Quote:
Originally Posted by ImmuneOne View Post
Clear progress and plans on CPX;

Is the source ready yet?
We're basicly far enough to launch a beta, we're just fixing up little things.

How long will the beta last?
Till the summer.

What will happen then?
We will switch to native C++ instead.

How long will that take?
We have already done the dataserver and the defender. I'm currently working on the webserver with own scripting language; Current progress:
[Script]

Only thing left is the source.


tnx for going back to things i understand :P
03/10/2010 00:03 ImFlamedCOD#208
Quote:
Running this code takes 1millisecond, running it using long takes 0 milliseconds. Your not willing to drop a few milliseconds over your entire server time for a better structure?

I also like the amount of knowledge in this topic, don't see much of it on epvp.
This is all nice theory I have to say if you want 100% accuarate information use a Nano Second wrapper. I use a wrapper I found on the internet with some modified code and it works well for accurate timing 1/billionth of a second :).

"A nanosecond is equal to 1000 picoseconds or 1/1000 microsecond. Because the next SI unit is 1000 times larger, times of 10-8 and 10-7 seconds are typically expressed as tens or hundreds of nanoseconds." Wiki

Link :Nanosecond - Wikipedia, the free encyclopedia
03/10/2010 00:22 Viscount S#209
Quote:
Originally Posted by ImFlamedCOD View Post
...
Correct. Measuring how long some code takes to execute can be accomplished more precisely so by utilizing [Only registered and activated users can see links. Click Here To Register...], and this method is only there to measure elapsed time in Java. Although, I trust that ChingChong23's results are accurate enough to make his/her point clear. But as Korvacs pointed out, we all have our own style, so perhaps we can agree to disagree.
03/10/2010 15:54 ImmuneOne#210
What would be acccurate chances for upgrading with meteors and dragonballs?.