Active Player Pool System

Started by Bue, Mar 13, 2013, 01:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Soulman

Could be somewhat useful to server owners, but I doubt that it's in much demand, and therefore I doubt you will get a lot of support for this project.

Bue

#16
Quote from: Triper on Mar 15, 2013, 11:39 AM
I just dunno if it will be enough to be better then the RO map+where players are system.

They're two separate systems; this one mainly keeps track of active account IDs, which I dubbed active player pooling.

Quote from: Soulman on Mar 15, 2013, 07:14 PM
Could be somewhat useful to server owners, but I doubt that it's in much demand, and therefore I doubt you will get a lot of support for this project.

I don't expect inexperience server owners to understand the importance of managing active account IDs.

Mathematically, you can think of an account ID as a player and that the active player pool as a set of players.

If you're a computer scientist, you'll know immediately what I am talking about; set theory. Using set theory, you can at least apply some mathematical logic and theory to develop very complex systems and algorithms.

For example, take a look at a guild tournament match, you can picture this as a mutually disjointed set with two (or more) partitions, one for guild X and the other for guild Y, so by definition, any guild member in guild X cannot be in guild Y during the tournament match, but of course, this can never happen since you can only be a guild member of one guild.

Now, say that the tournament allows alliance guild members to participate together since there aren't enough members for each guild individually. In this case, you can picture all the guild members within an alliance as one set, but the problem is that one guild might be ally to both guild X and Y, thus violating the rule that any guild member in guild X cannot be in guild Y during the tournament match (and vice versa) since the alliance guild is union with both guilds.


==========================================

Now if you look at the active player pool system; you can use set theory to define subsets such as event, party, guild, and quest player groups, enforce rules between each subset, and handle only specific subsets of players.

The magic about all of this is that using account IDs, ALL the information you need to know about any player can be taken from the MySQL tables AND you can attach ANY script to ANY player or subset.  /no1

Spoiler
*query_sql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
*query_logsql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});

Executes an SQL query. A 'select' query can fill array variables with up to 128 rows of values,
and will return the number of rows (i.e. array size).

Note that 'query_sql' runs on the main database while 'query_logsql' runs on the log database.

Example:
set @nb, query_sql("select name,fame from `char` ORDER BY fame DESC LIMIT 5", @name$, @fame);
mes "Hall Of Fame: TOP5";
mes "1."+@name$[0]+"("+@fame[0]+")"; // Will return a person with the biggest fame value.
mes "2."+@name$[1]+"("+@fame[1]+")";
mes "3."+@name$[2]+"("+@fame[2]+")";
mes "4."+@name$[3]+"("+@fame[3]+")";
mes "5."+@name$[4]+"("+@fame[4]+")";
[close]


Spoiler
*attachrid(<account ID>)
*detachrid;

These commands allow the manipulation of the script's currently attached player.
While attachrid allows attaching of a different player by using it's account id
for the parameter rid, detachrid makes the following commands run, as if the
script was never invoked by a player.

In case, that the player cannot be attached, such as, when the player went
offline in the mean time, attachrid returns 0, otherwise 1.
[close]

==========================================

This idea is practically a wet dream for any script developer, since it provides a viable way to group players together rather than setting a boolean variable or running the player through a series of if conditions to verify if they are such and such.

Furthermore, you can organize these account IDs using ANY data structure that fits your needs; whether its a queue for a an event or a heap for a tournament tree.

/nerdorgasm

Axiom

Quote from: Soulman on Mar 15, 2013, 07:14 PM
Could be somewhat useful to server owners, but I doubt that it's in much demand, and therefore I doubt you will get a lot of support for this project.

The way I see things is free new custom scripts are in high demand regardless of what they are. When you think about it (or pay attention to eAthena/rAthena's boards), you'll see there are very rarely any new content. This particular idea opens the way for several other ideas so I'm all for having it.

Chu! Ragnarok Online - Your world, your way.

Klassione

Quote from: Axiom on Mar 17, 2013, 01:19 AM
The way I see things is free new custom scripts are in high demand regardless of what they are. When you think about it (or pay attention to eAthena/rAthena's boards), you'll see there are very rarely any new content. This particular idea opens the way for several other ideas so I'm all for having it.

Agreed.

Bue

#19
A quick demonstration of one key point; attachrid + active player pool.

Obviously, there are a good number of things wrong with the script at the moment. And currently, I'm trying to figured out a good solution on how to display relevant information and a good data structure for fast searching and easy iteration. I'll post more stuff soon to demonstrate other concepts that we've discussed.

Currently, this script inserts players into the pool and allows you to send a message to the guild chat to every player in the pool.

// Initialize the active player pool
function script app_initialpool {
set $@app_base$,"$@ACTIVEPOOL";
set $@party_prefix$,"_PARTY";
set $@guild_prefix$,"_GUILD";
set $@event_prefix$,"_EVENT";

set $@appseries,0; // First array series
set $@appcurrent,0; // APP Size
set $@appsize,128; // APP Array Size
for(set .x,0; .x < $@appsize; set .x,.x+1) { // Initialize APP Array with 0s
setd $@app_base$+$@appseries,0;
}
return;
}

// Expand the active player pool
function script app_expandpool {
set $@appseries,$@appseries+1; // Next array series
set $@appcurrent,0; // Reset APP Size
for(set .x,0; .x < $@appsize; set .x,.x+1) { // Initialize APP Array with 0s
setd $@app_base$+$@appseries,0;
}
return;
}

// Display the current active player pool
function script app_displaypool {
for(set .y,0; .y <= $@appseries; set .y,.y+1) {
for(set .x,0; .x < $@appcurrent; set .x,.x+1) {
npctalk "[Series " + .y +" Current " + .x+ "] " + rid2name(getd($@app_base$+.y+"["+.x+"]"));
}
}
return;
}

// Insert active player into the pool
function script app_addplayer {
if($@appcurrent >= $@appsize) {
callfunc "app_expandpool";
callfunc "app_addplayer";
} else {
setd $@app_base$+$@appseries+"["+$@appcurrent+"]", getcharid(3);
announce "Active Player Pool Activated: " + rid2name(getd($@app_base$+$@appseries+"["+$@appcurrent+"]")) + ".",bc_self;
set $@appcurrent, $@appcurrent + 1;
}
return;
}

prontera,156,173,4 script app_main 123,{
switch(select("Enter Active Player Pool","Display Active Player Pool")) {
case 1: callfunc "app_addplayer"; break;
case 2: callfunc "app_displaypool"; break;
default: npctalk "Invalid selection."; break;
}
close;

OnWhisperGlobal:
/* APP Command Block */
// See the explanation on how the whisper system works.
// Commands should be delimited by #, make sure everything is 'checked'



/* APP Chat Block */
set .whisperchat$,@whispervar0$;
set .whispername$,rid2name(getcharid(3));

// Attach everyone in APP to the current script
for(set .y,0; .y <= $@appseries; set .y,.y+1) {
for(set .x,0; .x < $@appcurrent; set .x,.x+1) {
attachrid(getd($@app_base$+.y+"["+.x+"]"));
dispbottom "[Chatroom " + .whispername$ + "]: " + .whisperchat$;
// Don't detachrid unless the next few processes shouldn't be
// run for the player. Let the remaining script handle clean up
}
}
end;

OnInit:
callfunc "app_initialpool";
end;
}

Cawliflower

I've already done multiple systems like this in my past servers and on the current. At least the RO community will benefit off of this. This does help server owners gather data and analyze the community. However, most server owners aren't competent anyway.
Quoteyesterday im ask gm crewkie hitler for pls ad balance costum like angel wing or 4slot narutaro BUT HE SAY NO.. um sry i thot this was ranganarok and not a nazis???????

DivinityRO 6.9 coming soon!