Ind Posted August 17, 2012 Group: Members Topic Count: 169 Topics Per Day: 0.03 Content Count: 1260 Reputation: 750 Joined: 11/19/11 Last Seen: April 11, 2013 Share Posted August 17, 2012 As I was doing r16651 I've noticed the quest system has these in (struct) map_session_data int quest_index[MAX_QUEST_DB];// 8.000 byte struct quest quest_log[MAX_QUEST_DB];// 72.000 byte (MAX_QUEST_DB is defined in mmo.h by default as 2k) struct s_quest_db { int id; // 4 unsigned int time; // 4 int mob[MAX_QUEST_OBJECTIVES]; // 4 * 3 int count[MAX_QUEST_OBJECTIVES];// 4 * 3 int num_objectives;// 4 }; // 4 + 4 + (4*3) + (4*3) + 4 = 36 (reference) which is hum...72.000 byte...about to 70kb per player. imo this is...absurd O_O (i didn't really measure compared to the whole map_session_data but by taking a glance at it i'd bet it is the source of at least 25% of each map_session_data instance). and its most wasted data since like no players will have the 2k quests' data. I propose the system be reviewed. for example, as the first thing that comes to my mind, use pointers so that if a player has 20 quests it spends 20*36=720 bytes instead of wasting 72.000 bytes. post your thoughts opinions call me a performance megalomaniac, whatever you like. but post. 4 Link to comment Share on other sites More sharing options...
Cookie Posted August 17, 2012 Group: Members Topic Count: 20 Topics Per Day: 0.00 Content Count: 213 Reputation: 109 Joined: 05/21/12 Last Seen: December 27, 2014 Share Posted August 17, 2012 as the first thing that comes to my mind, use pointers so that if a player has 20 quests it spends 20*36=720 bytes instead of wasting 72.000 bytes. ^ Agreed. I never really noticed the size of the quest system - mostly because I honestly don't touch it anywhere really. lol. Link to comment Share on other sites More sharing options...
xazax Posted August 18, 2012 Group: Members Topic Count: 11 Topics Per Day: 0.00 Content Count: 427 Reputation: 123 Joined: 11/17/11 Last Seen: December 31, 2022 Share Posted August 18, 2012 We can use our in memory databases. Hopefully we won't implement any leak. I vote for yes. 1 Link to comment Share on other sites More sharing options...
Ind Posted September 12, 2012 Group: Members Topic Count: 169 Topics Per Day: 0.03 Content Count: 1260 Reputation: 750 Joined: 11/19/11 Last Seen: April 11, 2013 Author Share Posted September 12, 2012 [22:12:59] <&Akkarin> Would anybody know if putting the Quest Title from /db/quest_db.txt into a variable is possible? I can't find anything similar to a strquestinfo() or anything to query those - would it be possible to add a command like that? [22:13:29] <&Ind> hum oo [22:13:36] <&Akkarin> Hi Ind :3 [22:13:46] <&Ind> so we store it and doesn't send it anywhere? [22:14:23] <&Ind> ah no [22:14:32] <&Ind> with the current implementation the quest name from quest_db.txt is not even thrown into the memory [22:14:34] <&Ind> the server doesn't read it [22:14:43] <&Akkarin> Ah [22:15:22] <&Akkarin> So no strquestinfo(1000,3=title) or something is possible? [22:15:38] <&Ind> with the current implementation that'd be madness [22:15:44] <&Ind> i have a topic about that somewhere [22:15:49] <&Akkarin> Oh [22:15:53] <&Ind> we sure can make tha tpossible [22:15:54] <&Ind> when we fix it Link to comment Share on other sites More sharing options...
Euphy Posted September 12, 2012 Group: Members Topic Count: 72 Topics Per Day: 0.02 Content Count: 2997 Reputation: 1132 Joined: 05/27/12 Last Seen: June 1, 2017 Share Posted September 12, 2012 Why is that needed? There is no way to dynamically generate quest_db entries ingame, so I see no use for a dynamic name function... Link to comment Share on other sites More sharing options...
Akkarin Posted September 12, 2012 Group: Forum Manager Topic Count: 282 Topics Per Day: 0.06 Content Count: 3144 Reputation: 1630 Joined: 03/26/12 Last Seen: April 15 Share Posted September 12, 2012 For example, say i wanted to loop through the quests for a character from `quest` - there's no way to attribute a name to an ID (so i can output something a normal player would understand, like "Orc Hero" instead of 60009), unless i'm using the quest window so the name is picked up from questid2display.txt. Link to comment Share on other sites More sharing options...
Euphy Posted April 16, 2014 Group: Members Topic Count: 72 Topics Per Day: 0.02 Content Count: 2997 Reputation: 1132 Joined: 05/27/12 Last Seen: June 1, 2017 Share Posted April 16, 2014 This was taken care of in 2fe8140. Link to comment Share on other sites More sharing options...
Recommended Posts