• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Nexian

Chat/Combat Log (Game)

5 posts in this topic

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 [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

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:

[CODE]
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
};
[/CODE]

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 [i]every [/i]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. Edited by Nexian
0

Share this post


Link to post
Share on other sites
Buy the book Design Patterns: Elements of Reusable Object-Oriented Software, by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides. It sounds like you're at the point where it'd be rather useful.
0

Share this post


Link to post
Share on other sites
For filtering reasons I would add a type field to your CombatLogLine struct.

Have you profiled this case for being slow already, if not don´t worry about it untill it becomes a problem, but an idea to reduce the drawcalls is to combine all of the CombatLogLines into one string seperated with carrage return feed symbol if they don't contain an image. This will then only use one call to D3DXFont::DrawText for that portion of text.
0

Share this post


Link to post
Share on other sites
[quote name='Narf the Mouse' timestamp='1345334114' post='4970958']
Buy the book Design Patterns: Elements of Reusable Object-Oriented Software, by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides. It sounds like you're at the point where it'd be rather useful.
[/quote]

Thank you for the book suggestion. Added a link to the book for when I am not horrifically poor :)

[quote name='NightCreature83' timestamp='1345378625' post='4971088']
For filtering reasons I would add a type field to your CombatLogLine struct.

Have you profiled this case for being slow already, if not don´t worry about it untill it becomes a problem, but an idea to reduce the drawcalls is to combine all of the CombatLogLines into one string seperated with carrage return feed symbol if they don't contain an image. This will then only use one call to D3DXFont::DrawText for that portion of text.
[/quote]

Yeah, a type field would probably be a good idea, maybe with a source and flags for the type. Like Source = Player 1 and Type = LTYPE_COMBAT | LTYPE_GETHIT

You're right, I probably should worry about performance when it actually becomes an issue. ^^
1

Share this post


Link to post
Share on other sites
For images in the chat log take a look at half life and team fortress. They actually use custom fonts to render images in the chat window. Lets say your game doesn't use the £ symbol anywhere then you could replace that with a star in your font. There are a few font creators online that you can use.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0