Jump to content

quest system is fat. ohmy very fat.


Ind

Recommended Posts


  • Group:  Members
  • Topic Count:  169
  • Topics Per Day:  0.04
  • Content Count:  1260
  • Reputation:   750
  • Joined:  11/19/11
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  213
  • Reputation:   109
  • Joined:  05/21/12
  • Last Seen:  

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


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  427
  • Reputation:   123
  • Joined:  11/17/11
  • Last Seen:  

We can use our in memory databases. Hopefully we won't implement any leak. I vote for yes.

  • Upvote 1
Link to comment
Share on other sites

  • 4 weeks later...

  • Group:  Members
  • Topic Count:  169
  • Topics Per Day:  0.04
  • Content Count:  1260
  • Reputation:   750
  • Joined:  11/19/11
  • Last Seen:  

[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


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

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


  • Group:  Forum Manager
  • Topic Count:  282
  • Topics Per Day:  0.06
  • Content Count:  3122
  • Reputation:   1614
  • Joined:  03/26/12
  • Last Seen:  

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

  • 1 year later...

  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

This was taken care of in 2fe8140.

Link to comment
Share on other sites

×
×
  • Create New...