• Create Account

### #ActualNexian

Posted 18 August 2012 - 03:07 PM

Hello all,

I am currently looking into making a combat log for a game in C++ using Directx9.

I know there is a game forum, but my question is more general. Also, every chat/combat log post I look for tends to be about client/server winsock stuff

Basically I am wondering how the chat/combat log data is best stored, with the following in mind:

- The data will not be stored to a file
- The data will be stored on a line-by-line basis
- The data can be of any total length (A game can technically go on indefinitely)
- A single line will probably have a maximum length
- The data will need to have the ability to store graphics as well as text. i.e. I would like the text to be able to say "Player 1 has gained 3 [image of a yellow star]". This would also need to allow me to hover of the yellow star image to display a tooltip.
- The data will need to have filter options. i.e. filtering it so you only see Player 1's actions, or you only see environment effects.

So far I see a basic outline of something like:

vector<CombatLogLine> lines;

struct CombatLogLine
{
wchar_t text[256]; //the line of text
vector<ChatIcon> icons; //the icons in the text

};

struct ChatIcon
{
IDirect3DTexture9* texture; //the image displayed
short position; //this will be the numerical position in the actual line of text
D3DXVECTOR3 screenPosition; //the actual screen coordinates of the image
wchar_t tooltip[256]; //the tooltip shown
};


Ideally I would like to be able to use ID3DXFont's DrawTextW method for actually printing the text as I already have this functioning and scaling for resolution. My main issues are whether the above outlined code is suitable for the job and how I would determine and place a ChatIcon within the line of text.

Right now my best guess is I that I would need to read through the CombatLogLine and get each position of a ChatIcon and split the text for each icon, making a rectangle of the text up to that point using DrawTextW and placing the icon image at the end of the rectangle's position (setting it's screenPosition) and repeat this process with the remaining text until the line is drawn.

From there I can loop through my ChatIcons for the visible text lines and see if my cursor is hovering over any of them and display the correct tooltip.

What worries me here is the drawing of the lines, as it would seem I need to perform this action every frame with a specialised method to split the text up and intersperse it with icons. I am not sure how much of an impact such an operation would have, but I generally see the program displaying a maximum of 20 lines at once.

Any advice or confirmation/suggestions of methods here is much appreciated.

### #3Nexian

Posted 18 August 2012 - 03:05 PM

Hello all,

I am currently looking into making a combat log for a game in C++ using Directx9.

I know there is a game forum, but my question is more general. Also, every chat/combat log post I look for tends to be about client/server winsock stuff

Basically I am wondering how the chat/combat log data is best stored, with the following in mind:

- The data will not be stored to a file
- The data will be stored on a line-by-line basis
- The data can be of any total length (A game can technically go on indefinitely)
- A single line will probably have a maximum length
- The data will need to have the ability to store graphics as well as text. i.e. I would like the text to be able to say "Player 1 has gained 3 [image of a yellow star]". This would also need to allow me to hover of the yellow star image to display a tooltip.
- The data will need to have filter options. i.e. filtering it so you only see Player 1's actions, or you only see environment effects.

So far I see a basic outline of something like:

vector<CombatLogLine> lines;

struct CombatLogLine
{
wchar_t text[256]; //the line of text
vector<ChatIcon> icons; //the icons in the text

};

struct ChatIcon
{
IDirect3DTexture9* texture; //the image displayed
short position; //this will be the numerical position in the actual line of text
D3DXVECTOR3 screenPosition; //the actual screen coordinates of the image
wchar_t tooltip[256]; //the tooltip shown
};


Ideally I would like to be able to use ID3DXFont's DrawTextW method for actually printing the text as I already have this functioning and scaling for resolution. My main issues are whether the above outlined code is suitable for the job and how I would determine and place a ChatIcon within the line of text.

Right now my best guess is I that I would need to read through the CombatLogLine and get each position of a ChatIcon and split the text for each icon, making a rectangle of the text up to that point using DrawTextW and placing the icon image at the end of the rectangle's position (setting it's screenPosition) and repeat this process with the remaining text until the line is drawn.

From there I can loop through my ChatIcons for the visible text lines and see if my cursor is hovering over any of them and display the correct tooltip.

What worries me here is the drawing of the lines as it would seem I need to perform this action every frame with a specialised method to split the text up and intersperse it with icons. I am not sure how much of an impact such an operation would have, but I generally see the program displaying a maximum of 20 lines at once.

Any advice or confirmation/suggestions of methods here is much appreciated.

### #2Nexian

Posted 18 August 2012 - 03:02 PM

Hello all,

I am currently looking into making a combat log for a game in C++ using Directx9.

I know there is a game forum, but my question is more general. Also, every chat/combat log post I look for tends to be about client/server winsock stuff

Basically I am wondering how the chat/combat log data is best stored, with the following in mind:

- The data will not be stored to a file
- The data will be stored on a line-by-line basis
- The data can be of any total length (A game can technically go on indefinitely)
- A single line will probably have a maximum length
- The data will need to have the ability to store graphics as well as text. i.e. I would like the text to be able to say "Player 1 has gained 3 [image of a yellow star]". This would also need to allow me to hover of the yellow star image to display a tooltip.
- The data will need to have filter options. i.e. filtering it so you only see Player 1's actions, or you only see environment effects.

So far I see a basic outline of something like:

vector<CombatLogLine> lines;

struct CombatLogLine
{
wchar_t text[256]; //the line of text
vector<ChatIcon> icons; //the icons in the text

};

struct ChatIcon
{
IDirect3DTexture9* texture; //the image displayed
short position; //this will be the numerical position in the actual line of text
D3DXVECTOR3 screenPosition; //the actual screen coordinates of the image
wchar_t tooltip[256]; //the tooltip shown
};


Ideally I would like to be able to use ID3DXFont's DrawTextW method for actually printing the text as I already have this functioning and scaling for resolution. My main issues are whether the above outlined code is suitable for the job and how I would determine and place a ChatIcon within the line of text.

Right now my best guess is I that I would need to read through the CombatLogLine and get each position of a ChatIcon and split the text for each icon, making a rectangle of the text up to that point using DrawTextW and placing the icon image at the end of the rectangle's position (setting it's screenPosition) and repeat this process with the remaining text until the line is drawn.

From there I can loop through my ChatIcons for the visible text lines and see if my cursor is hovering over any of them and display the correct tooltip.

What worries me here is the drawing of the lines as it would seem I need to perform this action every frame with a specialised method to split the text up and intersperse it with icons.

Any advice or confirmation/suggestions of methods here is much appreciated.

### #1Nexian

Posted 18 August 2012 - 02:54 PM

Hello all,

I am currently looking into making a combat log for a game in C++ using Directx9.

I know there is a game forum, but my question is more general. Also, every chat/combat log post I look for tends to be about client/server winsock stuff

Basically I am wondering how the chat/combat log data is best stored, with the following in mind:

- The data will not be stored to a file
- The data will be stored on a line-by-line basis
- The data can be of any total length (A game can technically go on indefinitely)
- A single line will probably have a maximum length
- The data will need to have the ability to store graphics as well as text. i.e. I would like the text to be able to say "Player 1 has gained 3 [image of a yellow star]". This would also need to allow me to hover of the yellow star image to display a tooltip.
- The data will need to have filter options. i.e. filtering it so you only see Player 1's actions, or you only see environment effects.

So far I see a basic outline of something like:

vector<CombatLogLine> lines;

struct CombatLogLine
{
wchar_t text[256]; //the line of text
vector<ChatIcon> icons; //the icons in the text

};

struct ChatIcon
{
IDirect3DTexture9* texture; //the image displayed
short position; //this will be the numerical position in the actual line of text
D3DXVECTOR3 screenPosition; //the actual screen coordinates of the image
wchar_t tooltip[256]; //the tooltip shown
};


Ideally I would like to be able to use ID3DXFont's DrawTextW method for actually printing the text as I already have this functioning and scaling for resolution. My main issues are whether the above outlined code is suitable for the job and how I would determine and place a ChatIcon within the line of text.

Right now my best guess is I that I would need to read through the CombatLogLine and get each position of a ChatIcon and split the text for each icon, making a rectangle of the text up to that point using DrawTextW and placing the icon image at the end of the rectangle's position (setting it's screenPosition) and repeat this process with the remaining text until the line is drawn.

From there I can loop through my ChatIcons for the visible text lines and see if my cursor is hovering over any of them and display the correct tooltip.

What worries me here is the drawing of the lines as it would see I would need to perform this action every frame with a specialised method to split the text up and intersperse it with icons.

Any advice or confirmation/suggestions of methods here is much appreciated.

PARTNERS