Jump to content

quest system is fat. ohmy very fat.


Recommended Posts

Posted

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.

  • Upvote 4
Posted

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.

  • 4 weeks later...
Posted

[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

Posted

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...

Posted

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.

  • 1 year later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...