EOSERV Forum > Programming > Kalandra II (Edited, check my last post)
Topic is locked.
Page: << 1 2 ... 12 13 14 >>
Kalandra II (Edited, check my last post)
Author Message
Post #164380 Re: Kalandra II

Hm, I see. Yeah, it's a bitch to mess around with, but well worth it once you get it done. Since this is about Kalandra II, I'll try keeping it on track more when I rant about my font issues :P


I decided to have 128 characters loaded at once. I am leaning towards loading them all at once but that is just me, I'm up for change. The main issue for me is getting a balance between efficiency and memory. The most memory efficient way is to put all of the characters on a textured quad and have a x, y, w, h integer for each character. Well, I just assumed int was 4 bytes, that makes 16 * 128 or 2048 bytes or 2KB of memory right there. It would be probably the most efficient because it only requires one texture binding. That doesn't even count the advance x and y that will needed for each character to know how much to go forward. God, fonts are hogs :P


I'm just looking at my options from a perspective now. I would've liked them all to be on one texture because rendering would be more efficient. Not to mention, if you keep rounding each separate bitmap texture off to a power of two, that adds up quick.

---
http://www.addipop.com
12 years, 11 weeks ago
Post #164746 Re: Kalandra II

It's a hard one for sure as the balance between efficiency and quality is pretty hard.


Prerendering the font to a texture _IS_ faster provided you don't use the GLU or GLW routines (ie doityourself).


The GLU routines do this:

Create a single texture with each character rendered in a line.

Create a load of quads that render each character.

When drawing text it simply has to call glCallLists() with the offest to its character quads + a buffer of each character value being drawn.


The problem with this is each character gets CPU time per frame as it's sequenced to the render pipeline (because glCallLists is pretty much obsolete and not touched any more)


A better solution would be to render the font to a texture, as above, then write two routines; something like "PrepareSentence" that creates a vertex buffer for each character and a "RenderSentence" that pushes that buffer into the pipeline.


Also, remember to try and draw all your text at once! Don't draw some text, then something else, then some more text. TEXTURE CHANGES ARE BAD! They can crap on your cache, Stall your GPU, CPU sync on old cards, Fill your PCI bus with pointless RAM-GRAM transfers on low memory graphics cards and probably kill kittens and orphans!!! They are just that bad! They are the devil!



---
http://sordie.co.uk
http://twitter.com/@SordieEO
12 years, 11 weeks ago
Post #164785 Re: Kalandra II
Sordie posted: (13th Sep 2012, 08:20 pm)

It's a hard one for sure as the balance between efficiency and quality is pretty hard.


Prerendering the font to a texture _IS_ faster provided you don't use the GLU or GLW routines (ie doityourself).


The GLU routines do this:

Create a single texture with each character rendered in a line.

Create a load of quads that render each character.

When drawing text it simply has to call glCallLists() with the offest to its character quads + a buffer of each character value being drawn.


The problem with this is each character gets CPU time per frame as it's sequenced to the render pipeline (because glCallLists is pretty much obsolete and not touched any more)


A better solution would be to render the font to a texture, as above, then write two routines; something like "PrepareSentence" that creates a vertex buffer for each character and a "RenderSentence" that pushes that buffer into the pipeline.


Also, remember to try and draw all your text at once! Don't draw some text, then something else, then some more text. TEXTURE CHANGES ARE BAD! They can crap on your cache, Stall your GPU, CPU sync on old cards, Fill your PCI bus with pointless RAM-GRAM transfers on low memory graphics cards and probably kill kittens and orphans!!! They are just that bad! They are the devil!



Yeah, I think I have my perfect balance for fonts at least. I have 95 characters(I don't include the first 32 since they're not going to be used) that I render onto a texture. Now, I don't save a x, y, w, h for each character, since that's 95 * 16(thats for a lot of systems using an integer for each one) minimum. Instead, I calculate the largest width and height from each of the charactesr and then allocate 95 of that size. That way I just need to know the width and height of the largest and I will render that. Since TTF fonts use alpha luminance, setting them to 0 will not affect anything else. Since I have them all on one texture, all I need is one texture switch and then I just tell it the coordinates of each one. This is going to be a huge performance increase, and it is a good balance of size. I think I calculated about 700 bytes for each font, and that's because I have to store the advance x and y for each character. I do make and copy the data in the texture all by myself.
If you're interested in seeing the source for it, you're welcome too.

Yes, you are right. I messed with an example with glCallLists. This method is just horrible. Sure, it may be fast once you get it compiled, but it does take up quite a bit of memory, and it doesn't save any time.

Yes, the more texture switches the worse, but there's two issues I've noticed with Kalandra 2. The tileset map is huge as fuck. I mean, I know graphics cards can support some pretty big textures, but you should be a little lenient. Hell, make it a 3D texture map and start having a Z value. This doesn't decrease deficiency and it will help to support more graphics cards.

And then, you do another bad thing(at least I think it is): you split all the characters into their own bitmaps. As you said, the more texture switches the worse off you are. Maybe I'm too anal about the perfect balance, but I actually considered putting them all in one bitmap with each their own row. Hell, I don't even know how much of a difference it will make in game. I don't have any statistics to back up/comfort me.

---
http://www.addipop.com
12 years, 11 weeks ago
Post #164878 Re: Kalandra II
Addison posted: (14th Sep 2012, 03:08 am)

Sordie posted: (13th Sep 2012, 08:20 pm)

It's a hard one for sure as the balance between efficiency and quality is pretty hard.


Prerendering the font to a texture _IS_ faster provided you don't use the GLU or GLW routines (ie doityourself).


The GLU routines do this:

Create a single texture with each character rendered in a line.

Create a load of quads that render each character.

When drawing text it simply has to call glCallLists() with the offest to its character quads + a buffer of each character value being drawn.


The problem with this is each character gets CPU time per frame as it's sequenced to the render pipeline (because glCallLists is pretty much obsolete and not touched any more)


A better solution would be to render the font to a texture, as above, then write two routines; something like "PrepareSentence" that creates a vertex buffer for each character and a "RenderSentence" that pushes that buffer into the pipeline.


Also, remember to try and draw all your text at once! Don't draw some text, then something else, then some more text. TEXTURE CHANGES ARE BAD! They can crap on your cache, Stall your GPU, CPU sync on old cards, Fill your PCI bus with pointless RAM-GRAM transfers on low memory graphics cards and probably kill kittens and orphans!!! They are just that bad! They are the devil!



Yeah, I think I have my perfect balance for fonts at least. I have 95 characters(I don't include the first 32 since they're not going to be used) that I render onto a texture. Now, I don't save a x, y, w, h for each character, since that's 95 * 16(thats for a lot of systems using an integer for each one) minimum. Instead, I calculate the largest width and height from each of the charactesr and then allocate 95 of that size. That way I just need to know the width and height of the largest and I will render that. Since TTF fonts use alpha luminance, setting them to 0 will not affect anything else. Since I have them all on one texture, all I need is one texture switch and then I just tell it the coordinates of each one. This is going to be a huge performance increase, and it is a good balance of size. I think I calculated about 700 bytes for each font, and that's because I have to store the advance x and y for each character. I do make and copy the data in the texture all by myself.
If you're interested in seeing the source for it, you're welcome too.

Yes, you are right. I messed with an example with glCallLists. This method is just horrible. Sure, it may be fast once you get it compiled, but it does take up quite a bit of memory, and it doesn't save any time.

Yes, the more texture switches the worse, but there's two issues I've noticed with Kalandra 2. The tileset map is huge as fuck. I mean, I know graphics cards can support some pretty big textures, but you should be a little lenient. Hell, make it a 3D texture map and start having a Z value. This doesn't decrease deficiency and it will help to support more graphics cards.

And then, you do another bad thing(at least I think it is): you split all the characters into their own bitmaps. As you said, the more texture switches the worse off you are. Maybe I'm too anal about the perfect balance, but I actually considered putting them all in one bitmap with each their own row. Hell, I don't even know how much of a difference it will make in game. I don't have any statistics to back up/comfort me.


Yeah, character rendering is horrid. I've let this slip because I'm no where near finalizing how this will work. At the moment it has no support for new armour, weapons, etc. Actors will be rendered very differently in the future - This was just a quick "Get an actory moving on the screen" solution. As fas as the tileset goes, I see no problem with it. It's (1024 pixels wide) ^2 width so older graphics cards work with it. Even uncompressed in video memory it's only 7.8Mb in size. I've owned graphics cards older than most members of this forum with 32Mb of video memory XD FireFox uses more video ram on a blank page than this =S

EDIT: Soz. I have to leave for a while now. Not the exact time I expected but I will continue with Kalandra II in the future. I just started a massive change to how things are rendered so when I get back expect a big change. I love you all but family comes first! Even more so when you're so fat it looks like you're making an entire village of new family. =D

Love you all and I'll talk to you in the future! (and Soz I didn't get as far as I wanted but things rarely go to plan!.. including times/dates! lol)


---
http://sordie.co.uk
http://twitter.com/@SordieEO
12 years, 11 weeks ago
Post #167683 Re: Kalandra II (Edited, check my last post)


Even more so when you're so fat it looks like you're making an entire village of new family. =D

 

Yes

12 years, 5 weeks ago
Post #184178 Re: Kalandra II (Edited, check my last post)

Well, seems like an interesting piece regardless of outcome. 

but I'm thinking, you wanted suggestions?  Not sure if you've got these already, but I'm definitely thinking, Stat Progression over time, like, as you level, your character gains small amounts of base stats,
urrr, Guild's and community things are a must, maybe, Guild Wars/Battles.?  send a message to another guild with yes/no option to start a war, and have those two guilds or possibly more, enabled for PvP anywhere. Maybe possible player looting, thieving options *Of course within reason*  Map to map free-roam, e.g, Don't have to walk on path's for warps like most people do. 

And how about a mobile application eventually, to log into the chat server and either watch global, or whisper friends? Possible ideas maybe. Goodluck and have fun (; ~

was also thinking along the lines of player housing/ownership of items, to add on to a possible thieving idea. , a stolen item would sell to a shop for less, or something, i'm sure you could come up with better ideas ~

---
http:​/​/​i49.tinypic.com/​2nisayq.png​

v28 ~ Mapping Artist ~ Server Owner/Quest Writer ~ Constructive Reply ~ Demonic Karma ~ Oldbie.
11 years, 42 weeks ago
Post #184213 Re: Kalandra II (Edited, check my last post)
ragnarok posted: (6th Feb 2013, 10:53 pm)

Well, seems like an interesting piece regardless of outcome. 

but I'm thinking, you wanted suggestions?  Not sure if you've got these already, but I'm definitely thinking, Stat Progression over time, like, as you level, your character gains small amounts of base stats,
urrr, Guild's and community things are a must, maybe, Guild Wars/Battles.?  send a message to another guild with yes/no option to start a war, and have those two guilds or possibly more, enabled for PvP anywhere. Maybe possible player looting, thieving options *Of course within reason*  Map to map free-roam, e.g, Don't have to walk on path's for warps like most people do. 

And how about a mobile application eventually, to log into the chat server and either watch global, or whisper friends? Possible ideas maybe. Goodluck and have fun (; ~

was also thinking along the lines of player housing/ownership of items, to add on to a possible thieving idea. , a stolen item would sell to a shop for less, or something, i'm sure you could come up with better ideas ~


I'm sure your input would be appreciated, but unfortunately she's been gone Last Online:19 weeks, 6 days ago for quite some time. I was looking forward to this release but obviously she has more important things to take care of. Hopefully at some future date this will be picked back up but who knows?
11 years, 42 weeks ago
Post #184221 Re: Kalandra II (Edited, check my last post)

I'm pretty sure she left because she was pregnant, and when you have a newborn baby you don't have time for the computer.

---
Create your own destiny, don't let someone else do it for you.
11 years, 42 weeks ago
Post #192067 Re: Kalandra II (Edited, check my last post)
Vile posted: (7th Feb 2013, 07:52 am)

ragnarok posted: (6th Feb 2013, 10:53 pm)

Well, seems like an interesting piece regardless of outcome. 

but I'm thinking, you wanted suggestions?  Not sure if you've got these already, but I'm definitely thinking, Stat Progression over time, like, as you level, your character gains small amounts of base stats,
urrr, Guild's and community things are a must, maybe, Guild Wars/Battles.?  send a message to another guild with yes/no option to start a war, and have those two guilds or possibly more, enabled for PvP anywhere. Maybe possible player looting, thieving options *Of course within reason*  Map to map free-roam, e.g, Don't have to walk on path's for warps like most people do. 

And how about a mobile application eventually, to log into the chat server and either watch global, or whisper friends? Possible ideas maybe. Goodluck and have fun (; ~

was also thinking along the lines of player housing/ownership of items, to add on to a possible thieving idea. , a stolen item would sell to a shop for less, or something, i'm sure you could come up with better ideas ~


I'm sure your input would be appreciated, but unfortunately she's been gone Last Online:19 weeks, 6 days ago for quite some time. I was looking forward to this release but obviously she has more important things to take care of. Hopefully at some future date this will be picked back up but who knows?

Sordie: EDIT: Soz. I have to leave for a while now. Not the exact time I expected but I will continue with Kalandra II in the future. I just started a massive change to how things are rendered so when I get back expect a big change. I love you all but family comes first! Even more so when you're so fat it looks like you're making an entire village of new family. =D


Anyways, Sordie you should continue this, now that you're back :)

11 years, 29 weeks ago
Page: << 1 2 ... 12 13 14 >>
Topic is locked.
EOSERV Forum > Programming > Kalandra II (Edited, check my last post)