Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   Levellist (https://forums.graalonline.com/forums/showthread.php?t=39903)

Com013 11-02-2002 10:38 PM

Levellist
 
It would help me if there was a list of levels I can access serverside. I'd need the variables levelscount and #L(...) to randomly place NPCs in certain levels (or to refill the fishrate).
#L(...) should be sorted alphabetically and #L(0) should not be the same as #L, but the first level in the order.
Then I could do something like this:
NPC Code:

if (created) {
timeout = 5;
}
if (timeout) {
if (level.fishrate < level.maxfishrate) level.fishrate+=0.1;
this.nextlevel= (this.nextlevel+1)%levelscount;
warpto #L(this.nextlevel),0,0;
}


Falcor 11-03-2002 01:46 AM

If the NPCs server level list was optomised it could be useful, but right now every level you ever put on the server, even if you took it off, is on the level list... so eventually you'd get a level that doesn't exsists. *shrugs*... I don't see why you'd really need it though, I'm sure there are other ways, maybe even more efficient ways of doing what you want.

Dach 11-03-2002 03:50 AM

Thats a pretty good idea, aslong as the levellist is up to date and all that. Are there any other ways to do this, other than using a string list of all the levels you'd need? Considering that there would be atleast a couple hundred indecies just for levels w/ fish, that wouldn't be very efficient at all...

Com013 11-03-2002 04:24 PM

Quote:

Originally posted by Falcor
If the NPCs server level list was optomised it could be useful, but right now every level you ever put on the server, even if you took it off, is on the level list... so eventually you'd get a level that doesn't exsists.
Yes, that mustn't happen.
Quote:

*shrugs*... I don't see why you'd really need it though, I'm sure there are other ways, maybe even more efficient ways of doing what you want.
No. At least not more efficient ways. Currently on Classic the normal fish (fishrate) are refilled every time you enter the level. But only local (since we have no level. vars without an NPC Server). This is not good...fish should refill slowly and not depending on when a player entered the level.
And then there are the pets of Classic: fighting fish. Currently they are placed randomly when the player entered the level. Again, I don't like that it depends on when a player entered. Currently it is possible to cheat by standing at the border of two levels and pressing two keys at once, so you warp between the two levels very often. Before I wrote a fix for it you got 20 fighting fish in each level, now I did it so you can only get one fish in a certain amount of time. But one cheated fish is one cheated fish too much.

Of course I could solve it using a string list, but imagine a stringlist containing 6000 levelnames....

Kaimetsu 11-03-2002 04:33 PM

Quote:

Originally posted by Com013

Yes, that mustn't happen.

No. At least not more efficient ways. Currently on Classic the normal fish (fishrate) are refilled every time you enter the level. But only local (since we have no level. vars without an NPC Server). This is not good...fish should refill slowly and not depending on when a player entered the level.

You could have an NPC in every level that contains fish, which monitors the amount of fish in the level and places new ones when necessary.

Com013 11-06-2002 12:52 AM

Quote:

Originally posted by Kaimetsu


You could have an NPC in every level that contains fish, which monitors the amount of fish in the level and places new ones when necessary.

Sure. And then I'll run to Stefan complaining that the NPC Server is too laggy. In each level with water a fighting fish could apear. That means in each level I need an NPC having constantly timeouts. Ok, I am thinking of 30 seconds or more for the timeout, but still, the NPC server would have to control the timeouts of 3000 NPCs.

And do you think I want to add the NPCs to all those levels? Of course, I could try to make the script converter place them, but the poor program has enough work to do. (Or more to the fact: the poor programmer).

Kaimetsu 11-06-2002 12:43 PM

Quote:

Originally posted by Com013

Sure. And then I'll run to Stefan complaining that the NPC Server is too laggy. In each level with water a fighting fish could apear. That means in each level I need an NPC having constantly timeouts.

Sure, if you wanna tackle the problem in a stupid way. Instead of repeatedly sampling a random number, why not use the Poisson distribution to predict the average time to next spawn and then apply a standard deviation to that? Then simply set timeout to that new quasi-random time and spawn the fish when the period has elapsed.

Com013 11-07-2002 03:19 AM

Quote:

Originally posted by Kaimetsu


Sure, if you wanna tackle the problem in a stupid way. Instead of repeatedly sampling a random number, why not use the Poisson distribution to predict the average time to next spawn and then apply a standard deviation to that? Then simply set timeout to that new quasi-random time and spawn the fish when the period has elapsed.

Of course I did not intend something like this:
NPC Code:

if (created) {
timeout = 0.1;
}
if (timeout) {
if (random(0,1000)<0.5) // put fish
timeout = 0.1;
}


I was thinking of something like this:
NPC Code:

if (created) {
timeout = 120;
}
if (timeout) {
if (level.fishrate < level.maxfishrate) {
level.fishrate = level.fishrate*1.2+0.05;
if (level.fishrate > level.maxfishrate) level.fishrate = level.maxfishrate;
}
timeout = 120;
}


But still...the NPC Server would have to keep record of timeouts in
2000 levels or so.
And I'd have to add this NPC to all of this levels.

Tyhm 11-07-2002 04:10 AM

I think Kai meant have one NPC that sends a fish to each level listed...or something, somehow.

Terrible how all the NPCServ people look down on Classic people for not having a year or so experience

Spark910 11-07-2002 04:14 AM

Who care, you will leanr new stuff. And you will probably end up being better than everyone else, maybe!

Kaimetsu 11-07-2002 09:16 AM

Quote:

Originally posted by Com013

But still...the NPC Server would have to keep record of timeouts in
2000 levels or so.
And I'd have to add this NPC to all of this levels.

Okay, here: Every time a fish dies, it sends a trigger to the server. The server then replaces it, possibly with a delay for realism. Then the only problem is the actual placing of the fish in the first place, and easy ways could be concocted to handle that. For example, something in the CNPC could trigger the server every time it enters a suitable level. If the server agrees that the level is fine for fish then it places some there. Then the workload is spread according to the activities of the players, and perhaps levels that don't get many visitors could empty out their fish after a while to reduce server load.

Question, though: What do these fish do? If you're worried about timeouts then how are you going to make them do anything other than float on the water's surface and do nothing?

Quote:

Originally posted by Tyhm
Terrible how all the NPCServ people look down on Classic people for not having a year or so experience
Not at all, my suggestion had nothing to do with exclusively-serverside stuff. It was just maths, y'know?

Com013 11-07-2002 11:44 PM

Quote:

Originally posted by Kaimetsu
Question, though: What do these fish do? If you're worried about timeouts then how are you going to make them do anything other than float on the water's surface and do nothing?
There are two types of fish on The Adv.:
  • the normal fish which are just represented by the variable "level.fishrate". This variable controls how fast you can get a normal fish using your fishing rod.
  • the Fighting Fish which are actually NPCs which are moving around and fight against each other. They are very rare and sometimes apearing the water.


Quote:

Originally posted by Falcor
I'm sure there are other ways, maybe even more efficient ways of doing what you want.
Ok, I think I've found the optimal way now:
I'll save how much time has past since the last time the level was refilled. This time will be used for calculating the current increase/chance. Something like this: (the used numbers are just examples. I have to calculate better values)
NPC Code:

if (actionserverside)
{
if (level.lastrefill == 0) level.lastrefill = timevar;
passedtime = timevar - level.lastrefill;
if (level.fishrate < level.maxfishrate)
{
if (level.fishrate <= 0) level.fishrate = 0.05;
level.fishrate = level.fishrate * (1.1^passedtime);
if (level.fishrate > level.maxfishrate) level.fishrate = level.maxfishrate;
}
chance = 1-(0.99^passedtime);
if (chance > random(0,1))
{
// put fighting fish
}

level.lastrefill = timevar;
}
//#CLIENTSIDE
if (playerenters)
{
triggeraction 0,0,serverside,-FishRefill;
}


Jeff 11-08-2002 01:03 AM

Note to Com:

Fish system on Classic Dev NPC server, working at this very moment on the client interface to the probability system.


EDIT: Serverside part of pole in NPC weapon "Unhackable Fish System" and controller NPC in DBNPC "Fish-Control"

Com013 11-08-2002 03:53 AM

Quote:

Originally posted by Jeff
Note to Com:

Fish system on Classic Dev NPC server, working at this very moment on the client interface to the probability system.


EDIT: Serverside part of pole in NPC weapon "Unhackable Fish System" and controller NPC in DBNPC "Fish-Control"

Argh...I looked at your NPC and...better use my version. (And my version is already working fine with the fishing rod and so on...I don't want to rescript that again).
Using a stringlist of all the levels with fish inside them? Er...I guess we'd nuke the limit of the string size sooner or later.


All times are GMT +2. The time now is 10:53 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.