Jump to content
  • Advertisement
  • entries
  • comments
  • views


Sign in to follow this  


So, as the mighty board of development progress shows, I am working on the font engine.

Thankfully we implemented a rather nice font engine in Flare, and it will be coming over to S3.

The top-level API exposes a method to create a Typeface(an alias an image and widths file pair)

once loaded a typeface is immutable undestroyable for the lifetime of the engine session, any attempt to load a typeface with the same alias of an existing typeface will be ignored and the existing typeface will be unchanged.

these restrictions are for performance sake.

when a part of the engine wants to some drawing, it creates a Font object.

a font object consists of:

A color
A size
A typeface reference

The creation of the font object uses the typeface alias to resolve the typeface reference.

since the engine is only accessable through the script interface, the script api defines functions for setting certain fonts to certain areas of the engine, such as:


as each one of these systems are processed they set their own fonts before they draw their text.

on the engine side when a font is set it's reference is held and used for every call to:


the rendering engine supports left,hcenter,right alignment and supports word wrap and character clipping.

text in the s3 engine is primarily used for some radial menu items, info text (stuff your mouse is over) and Dialogue, in many cases the engine can override parts of a font, for instance:

if no desired dialogue color is set for a character, then it will use the default color (narrator color) otherwise the speaking character's color is set to it.

Text is rendered in batches of fonts, a TextBatch object references the font, and keeps a copy of the text to be rendered, the font rendering engine then converts the text and the font into a serries of quads which are added to a dynamic vertex buffer.

an important restriction is that no more than 256 characters of text per-font, given the text usages in S3 this is not a big deal.

the restriction allows for easy use of indexing, a 256*6 element 16 bit index buffer is used to reference the vertex buffer, which can now be much smaller, and potentially utilize the vertex cache.

the basic rendering loop looks somthing like this

set vertex buffer
set index buffer
set text shader
baseIndex = 0
for each TextBatch
set font texture
set font color
draw indexed primitive baseIndex,all of the primitives in this batch
baseIndex+=number of indexes we drew
set null index buffer
set null vertex buffer

Sign in to follow this  


Recommended Comments

Out of random curiosity, do you have other task-tracking solutions in place? I've gotten spoiled with a complete task management and delegation system that I wrote for my day job, and I'm curious if anyone else is using similar tools in the indie scene.

Share this comment

Link to comment
I've come across a few teams that use various parts of Microsoft Office to track progress and work items in indie projects. I've not messed with it myself, but "Microsoft Project" kept getting mentioned [smile]

Thinking of that, I have every office 2003 progam installed - I might go play.

Anyway, EDI, have you given any thought to temporal caching of text? Performance wise it was the biggest winner for the engine I wrote. Even at a low 30hz rendering loop, the text only gets updated every 3-4 frames at most when being edited by the user.


Share this comment

Link to comment
Currently we dont have an internal task tracking system, it would be nice but I haven't put much effort into it, note-pad seems to work fine for most things =D

As for temporal caching of text, that is not a bad Idea, though the implementation sounds like it might be weird.

as a 2D developer I come from the concept of, 'if you dont draw it, it does not exist'

however in the realm of 3D realm you cant just 'draw somthing' you are required to set up the source data for it, which is expensive; doing that each frame if you don't have to is not good.

however the question at hand is 'how do I know I dont have to?'

it is conceivable that I can have a vertex and index buffer large enough to contain all of the text you would ever need to see in a scene. (though any change to a single piece of text would require the restructuring of the VB)

so, imagining a GameText object, wherein you could add text to the scene, which is created and shown forever is easy to implement.

however removing that text is not exactly trivial, each piece of text entered would need to have an alias or some other way of referencing it, so that it could be turned off.

I would like to hear more on this if anyone cares to explain =)

Share this comment

Link to comment
I would like to hear more on this if anyone cares to explain
I've replied to your PM about this, so I won't bother going over it again - just one thing:

the question at hand is 'how do I know I dont have to?'

One way of looking at it (which isn't always accurate) is that if you assume your caching system does the same work you'd be doing on a per-frame basis, then calling that caching system every frame (same as before) should yield no worse performance than you already have. However, as soon as it does start to work (i.e. you get a sequence where the code only updates every second like a FPS counter) you'll see the benefits [smile]


Share this comment

Link to comment
So, as the mighty board of development progress shows, I am working on the font engine.

Actually, it only shows that if you understand what your text colors mean. Your map needs a legend.

As far as project management goes, my copy of MS Project ended up going for $109 (yay me). A cheaper alternative is Turbo Project. I tried it a long time ago, and it was pretty capable. Basically a cheaper MS Project knockoff. $45 for the express version is pretty good.

Of course if you've got PHP (and you should), you could go with something online like this or this.

Share this comment

Link to comment
I recommend Project. I also recommend FogBugz, Excel, Access databases, a wiki, and Notepad.

Share this comment

Link to comment
I too was a member of the Notepad Is Fine camp, for many years. Then, for some reason I'm still not entirely clear on, I built myself a complete task management system (complete enough for my personal needs). I will never go back, and I'd highly recommend taking the time to build (or at least buy) one. It's one of those things that doesn't seem all that useful from one perspective, but once you've gotten it, it saves a monumental amount of time and confusion.

Plus, working on a project with more than one person and not using a task coordination system is just begging for trouble. So many communication and collaboration problems simply go away that it isn't even funny.

Worst case, sacrifice a couple of weekends and set up something formal, just for the heck of it. Make sure it is easy to use and captures the bulk of what you need it to do. If the unthinkably bad happens, you lose a weekend or two. In any other scenario, you win [smile]

Share this comment

Link to comment
I also hear basecamp is pretty good (http://www.basecamphq.com/), but I've never tried it. Fogbugz (http://www.fogcreek.com/fogbugz) though is one of the most simple, yet powerful, project management tools I've used. And in conjunction with Project (or perhaps the one Hattan mentioned) you have a pretty good idea where you're at, where you're going, and a decent estimate of how long it's going to take you to get there.

Share this comment

Link to comment

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
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!