Jump to content

Recommended Posts

Posted

please be more polite....

 

and what means last shared? which revision it is

i'm trying, but can't since i find only ppl like u.

and like this one................|

......................................v

 

aCis project site is dead for now.

 

as i said in few posts here, befor being stupid, please convince urself.

 

http://www.downforeveryoneorjustme.com/acis.i-live.eu

Posted
Changeset 257

 

General tasks, misc (ty ipxs for some reports)

 

General tasks - ty jurchiks for the idea

- following tasks are now handled by a unique task rather than using one task per player : PvpFlagTask, WaterTask && TakeBreakTask.

- those tasks use a Map in order to stock individual timers.

- for 100 players, 100 TakeBreakTask were created, and as much tasks if (let's say) those 100 players are pvping (+100) under water (+100) = potentially 300 tasks. Now only 3 tasks are running, no matter how many ppl are online.

 

Misc

- add the Teleportation Cubic exit section for Baium (supposed to be handled in another script, moved in GrandBossTeleporters).

- you aren't flagged anymore casting positive effects on guards (both siege and regular).

- fix castlewarehouse && castleblacksmith "busy" HTM, and add a clan right check for blacksmith (+ cleanup for both instances).

- fix Pa'agrio's Fist (must restore 100% CP, not simply 800).

- fix Fatal Counter (based on your own HPs, not enemies' + formula rework) - ty Duma. getPower() method loses one parameter.

- singletons on PetitionManager && AutoSpawnHandler

- revert some ArrayLists for FastList (fix concurrentException errors on sieges)

Posted

just to offtopic a bit:

General tasks - ty jurchiks for the idea

  - following tasks are now handled by a unique task rather than using one task per player : PvpFlagTask, WaterTask && TakeBreakTask.

  - those tasks use a Map in order to stock individual timers.

thats a great idea, but you should sort eachtime you add a value at PvpFlagTask map (not for TakeBreak, because they all have the same time [do they?], so is a queue) but for PvpFlag you have different times, if he hit a flaged person he has less flag time (is that true or just some l2j-custom add) so is not a simple queue, and you need to sort a map after each insertion. So i suggest you (if what i said was not wrong) to create 2 types of PvpFlagTask, one for people that hit flaged ppl, so has less time, and other for others, or something like that.

 

PS: WaterTask, is the task that make you dmg, when you are underwhater after a time? it may also have two types, ppl with and without kiss of eva

 

Maybe what im saying is completly wrong, but if not it may help you

Posted

...

Hey Adenaman, before commiting it I tested (on a little scale, but was working for 2 ppls in same time), there is no issues with my system. As it's a Map you simply have to ADD (register the same player once again), and if it already exists, it will simply UPDATE the existing value. That's a internal property of Map.

 

It's really simple and in same time powerful, and it avoids a lot of checks.

 

Understand if someone got a "pvptask" in process and it blinks (end of timer soon) and you re-hit a white target, system simply update time in Map for the L2PcInstance you registered (if already existing) or add a new line.

 

Finally for water task, the time registered in the Map is exactly calculated like before. After a certain a-beep-t of time, you begin to lose HPs. Moving out of water drop the line talking of L2PcInstance from the Map, and so he isn't affected anymore.

 

For more infos, simply check AttackStanceTaskManager system. What I did is more or less a copy paste with few changes depending of each case. For reminder, attack stances affect every character ingame (combat->normal stance timer), and no one never complains about that system.

 

PS, as it's perhaps not clear : you can add whatever time you want. All tasks are repeating, but TakeBreak is a cyclic 720000ms task, when others are 1000ms tasks. Every sec, it loops on the map and affect all registered ppl on it. For a pvptask, you can add either current system time + 15000 / +30000 / +whatever depening of chronicle.

 

PS2 : it means too the system must care to delete lines on Maps when player d/c.

Posted

Hey Adenaman, before commiting it I tested (on a little scale, but was working for 2 ppls in same time), there is no issues with my system. As it's a Map you simply have to ADD (register the same player once again), and if it already exists, it will simply UPDATE the existing value. That's a internal property of Map.

 

It's really simple and in same time powerful, and it avoids a lot of checks.

 

Understand if someone got a "pvptask" in process and it blinks (end of timer soon) and you re-hit a white target, system simply update time in Map for the L2PcInstance you registered.

 

Finally for water task, the time registered in the Map is exactly calculated like before. After a certain a-beep-t of time, you begin to lose HPs. Moving out of water drop the line talking of L2PcInstance from the Map, and so he isn't affected anymore.

 

For more infos, simply check AttackStanceTaskManager system. What I did is more or less a copy paste with few changes depending of each case. For reminder, attack stances affect every character ingame (combat->normal stance timer), and no one never complains about that system.

Oh then i think i got wrong the idea, thought that you have something like this:

<let thing that TakeBreakTask will announce every 1h form when he logs in to the player>

 

you have a queue with players - empty at start

when some1 log in, you add him at your queue and if it was empty before you start a Task in 1h (one time task)

20 min late another player logs in, so you add him at queue but do not modify the task

40 min late (1h for player A) task comes to the end waiting time and do

    - system.message.whatever."Go eat a KitKat"

    - add player A to the queue

    - program next task to the remaining time of the first playeer of the queue (player B) 20 min

20 min late (1h for player B) task execute, and do what it did before

 

This was mine idea, you avoid sorting the map every time that you insert/ or whatever and the task is not executed each 1 sec, only when its needed

Posted

You still continue to think as an "individual task" system. The system is easy to understand : you create a repeating task with 1sec delay, and every second you check content of the map (storing both L2PcInstance and time) and make (or not) actions. The task is never affected/stopped/delayed/whatever. Which means I got 3 tasks running on background. Let's name them "daemons".

 

For looping the Map and following L2PcInstance key, you compare actual system time to registered time, and make actions individually on player which is currently looped.

 

You could say "wtf, 3 tasks running forever in background even if no one is logged", I say yup, it's rentabilized when simply 3 ppls logs and avoid to create 3 takeBreak tasks :). 1k players logged = 1k TakeBreak tasks created, if let's say 300 ppls are pvping and 50 are in water, that does 1350 tasks.

 

From 1350 tasks it goes to 3 tasks, with 3 distincts maps and data inside it : 1000 lines on one, 300 lines on second and 50 lines on third (some Ko of RAM).

Posted

You still continue to think as an "individual task" system. The system is easy to understand : you create a repeating task with 1sec delay, and every second you check content of the map (storing both L2PcInstance and time) and make (or not) actions. The task is never affected/stopped/delayed/whatever. Which means I got 3 tasks running on background. Let's name them "daemons".

 

For looping the Map and following L2PcInstance key, you compare actual system time to registered time, and make actions individually on player which is currently looped.

 

You could say "wtf, 3 tasks running forever in background even if no one is logged", I say yup, it's rentabilized when simply 3 ppls logs and avoid to create 3 takeBreak tasks :). 1k players logged = 1k TakeBreak tasks created, if let's say 300 ppls are pvping and 50 are in water, that does 1350 tasks.

 

From 1350 tasks it goes to 3 tasks, with 3 distincts maps and data inside it : 1000 lines on one, 300 lines on second and 50 lines on third (some Ko of RAM).

Well, what im saying are "individual tasks" but there is only 1 executing at a time, you create one, it ends you create another (the first one does not continue), so there is only 1 task at a time.

 

so we avoid 1 sec ticks in background that each time that they are executed they need to read the whole map that they have with played registred, compare the time of each of them, and sometimes make an action, that is a lot of cpu usage, if we compare it with my idea they rentabilize only if we have 3600 players, well not even because you read the whole map , while i just need to read the first person of the queue.

 

So, my idea uses nearly the same amount of ram than yours (you use map<L2PcInstance, long>, i use queue that it may be implemented with a List<Object> where we write it in pairs L2Pcinstance and its time [this is to avoid using other things and improve the implementation, if you want to you can use any other structure like List<NewClass> NewClass has -L2Pcinstance - long:time, but this will create more allocation because of the reference to the NewClass).

 

Well, it uses the same ram, and much much less cpu, because

-its not 1 sec tick even its not needed (a lot of cpu)

-its not iterating the whole map, only remove[0] and add/put[queue.length] so it doesnt need to get every value of the map and then compare it

 

Posted

You should trully see see how AI system is currently working for the "a lot of CPU" use :P.

 

There is no need to manage tasks stop/start, on even 300 players you got everytime one ppl registered over maps.

 

Your idea isn't possible or I didn't understand how you manage to stop and start tasks. If it's based on action of one ppl, it's pointless. If it's based on the farer registered action, how do you handle incoming actions (the ones coming before the farer) ?

 

There is no good or bad system, there is only one possible system :P.

 

You add and remove on a Map, but what's the point to feed a map if you don't exploit it at a moment ? I don't get your system at all. You have to loop over the map at a moment in case of a centralized task, else it means you create a task for anyone and that's the old system.

 

Try to code your idea :P.

Posted

coded in a moment, so it may have some errors

TakeBreakManager

private static final TIME_EACH_BREAK = 7200000; //2h
private static List<Object> queue;

private static TakeBreakManager instance;

private static ScheduledFuture<?> task;

private TakeBreakManager(){
queue = new ArrayList<Object>();
}

public static TakeBreakManager getInstance(){
if (instance == null)
	instance = new TakeBreakManager();
return instance;
}

public void addPlayer(L2PcInstance player){
queue.add(System.getTimeInMillis(), queue.length);
queue.add(player, queue.length);
if (task == null)
	start();
}

private void start(){
task = ThreadPoolManager.getInstance().scheduleGeneral(new WarnUserTakeBreak(),TIME_EACH_BREAK - (System.getTimeInMillis() - (long) queue.remove[0]) );
//that is 2h - (time that passed) - here we could just use the 2h
}

protected class WarnUserTakeBreak implements Runnable
{
@Override
public void run()
{
	final L2PcInstance player = (L2PcInstance) queue.remove[0];
	if (player.isOnline())
	{
		SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.PLAYING_FOR_LONG_TIME);
		player.sendPacket(msg);
		queue.add(System.getTimeInMillis(), queue.length);
		queue.add(player, queue.length);
	}
	if (!queue.isEmpty)
		task = ThreadPoolManager.getInstance().scheduleGeneral(new WarnUserTakeBreak(), TIME_EACH_BREAK - (System.getTimeInMillis() - (long) queue.remove[0]) );
	else
		task = null;
}
}

the only thing that is missing is to make it syncronized and add removePlayer(), but this is tha main idea

 

Edit: there is no need to create new WarnUserBreak each time, you can create it one time, save it and use it every time, but remove the final from

final L2PcInstance player = (L2PcInstance) queue.remove[0];

Posted

I believe it simply can't run :D. You're creating a task by ppl, but you add an ArrayList and an instance manager. No improvements at all.

 

The ArrayList add both L2PcInstance and int objects. No links are made between those 2 infos you're adding, so how you retrieve stuff ? An array is just a list, no keys or whatever.

 

Finally you edit the task when the task is already running, probably you will have unexpected behavior ingame.

Posted

I believe it simply can't run :D. You're creating a task by ppl, but you add an ArrayList and an instance manager. No improvements at all.

im using scheduleGeneral not scheduleGeneralAtFixedRate. That is a one time task, when it ends i create another. when new is created the old one is freed

 

The ArrayList add both L2PcInstance and int objects. No links are made between those 2 infos you're adding, so how you retrieve stuff ? An array is just a list, no keys or whatever.

because since im the one inserting i know that it will be: [time1][player1][time2][player2]...

and i remove it knowing that:

- remove (time) - calculate delay for task

- remove (player) - send message

 

Finally you edit the task when the task is already running, probably you will have unexpected behavior ingame.

what do i modify?

Posted

thats why i said that it had bo be synchronized,

synchronized(this)
queue.add(System.getTimeInMillis(), queue.length);
queue.add(player, queue.length);
if (task == null)
	start();
...
run() ...
synchronized(this){
		queue.add(System.getTimeInMillis(), queue.length);
		queue.add(player, queue.length);
}

 

I had some problems with my main pc, so now im working with my laptop, i dont have here server nor client

 

EDIT:

i made a new java project in eclipse to try this, made some tests

its usually working great

but in extreme tests (break warn each 150 milis) and 600 players, i found that sometimes i get a problem on remove the first element it is some problem of synchronization, because im trying to cancel the task and create another one and they make evil things.

But all other things are working great

 

EDIT2: Ok i found where as my main problem, atm its sometimes creating one extra task, that may be anotheer synchr problem. 5 am, time to sleep

Posted

Shouldn't it be a FastList ?

 

About aCis :

- currently working on sieges (addition of traps and gates update system via chamberlain), fixing castles gates issue appearing at door rework.

- creation of a wiki. Weeeee. A wiki. More infos when it will be parametered (I don't want hooligans destroy it lol).

 

2ibcbh0.jpg

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Posts

    • @Mobius I only asked you one question! All your previous versions are sh*t and the last version is the best ? Because this is what you said.
    • Close that LOLserver. And change name to L2Wipe&Money.
    • Open Beta January 17th & 21:00 UTC +2 Launch Date January 24th & 21:00 UTC +2 Click Here to Explore Vanilla Gracia Final Low-Rate Server. Join our Discord Community     Following the success of our Vanilla project, we decided to launch it again as Last PlayINERA’s Server! Core Settings *Vanilla will have Strict Botting & Client Limitation Rules and Chronicle Progression from Gracia Final to Gracia Epilogue to H5 in Long term! XP: x4 SP: x4 Adena: x2 Drop: x2 Spoil: x3 Manor: x0.4 (60% reduction) - Festive sweeper enabled! Seal Stones: x2 Herbs: x1 Safe Enchant: +3 Maximum Enchant: Retail Enchant Rate: Dynamic General Settings Auto-loot Can be toggled Buffs Adventurer Guide buffs are free, retail level limit removed. Buff Slots: 20 (+ 4) Summon buffs will remain on re-summoning & on death while Noblesse blessing is applied! (Olympiad excluded) Pet buffs will be saved on relog but not during summon/unsummon. Event Buffer [NEW] Event Buffer is enabled and will spawn randomly between 18:00 ~ 23:00 in Giran for 10 minutes, it will apply Farm Only buffs that are cancelled in PvP, Siege / Epic PvP zones & while in a chaotic state! Duration: 1-hour! Territory Wars every two weeks on Saturday. Castle sieges every two weeks on Sunday Class Transfer 1st Class Transfer: Available for purchase with either Adena or iCoin 2nd Class Transfer: Available for purchase with either Adena or iCoin 3rd Class Transfer: Quest or iCoin (the 3rd class transfer will become available for purchase with iCoin as soon as someone has entered the Hall of Fame for completing the 3rd class transfer quest for the class in question) Hellbound Hellbound Lv. 0-6: ATOD x1 Hellbound Lv. 7-12: ATOD x2 Tiat & Ekimus will become available at Stage 12 Hellbound can only be leveled up by killing monsters. No quests or raids are needed To open Hellbound, a party must kill Baylor in the Crystal Caverns The following items are now tradable: Ancient Tome of the Demon  Hidden First Page  Hidden Second Page  Demon Contract Fragment INERA Hub Library Clan Recruitment System Options Services Milestone Rewards Earn rewards for reaching various daily/one-time goals Client Limit: 1 (+1 with Standard Premium) Shift + Click Information on Monsters SP are required to learn new skills Offline shops Lasts for 15 days Olympiad Olympiad period: 1st and 15th day of the month (14th & Last day of month is the last day) 3 Vs. 3 match disabled Class-based matches will be held over the weekends One registration per HWID (PC) Minimum participants: 9 Party Matching System Earn bonuses for finding a group via the Party Matching system Vote Reward System World Chat No limits for first day! Available from level 20 Raid Bosses Epic Raid Boss zones will turn into a PvP zone while the Epic Raid Boss is alive ( + means Random) Server will start with all grand raids dead. Normal Raids: 12h (+6 hours random). Subclass raids, respawn 12h (+6 hours random). Noblesse Barakiel 12h (+6 hours random, PvP zone). Anakim & Lilith are static 24 hours respawn. Queen Ant: 24 hours (+2 hours random). Core: 40 hours (+2 hours random). Orfen: 32 hours (+2 hours random). Antharas Respawn: 8 Days. Randomly spawns at 19:00 ~ 21:00 Boosted to level 83 on Hellbound stage 7. Valakas Respawn: 10 Days. Randomly spawns at 19:00 ~ 21:00 Baium Respawn: 5 Days. Randomly spawns at 21:00 ~ 23:00 Boosted to level 83 on Hellbound stage 7. Frintezza Respawn: 2 Days. Randomly spawns at 21:00 ~ 23:00 Instanced Zaken Zaken (Day): Monday, Wednesday, Friday at 6:30. Zaken (Day): 9 players, LvL 55-65, 1hr max. Zaken (Night): Wednesday at 6:30 Zaken (Night): 18-45 players, LvL 55-65, 6hr max. Tiat: Saturday at 6:30, 18-36 players, 2 hrs max. Boosted to level 85. Ekimus: 24h at 6:30, 18-27 players, 1hr max. Tully’s Workshop (Darion & Tully): 24h +-1h. Tower of Naia (Beleth): 5 days, 18 min. & 36 max.
  • Topics

×
×
  • Create New...