The Chronicles of Roarrr

towards the end of April 2000
the idea pretty much started out as I was reading OpenGl RedBook. On one side I wanted to contribute to the Crystal Space
(CS) engine, but on another I realized that if anybody wanted to hire me they wouldn’t ask me if I had experienc with
Crystal Space, but if I had experience with OpenGl or Direct3d (and OpenGl seemed to be winning, to me). I was a bit sad,
as I liked the CS environment and I was hoping to repay all the time Jorrit Tyberghein (lead engine programmer at CS) had
wasted by answering my questions by helping him in the area where he was alone: the hardcore engine. But I was also
excited, as I could become his equal, another guy who’s been through what he’s been (creating something from scratch) and
the we could really be friends I though. Whatever the case, I felt like OpenGl was a NEED. But I was planning to do them
both. I thought of a name for the engine: Roarrr. I liked it because it had the word ‘roar’ and the ‘rrr’. I told Jorrit
I’d leave CS, and to my great joy he said not only he wouldn’t mind, but that he’d be willing to help

ever since I’ve started considering my own engine:
-I’m scared of designing an engine object oriented. And all openGl examples I’ve seen are C, not C++. Crystal Space is the
only OO engine I know of, but it is (for me) so abstract in the object oriented design that I’m simply afraid to have a
look into it on how it does it (beside the fact that I’d like to make my own structures based on theoretical understanding
and not copy their’s, even involuntarely).

-I need to decide on what world structure to use. Major competitors are: Portal engine and BSP engine. I’ve posted a mail
on this on the graphics programming list I’ve started, graphicsCore (which btw has been doing mighty well). I remember no
conclusions of that mail though, except Jorrit saying that maybe I should have both

Thursday, May 25, 2000

I wrote the paragraphs above today too. I’m sorry I didn’t start writing this from the beginning. I’ve gone and am goind
through some steps for completing Roarrr. I’ve started getting used to OpenGl. I’ve read “OpenGl RedBook” and have been
through a big part of the “Nehe OpenGl tutorials” (the rest I’m not interested in, yet, as I’ve come across far more
interesting, and I think important problems). I’ve made a couple of simple OpenGl demos in the process (while trying out if
I understood the stuff in the lessons). Two of them I’m fond of: “Flower of Eternity” and “Chaos347”. They probably run
like crap on most systems at this date and I really disslike the fact that they are machine speed dependant and not time
dependant. I’ll have to fix that in the future. I think lesson 10 in the tutorials was about loading a simple world from a
file and walking through it. That was VERY excting for me. Finally an example in which you don’t program all the
coordinates into OpenGl but load them and interpret them. Walking through that small world Roarrr became a lot more real to
me (I could even start from that code if I wanted too). Than I realized the first feature I want in the engine: detail
textures, textures that get blended on top of the big textures when you get close to walls. I don’t know how to do that in
OpenGl yet. I think I heard something about multitexturing once. I wonder if that’s it. One day I asked Muresan Robert
Zoltan about this, and he said I can search for a certain Ogl extension. But aren’t extensions something that’s available
on some hardware but isn’t on other hardware? I don’t know. The other thing that I’ve been concerned with is choosing
between a portal world system and a bsp tree world system. Strangely enough at this point the winner seems to be kd-trees.
The key to this started out a couple of days ago when I found a tutorial for a portal engine at flipcode by Jacco Bikker
(The Phantom). As I wrote to thank him I told him about Roarrr and my problem, and I was quite surprised (and very excited
at the possibilities) when he said something like: “for me the holy-grail is kd-trees right now”. Than he recomended me his
paper “Thoughts on visibility determination”. Now we have finally reached today. Until now I’ve only been trying to make up
for the lost month or so (I didn’t realize I had been with Ogl for so long until now). Today I read this article. I was
quite excited as I quite understood some things. Cool. For some of the things in there I had previous discussions with
Jorrit (I failed to mention this, but while learning CS engine I had quite a lot of hardcore engine talks with him … and
I think those helped me a lot). Kd-trees in combination with the two algorithms presented in the paper seem to be indeed a
great thing: you are able to have absolutelly changing geometry, and even moving objects may occlude geometry. Not to
mention that they seem to fullfill one of the requirements I had mentioned I’d like on the discussion at graphicsCore: I
wanted to be able to make very un-even maps, with very much detail geometry in parts of it and very little in others.
Neither BSPs nor Portals encouraged this. Kd-trees however choose the splits so that you always have a balanced tree (and I
read it can even be done without splits … but I really don’t understand that). I made a pretty long list of questions for
Jacco Bikker. Hope he’ll answer them. Well, I’m very sleepy. And I’ve got a lot to study for school tomorrow morning — if
I wake up, that is (what’s with that smile on your face?). I’ve been typing for hours. This sometimes feels like useless
work, but I actually know it isn’t. I’m asking around a lot. Beside that I’m trying to find friends. ‘night.
(I fear I’ll turn off the computer and then remember something that I really must write today, so that I won’t forget. )
‘night again.
10:08 PM 5/25/00


Saturday, May 27, 2000
10:24 AM : I’ve finally found out what “the leaves of a BSP tree are convex nodes” means:
[Jacco Bikker] “Well, a BSP tree is a combination of splits of 3D space in pairs of spaces (hence the name). Since every
split with a random plane of a convex space is always a convex space, every node of a BSP tree is a convex space.” 10:27 AM


Saturday, May 27, 2000

today, I spent most of the day working on a planetary system for my physics teacher who needed something visual for
something on Copernicus-Ptolemy conflict (that in both system a planet observed from earth would look the same). Althouh
it’s quite out of the usual range of things I aim for (this is to be actually ‘didactic’) I’m quite happy
I finished it.
but beside that I started thinking about kd-trees. Especially about determining where to position the splitters
when generating them. Solution that came to mind: take the half of the distance along a certain axis. Count polygons. If
there are more on one side divide that side into two sections and check with that. And so on until numbers on sides are
very close.
Then there’s the question of which splitter to choose xy, yz or xz? Maybe we alternate each of them so that we get
a nice distribution. Today, while in an UT: it was something with castles. I got on a wall. Framerate dropped dead (from
about 60 to 6). Seamed logical if it were split with octrees. (for bspS I don’t know) It was because you couldn’t cull
boxes with the sides of the wall and buildings from the start because something of them was visible. Conclusion: most maps
are flat-ish. So, splitting them along yz and xz (vertically) should provide better partitioning than horisontal splitters
(there might even be too few polygons for each side). hmmmm, this isn’t logical come tothink of it …
but it might be true.

finally someone gave me some advice on designing an engine in C++. Jacco wrote me:

[Jacco Bikker] Use a class for (almost) everything. A polygon is an
object, because you might use it in various super-structures. What I
is this: A polygon can be part of a mesh, or it can be floating
around in
solitude. SO you can’t have a class ‘mesh’ that has polygondata in
A vertex is an object. A coordinate is obviously an object.
There is NO overhead to using objects, by the way: Calling a
(a function that belongs to an object) costs 4 clockticks more than
calling a function in C. For the innerloop of an affine
texturemapper that
matters, but for such things I hope you don’t use function calls
anyway. :)
For normal usage, the overhead of using OO is FAR less than 1%,
0.01% is more likely.
So, use objects everywhere. And think like this: As soon as I can
somehow group data because together it has a name (three floats is
a vector – BANG – object) it’s an object. Why? Because there are
operations imaginable that are specific for that combination of data
(in the case of the vector: Scale, add, subtract, dotproduct etc.).
If you can say vector.scale( 0.1 ); that’s far more readible than
equivalent in C: vector[0] *= 0.1; vector [1] *= 0.1; vector[2] *=
I hear you say: I would have used a structure for that!
Congratulations, that’s the beginning of thingking OO.

I’ve heard that c++ is not slow enough to justify my fears but I certanly didn’t have (until now) as much courage as to
make each polygon an object. Finally some speciffic advice. This is extremely useful. Not to say that I’m not afraid
anymore, but what he said is mighty convincing. At least I’m not afraid of structuring things anymore.


Sunday, May 28, 2000
kd-trees, no kd-trees, if I am to really have my first feature detail textures I need to read a couple of things on openGl
texturing and multitexturing (although I’ve used texturing a bit I can’t say I understand it). I should also re-read the
chapter on texturing in the Redbook.

Monday, May 29, 2000
-some more small changes in the Copernicus-Ptolemy beside helping my physics teacher make me feel more confortable looking
through lines that start with gl :)
-I’ve read part of the texture mapping section of RedBook again in more detail. Thanks for the great idea of going faster
through things and then comming back to them go out to Max Gilead. Today, reading that, it felt very conforting to read
something I was interested in, had seen a bit before and thus had a certain curiosity about the details and actually
understood. This brings reading graphics programming stuff from the stage where I find it a frightening experience, an
unconfortable one to the stage where I read it like a novel … because I’m familiar whith what it’s talking about and I
can afford to go faster through it, keeping the big picture in mind. Ogl is really getting to my likeing, probably because
I’m starting to know a little of it.
-looked a bit through Mike Weber’s tuts. Nice of him to make a bsp reader. Seeing it like that makes me understand how
easy it would be for one to just take the stuff off there and .. presto! have his brilliant quake clone engine (having cool
geometry should really help). Actually, if I were to use that stuff, I’d probably do just that instead of his advice of
reading and understanding. I’d probably understand better playing with the code. But I don’t want to understand others’
code … I want to make my own. I want to play around with very simple structures, and build up from there, not start from
given variables that I just use (it’s hard enough to remember my variables). btw: for some reson my guess would be that
there’s quite a bit of Carmack code in there :) It was good as I saw simple classes implemented with bravery again.
-read Jacco’s c-buffer article (again it’s fun that only a very small percentage of the article is actually directly
describing the idea). Can’t say I understood anything more than what I had imagined before (what’s the verb for intuition?
I intuitionalize ?? :> ). But I want to use hardware rendering. He sugests me also keeping a s/c-buffer … but for that i
have to convert my polygons into spans … which I normally wouldn’t do, as I’d just send them to OpenGl for rendering.
-this brings me to the problem (again thinking, not coding) of what polygons I should have. Ok, so I should have n-sided
polygons … but if they are converted to triangles when rendering anyway why should I keep n-sided ones (they might be
concave btw). Because of memory and flexibility I presume. Where am I going to keep thins thing on the web page? It’s
growing rapidly.

Tuesday, May 30, 2000

-might have found some timing code, done with glu (or glut .. confusing). Looks easy. Why did Nehe use windows speciffic
stuff when glut’s there for opening windows? Speed? I’m sticking to it for a while though.
-read a bit more on texture mapping (not Red Book, some articles this time)
-just read something on ARB_multitexture (and recenlty got a reply from Max over openGl-newbie list explaining that these
extensions are actually stable thingies and especially ARB which stands for Architecture Review Board … which is more
serious than the EXT). I’d like to work more on the engine. Old working with Carmack dreams are coming back. maybe when I
have something done with Roarrr we’ll be able to at least talk (never got a reply to that old mail I sent). Whatever.
Anyway … it’s tyme I started on file reading/writing. I’m starting playing around with the Nehe tut that had this (btw,
there’s a new tutorial, 21, up there … but I haven’t even finished all those up there … and I might never do). Too bad
I’m doing this without any world structure … but maybe it’s better I get a feeling of everything if I am to evolve
naturally. (so, it seems that first goal: detail textures, is still on for me, as that’s why I’m looking into world file
loading/saving, so that I can have a tiny world to move around in. Btw, one of these days I figured out why the need for
trig in the movement of the camera in that tutorial: because in order to get x,y,z movement from the x,y,z movement of the
camera that is needed.
-(while on the toilet) I started feeling, maybe for the first time, something about the steps in which I’ll make Roarrr
(nothing miraculous though). Can’t make up my mind if I should use the 0.0x version notation or simply the 1,2, 3 … one,
which I’d prefer, as I am not a company and will not be shipping my product when I get to 1.0 version. Ok, so version 1
will be just a simple file loading/saving … and it’s pretty much already done for me by Lionel Brits / Jeff Molofee (aka
NeHe) in Nehe tutorial 10. Maybe I’ll add some resolution changing (or maybe not, until I have some interface). Am I
stealing? I don’t think so, as this will be highly experimental, and I’ll only consider it done when I’ll be highly
familiar with the code. I need that for verision 2: detail textures when you get close to walls (I’ll need to take
distances to walls into account every time though). Then I can move on to some tree structure (kd-tree probably). About the
class structure: I’ll have a class for vetexes, polygonvertexes (as they have links to the next vertex) … hmmm maybe just
this kind of vertexes, polygons (maybe each polygon should have an array, so vertexes don’t have pointers to the next one).
I need to look into 3d space intersections a bit (this time with very practical and imediate interests though). I’m typing
too much … typing is slower than thinking (but it does give time to think and encourages re-thinking and focusing though)
… so, I should think more, type less, code more, think more … bye bye
-I wish I could forget all about moral obligations. Ok, so I’m starting from Lionel Brits / Jeff Molofee ‘s source. I
could just say they have a site at, and get over with it … I guess. In the big picture of Roarrr it will
be a bit too much to say that it all started from this, as it didn’t. I just DON’T want to write windows speciffic code …
“let’s move on the graphics part” is more of what I’m thinking.
-I’m starting moving structures to classes … basic .. it should be.
-what the heck is “unexpected ‘class’ ‘Triangle'” error … oh, I forgot ; again :)
I’ll write less on this doc.. really!
-i’ve made a few modifications in the source already.
-I’m thinking about replacing the code Lionel Brits had in there that’s just for triangles with one for polygons. Here’s
something that I’m sending to OpenGl-newbie list: “triangles and quads are polygons too. Any reason I should have speciffic
code for them with GL_TRIANGLES, and GL_QUADS instead of treating them all as GL_POLYGONS? I want to have a structure as
general as possible for file reading/writing. Why should I bother to have separate sections for GL_TRIANGLES and GL_QUADS
and not treat them all as GL_POLYGONS ???”. Hope I get some sensible reply. I’m sleepy … and I need to wake up early
tomorrow if I am to pretend I’m learning for school :)
before I go: i’ve changed the texture (not much programming there though), set mipmapping as default and only variant,
eliminated a glNormal which seemed to have nothing to do there. Changed so it starts at 1024 by default and without the
pop-up question of fullscreen or not. anything else? I don’t know. night.
-didn’t go yet :) changed the world file, looks completelly different (at one point because of an error of mine changing
it). That’s good. I’ll need to make the movement time dependent as now, for me it moves a lot faster when I’m not looking
at the world.
-the image is cut when I look sideways. Why is that?
-I’m still not getting it, why is the trig is as it is?

xpos -= (float)sin(heading*piover180) * 0.05f;
zpos -= (float)cos(heading*piover180) * 0.05f;

thing is that on my paper the sin and cos should be the other way around, but that doesn’t work. I suspect that it’s about
the way the movement is simulated, not with the camera movement, but with the translation of the world. Maybe I just
shouldn’t worry about it, ’cause I have to make it right anyway. really: good night now! (I’m fond of the advancements of
today … they aren’t big, but sure look so … I’ve already got a small world to show off).
Wednesday, May 31, 2000
-should I rewrite everything from scratch so that I can say it’s all been done by me? I would be just about copying the
windows speciffic code anyway. I don’t know. Maybe I’ll try to just read polygons instead of triangles. Since I want the
number of vertices in a polygon to be variable: my first real class should come. The others were just structures called
-looked a bit through the Unreal .t3d export files. The seem to be quite readable, so it might be possible for me to
implement a reader for those (I’d like to make my maps in Unreal) … but I just hope they store final geometry, and not
(as it seems) CSG one.
-guess what. I’m looking through “thinking in c++” again :). It seems like it’s one thing to read others’ code, and
another to write it yourself. eg: I don’t remember if a constructor should be public or private, what that means for the
design (something about inheritance I think), wheather before you write anything like “public:” or “private:” what is the
default. And why have separate code in .h files?
-I’m reading the “Viewing” chapter of Ogl Redbook again. I want to make the camera movement in the world act properly (and
not move the world away from the camera, as it is now). hmmm, I remembered I should add hours (so that I, and you can amuse
ourselves looking through the times)
[9:07 PM] I was getting ready to get excited as a program of PURE opengl code of 40 lines (with glu and glut) would run
straight from Redbook. At least I hoped. It still wouldn’t have been good enough for me, I think, because I *need*
fullscreen, and maybe keys would have been slow, or something. Anyway, strange things happened (but I’ve been around
computers too long to be too impressed): “c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error
C2144: syntax error : missing ‘;’ before type ‘void'”. With all the anti-Microsoft propaganda … I doubt they’d make a
mistake in gl.h :)))
9:11 PM forgot to mention: it seems that there is a camera matrix in opengl. For some reason I thought that because they’re
not talking about world/object/screen space they wouldn’t have that either
9:44 PM I’m quite confused. There is a gluLookAt(), which would seem to set the camera matrix, but there doesn’t seem to be
any such thing. There’s just a GL_MODELVIEW. So what does gluLookAt do? Actually, the question is: “upon what does it do
what it does???”. Hmmm … maybe it’s just that any transformation applied before any geometry is as if the camera matrix
was multiplied to the other transformations (note: should look in Zed3d to clarify transformations from object to world,
camera to world … tranformations). For now, let’s just try gluLookAt().
9:51 PM hmmm could it be that I am forced to admit that the guy did it right in the first place? As long as there is no
camera matrix … you might as well translate the whole world … or maybe not???
9:55 PM yup. I’m afraid so. I won’t be able to say that I changed this :^P It’s a whole lot better than using gluLookAt to
9:59 PM there must be some way to control mipmapping (it’s happening too close IMO).
10:02 PM fun: I’m typing at the dos prompt with ‘/’ instead of ‘\’ :)) (checking to see if printf works) … nope. doesn’t.
I’ll use a debug.txt file, I guess :)
10:11 PM ok, that works (hmmm, I’m getting too detailed maybe with this journal)
10:18 PM feel I’m not making enough changes to this to justify a version (even the first one). Not sure if I should bother
loading polygons anymore. Maybe multitexturing should be the first version. still …
10:21 PM when is key imput really processed. If it’s a separate thread … where should the timing function go?
10:59 PM with lack of other documentation I am now looking over CS source to figure out how to do timing. Even if I get
that though, I still can’t get perfect accuracy as I have really no idea as to when the keyboard pressing is handled. Two
thoughts: 1) why is that important after all? Because that’s when the camera positioning changes … 2)good way to do
things: that might get called continuously, but that’s good for me, as if I only update the keyboard buffer I can do the
checking whenever I want to.
11:05 PM man! CS source is really mixed up when you’re simply looking for the base c function! They’ve got interfaces on
top of interfaces on top of interfaces … 11:12 PM I NEEEEED some help with timing!!!
Friday, June 02, 2000
1:02 PM I might have a cold, or case of lazyness. yesterday I did nothing. I’ll try to beat that today.
1:23 PM looking at some demos … I love em. No wonder I’m into gfx.
2:27 PM how lazy can one get? well … : I just found gldoom :) To see it hardware accelerated … doom on a ge-force :)
hardy-har-har (found it while looking for some documentation for timing). Well, I guess it’s time I quit fooling around.
3:02 PM what seemed to be a nice timing routine freezed my computer !?!
3:24 PM for the first time in my life I’m making a separation with .cpp and .h files on my own (and almost seing why this
is necessary). I’d like to have the windows speciffic code separately … but I don’t know why I get full of errors in gl.h
and not my files
3:33 PM finally. I got it: never #include <gl\gl.h> before including windows.h !!!!
3:48 PM I was loosing all hope, but: I finally moved everything and compiled (not dozens of errors)
4:18 PM reading through Thinking in C++ for hearders and especially to find out why the compiler doesn’t find my class
FpsCounter (I wonder what would be better fps_counter or FpsCounter?).
5:01 PM finally found my problem: it seems that fprintf doesn’t require “&” for it’s parameters. I though it did.
5:33 PM I’m giving up on this fps counter for now. I need a rest for my eyes. I’ll ask somebody about this.
Saturday, June 03, 2000

10:20 AM I’m back. Hope I’ll get something done today.
10:39 AM how do I define an array of objects while still calling the constructors with parameters ???
11:03 AM it seems I can’t use names like Polygon as they give erorrs :(( . I have to look into this namespace thing. But
I’d rather not. Why can’t I? the only place a polygon could be defined is “windows.h”, but … back to Thinking C++
11:35 AM well, it seems there’s no way of me slipping by this one. Namespaces are no good to me here. It seems I’ll have to
change class Polygon to class
11:45 A I really don’t understand this polygon thing. Why doesn’t it allow me to name a class called Polygon??? I’m not
using any library that has something like that. Ogl has GL_POLYGON, so that’s not it. HELP.
12:47 PM I got everything to compile, just that now I’m staring at a black screen (I’ve changed from loading triangles to
loading polygons). Well, I’m taking a break. I think I should start making the GraphicsCore ( a list/group I moderate)
Sunday, June 04, 2000

4:33 PM hope I can find out why that black screen shows instead of the nice polygons
4:42 PM found a huge bug (no {} for a ‘for’ in the main rendering loop), but still black screen. I’m glad I don’t have to
work in linux with no visual debuger though.
4:45 PM BINGO!!! It was the number of vertices.
4:50 PM and the error wasn’t in the file reading as I though, but in a useless constructor. Useless because
“numvertices=numvertices” isn’t a very useful thing, is it now?

Tuesday, June 06, 2000

8:58 AM don’t have to go to school today :)). It’s my end-high-school festivity har-har. I survived another monday, the day
of the week when all the undone school stuff bundles up on me and I really can’t find my way out until late in the
afternoon, and by then I’m too sleepy to do anything.
But why does Roarrr choke with a “this program has performed an ilegal operation” ? I’m just trying to load a second

9:04 AM I don’t get it. It works if I load the second texture into another ‘AUX_RGBImageRec’ … but I should be able to
reuse the same memory for for loading all the textures until I pass them to Ogl, by loading/clearing/loading/clearing …
?!? Hmmm … just remembered I saw two emails from Jorrit. I’ll read them now as they are replies to questions I asked on
Roarrr :)
9:14 AM Jorrit strongly sugests me mangling names like Polygon (he used csPolygon). He said it might be about windows.h,
and that if I don’t do it it I might find myself in a lot of trouble. I don’t like it … but I’ll have to do it, it seems.
he finds it funny that I’m going to have detail textures first. Indeed :)). The PVS stuff I didn’t understand .. yet. I’ll
have to get back to it later.
10:00 AM in the process of explaining my question about texture vectors at opengl-newbie list I also wrote down what I was
ultimatelly looking for. Here’s a snip out of that discussion (what I’m saying):

(hmmm. I must really stink at explaining.)
No. I was talking about something like:

specify_texture_vectors_function( U_texture_vector, V_texture_vector);
specify_where_(0,0)_in texture is ( x, y, z);
for(int i=0; i<n ; i++){
glTexCoord2d( automagical_u_coordinate_for current_vertex(),
glVertex3d( xvertex[i] , yvertex[i], zvertex[i]); //. this is the current vertex

The idea is that n may be however big I want it (n-vertices on a polygon). I never have to specify the texture
coordinates again. Just 3d postions.
I might have to do it myself. I was hoping that a smart library like Ogl already has something like this done, so
the line glTexCoord2d() isn’t even needed (also reducing the amount of data that needs to be passed down to the hardware,
which is cool)

10:49 well, I’ll guess I’ll be doin’ texturing the easy way: allocate memory for all the textures that are being loaded …
pass them to Ogl and then free this memory. I would have liked: allocating memory for one texture, load it, pass it to ogl,
free memory, load the next texture

11:07 AM just looked through a multitexturing doc. I’m in trouble. At least with this doc, multitexturing isn’t as I
expected it. It mixes a fixed amount of each of the textures, and not as I wanted it: more of the detail texture when you
get close to the walls. But it’s probably just that the doc is a bit older (found it on the openGl site though). Well, I’ll
try this for now.
12:08 PM at first I thought I have too old an Ogl version to use ARB_multitexture (because i get an error:
“‘glActiveTextureARB’ : undeclared identifier”. Yet, when I tweaked Roarrr with some copyed code to print out (to file) the
extensions … it seems it has it. My guess is that the opengl32.dll has it, because it’s been installed when I installed
my ge-force, which is rather new, but hte opengl32.lib that came with my visualC is too old. If so, where can I get a new
12:19 nope, the ge-force cd doesn’t have one. it says there however that it installed an OpenGl ICD driver. I was wondering
how openGl ran for me just like that and I hear others had to have this ICD thing. I wondered where it was.
12:33 PM the gl.h I’m including from the MSVC include folder indeed doesn’t have defined anything with ARB in it (it does
have stuff with EXT though). Where am I going to get good .lib and .h files ????????? (without changing the VC version). My
eyes hurt. I’m going bye bye.

Tuesday, June 13, 2000

5:49 AM hmmm. feels like weeks since I last worked on Fictor. This gal really got me busy doing nothing, it would seem.
Well, let’s try to break this prison. It seems I’ll have to dump multitexturing until I find out where I could get some
updated files from. Well, on to kd-trees. First I’d better start experimenting/building for that. First comes
classification of a polygon with regards to a plane. on, Silver, on Twister, on Rumbler, on Bumbler !

6:06 AM as a last try, I might be on to something. I’m searching around the assus web page/ftp server for drivers.
6:18 AM well, I’m downloading something. Hope it will be good, as it’s quite big for my download abilities. I’m too sleepy
to work right now though (eyes giving me a painful sensation).

10:45 AM ok. I’ve got almost an hour until I’ve got to go to school. Let’s make it count!
10:51 AM changed all classes from Polygon to rPolygon, to avoid name clashes. I don’t like it, but …
10:52 AM just remembered … I don’t have a timing routine up yet, so I might work on that, with the reply Jorrit gave me
11:11 AM I am not able to find the times() function Jorrit said I should use? Hope he’ll reply with some example.
11:21 AM I wonder if I should have a rPlane inside every rPolygon.
-Better look into some plane theory … but now I’ve got to go.
Wednesday, June 14, 2000

12:33 AM hi ho.
12:38 AM maybe I’ll have an array of planes, and each polygon a pointer to a plane
12:46 AM reading through some doc I realized/remembered something: I don’t need to keep all the vertices for each polygon.
Polygons often share vertices.
1:13 AM must say CS sources are very nice looking with the math stuff :) Can’t say I’m not tempted. Actually what I’m
looking for is an idea on how I should make plane equation available, through some class, or what? Thought just crossed my
mind: what if it’s just a member function inside the rPolygon?
1:22 AM first I’m looking for making simple vector operations natural (just an add). Back to Thinking c++ (forgot how to do
that operator magic).
1:47 AM Why does CS have ‘friend’ when defining an operator (eg: addition of two vectors)? Does that mean that those
operators are global, not inside classes? Could be. But where are they defined then? Inside classes? Strange?
1:51 AM strange. I’m hardly coding at all. Just thinking (or rather guessing, in my case). Eg. should I have a different
tretment for a vertex and a vector? we’ll see next time.

Friday, June 16, 2000

7:53 PM this certanly seems to be an an un-productive period for me as far as programming is concerned.
8:27 PM right now I’m on operator overloading. Don’t understand why CS does it like:

inline friend rVector operator+ (const rVector v1, const rVector& v2)
{ return rVector(v1.x+v2.x, v1.y+v2.y, v1.z+v2.z); }

This appears in the .h files, in the class declarations. Why like this? Why not:

rVector operator+ (const rVector v)
{ return rVector(x+v.x, y+v.y, z+v.z); }

Why the ‘inline’. Isn’t it by default inline when it’s in a .h file?
And why the ‘friend’ ? it’s not a class.
Asked Jorrit about this.
and then, I’m not sure how to create a new class. With “rVector A;”, and then later “A=new rVector(1.0f, 1.0f, 1.0f);” or
is the constructor to be called at the declaration(definition?) of A (eg. rVector A (1.0f, 1.0f, 1.0f) ). I’ve got quite a
few C++ questions it seems. but I don’t feel bad about it. It means I’m learning (until now, just reading others’ code I
thought I already knew just about everything).
8:38 PM he he. Just with the compiler’s errors I’m starting to figure out what’s happenin’. Eg. “rVector A(1.0f, 1.0f,
1.0f);” this seems to create and initialize an object, and not “rVector A = new rVector (1.0f, 1.0f, 1.0f);”, as I though.
Cool. I can learn this way … and don’t have to wonder aimelessly searching for this kind of info through Thinking in C++

8:41 PM cool! vector addition has just been overloaded and tested :)
8:51 PM Given 3 points in 3d space, and thus a equation system of the type:


I can find the plane equation. Well, I can’t find D, I just divide eveything by D and then A is actually A/D and D==1 …
but why am I doing this? Oh, yeah, for surface normals, for lighting (i had forgotten why I was interested in this in the
first place). I hear then (A,B,C) is the normal … but I don’t know why. Got to think about this. Or evean easyer: read
(thinking hurts .. I hear).

8:58 PM a cross product should produce a normal … which I should then normalize. Hmmm. I find this in a doc … but I’m
not willing to accept it just like that ’cause I don’t know why it’s like that yet:

If we specify the vertices of a polygon counterclockwise when viewing the outer side, in a right-handed coordinate system,
the surface normal N will point from inside to outside. You can verify this from an alternate definition for N, based on
three vertices:
N = (V2 – V1) x (V3 – V1) = (A, B, C)

If we find N in this way, we still need D to complete the plane equation. The value of D is simply the dot product of the
surface normal with any point in the polygon:

N . P = -D

Yes, I can understand that the vector product is normal to the plane of the two vectors thus obtained (because that’s how a
vector product is defined) … but why is that exactly A, B and C. I mean: it could be multiplied by a constant. Does that
matter? And why is that D? I need some linear algebra book! (or should find Zed3d)
9:26 PM I don’t get it. there’s this very strange error: “‘sqrt’ : undeclared identifier”, although I’ve included <math.h>
and even <float.h> (whatever that is/does). I’ve got no ideas on this.

9:29 PM that’s it for today I guess. I know I’m not being too productive these days. Reasons: I’m weird (listen to a lot of
music, sing-along, try to compose, today I made a drawing I’m really fond of … I think I’ll have it on my web page, read,
waste time), there’s this girl … , there’s the exams getting deadly close and I’m really not prepared (in less then 2
weeks hell is coming down with weeks of exams which if I don’t pass … i’d rather not think about it). The bad part is
that I’m not expecting any changes any time soon. Maybe in about 1-2 months things will finally chill down, if I pass the
exams, that is :-| . Until then … what comes around goes around.

Saturday, June 17, 2000

7:38 PM ahm …
8:09 PM Jorrit pointed me to the CS timing.cpp file. Understood nothing. Main thing in there must be
QueryPerformanceFrequency, but (snip from mail to him)

I tried calling the function with a paramater that’s “__int64” and printing that. I didn’t get it though why it had to be
something like “(LARGE_INTEGER*)&theTime”, but I did it, because otherwise I got a very strange sounding error and that’s
how CS does it. Problem is: I always got the same number back :>
Printed out with fprintf as “%li”. That might be it … but I don’t know.

Well, back to planes and polygons, I guess.
Why doesn’t sqrt() work ?!?!?

8:32 PM I’m really annoyed with sqrt()!!! And in another project it works! What am I doing differently?
8:35 PM well I’ll be a … It works in win_ish.cpp, but not in roarrr.cpp !!! what’s wrong with Roarrr.cpp
8:37 PM har har. I was doing ‘include “math.h”‘ instead of ‘include <math.h>’ And it didn’t complain, as I did have a local
math.h file :> Stupid!
8:40 PM why is it ok with ‘#include “gl\gl.h”‘ then? Anyway, now I can move on.
well, maybe later.


Monday, July 31, 2000
finally done with those exams … and maybe looking into some work on Roarrr (hopefully). my problem atm is implementing
finding a point’s position with respect to a plane (for some reason I can’t seem to find any docs on this)


Tuesday, August 01, 2000

9:28 PM it seems like I’m finally finding out for myself the truth of the fact that just sitting down with will to code
isn’t enough. I need to think about the general structure of it all. eg: to implement a kd-tree I need a function for
determining the position of a polygon with respect to a plane … but what class should that function be a member function

Wednesday, August 02, 2000

1:13 AM it seems I ended up writing another doc, this time about finding the position of a point with respect to a plane.
I’m sending it to both graphicsCore and Proof Seekers lists. This is a kind of experiment, if people like it I might be
writing short stuff like this when I understand things. Here’s the description/story I’m sending to graphicsCore:

I was thinking about implementing determining the position of a point with respect to a plane today (to use it for some
space partitioning) when I realized none of the docs I had covered something as basic as this and I knew nothing about it
except same vague memory that I once read somewhere something like that you only have to insert the x,y,z of that point
into the left side of the plane equation A*x+B*y+C*z+D=0 equation and if it was greater than 0 that meant it was on one
side, if it was 0 it was on the plane and if it was less than 0 it was on the other side. But I hate implementing guesses
(unless they’re backed by intuition) so I tried to find something I knew and trusted. I didn’t even trust the plane
equation (doesn’t feel very intuitive to me). So, using some stuff I read in a doc called “Point-Normal form for a plane”
and my once sain knowledge of vectors I found some proof that satisfied me as far as finding the position of a point with
respect to a plane. This is it. Please tell me if this is useful/interesting for anybody as after I solved my personal
curiosity I was quite troubled as to if I should or should not take the time to write this down for others (I would have
loved to just talk about it with somebody … but nearest guy I can think of that might be really interested must be a
couple of hundred/thousant km away). So … this is a kind of experiment: if it is useful/interesting to anybody I’ll write
this kind of small stuff in the future too when I solve oneof my small puzzles.

Thursday, August 03, 2000

11:41 AM I still don’t know where to start. I know I should have a function that determines the position of a polygon with
respect to a plane that should call a function that does this for each vertex … but I can’t imagine the class structure!
I stink!!!
12:20 PM Frag_Daddy told me he also wrote something about the position of a vertex about a plane, but I can’t find it in
his engine tutorials
12:49 PM looked through the CS implemenentation of vectors (especially the operator overloading) a little and got a little
courage. It seems very clean over there. Yet this seems to be the most un-operative stage of the project yet. I don’t want
to just copy code (even if it does look very nice and I do have a strong feeling I’ll need that anyway). I wanna write it
as I need it. The problem is that I don’t have an image of how things should be inside my head. To top it all I got a
little scared reading people criticizing the use of arrays in a 3d engine. I’m going out for a walk. I really need to think
5:56 PM now I’m reading through some portions of “Thinking in c++” … again. Idea to remember: I should use const
references (also explains them in CS code). Thinking today as to what I should do in Roarrr got me somewhere. Thinking is
(beside being painful) somewhat frustrating but once you’ve done it it sure feels nice :)
I realized my new imediate goal: implement a kd-tree. Thinking how I should do that I finally solved a older mistery that
has been puzzling me: I think I now understood the need for pointers to pointers: when you’ve got a tree structure like the
kd-tree (or bsp, because as far as I can tell a kd-tree is just a special bsp) you need to have pointers to polygons at
each level of the tree.
Q: But what keeps these pointers together?
A: Pointers to pointers :))
As far as Thinking in C++: now I’d like to find a large explanation as to the reason for the existance of header files.
That is still a quite confusing thing to me (what, where to place).

6:07 PM here’s an explanation for headers from the book:

When you create a class, you are creating a new data type. Generally, you want this type to be
easily accessible to yourself and others. In addition, you want to separate the interface (the
class declaration) from the implementation (the definition of the class member functions) so
the implementation can be changed without forcing a re-compile of the entire system. You
achieve this end by putting the class declaration in a header file.

Well. bye, for now.

4:53 16/8/2000 Well, my computer has been away for quite a couple of days now,
and with it so has been the Roarrr source. One day it stopped and decided not
to start again. I took it to the guy that sold it to me as it’s in guarantee
but after taking it to a repair shop he decided to take a 10-12 days holiday
at the sea. Now isn’t that nice of him? Anyway, surprisingly, these couple of
days have not been dead for Roarrr. After a couple of days of thinking about
it every once in a while I realized i had quite a few things I didn’t
understand how I was going to do. Jorrit helped a LOT when one day I finally
found him on irc. He also came up with this brilliant idea on choosing the
splitter plane for the kd-tree. I’ll write it down later (this was almost a
week ago). For now I’ll just paste the explanation of how things are planned
right now that I sent to graphicsCore (a graphics programming group I

well some of you know I’m planning to make my own engine. Very
little of it is done already, but I’ve got some plans. I’ll try to
talk in this mail about them hoping I’ll get some feedback. Before I
start I must say that the current plans were developed with very
useful help from Jorrit. Also I found to be very interesting Jacco
Bikker’s “Thoughts on visibility determination” article at flipcode (
… one sec … ).
ok, so on to business. I am aiming for hardware accelerated
systems. Am programming in c++ with OpenGl api for windows. I plan to
have the world geometry kept in a kd-tree with small bsps at it’s
leaves. I’ll have a c-buffer implemented. Using this I’ll traverse
the world tree front to back inserting polygons into the c-buffer not
drawing them but feeding them to a visible polygons list. I stop this
when the c-buffer fills up. Then I send them to OpenGl for back-front
rendering (z-buffer turned off). After that (later) I’ll probably
draw actors/sprites using the z-buffer (that also means that I’ll be
rendering static geometry with z-fill).
Ok, so that’s how it sounds. Now the ups and downs:
-I am using the c-buffer approach because I’d like to have HUGE
worlds and rendering speed not be dependent on how big the world is
but just on how much geometry is displayed on the screen (assuming
you have enough ram for the world, of course). This should happen
because I stop traversing the world tree when the c-buffer fills up
and only feed those polygons to the.
– yet … in order to use the c-buffer I have to translate (what’s
the propper word?) all polygons from world space to screen space. And
I have to do this in software which is quite bad as this is an extra
operation that doesn’t come for free because normally OpenGl would do
these transformations for me using (if available) hardware
transformations. So I end up with both me and OpenGl transforming all
polygons. Also I need to scan-convert them.
-I feel that although I’m aiming for hardware accelerated systems I’m
not stressing the hardware enough.

Another quite interesting thing (surpring to me) is that I’ve started coding
without the rest of the Roarrr source, and of course without compiling. I
think I’ve done about most of the bsp tree implementation (worked on a couple
of classes). Actually it might just be the biggest piece of OO code I’ve ever
written (that’s becuse I haven’t written much OO code so far. To feel more
secure on what I was doing I read parts of the bsp Faq, and to my pleasant
surprise I think I did things quite nicely … I hope actually.
What can I say? it’s fun to work on a 486 at 75Mhz high-end
grahics workstation :) Well, I should try to get some more code written. I
wouldn’t be surprised if these days I won’t write much for the Chronicles of
Roarrr. It’s ugly not having my computer: I just hope the guys at the repair
shop don’t decide to try to fix my computer by wasting everything on the hdd.
I’d be very angry … but without the power of doing anything.

6:20 I’ve just finished a almost complete rewrite of the rBspNode class I
thought to be correct a couple of days ago. I’m quite fond of what I just
did. It’s even (about) clear in my head, which is truly a wonder :)

Well this is the first day of a kind of work plan. While until now I’ve been
working whenever I felt like it I’m thinking it might help me if i had a more
fixed and rough schedule (might also eliminate the frustration I get from my
slow progress). So, I’m thinking a 4 hour work day should be enough (maybe
more as I get into it, but this is enough for starters). So, I’ve been here
since 8. Until now I’ve been coding but now I’m reading through the Ogl
chapter on model viewing. With coding I got stuck when wanting to split a poly
as it seems I don’t know how to find the intersection between a line and a
plane. It’s ok though, as I enjoy changing what I’m doing, and now I’m going
through that warm comfy feeling of reading through something that feels
somewhat familiar. I need to understand how Ogl handles it’s transformations
if I am to mimic it’s actions for the c-buffer. Beside that I still don’t
understand where openGl keeps the camera matrix. It seems to be bundled into
the world matrix and I’m not sure how to handle it (what would be the
official/good way). I’m quite fond that yesterday I thought of some of this
stuff while walking to/from a movie. Cool. Maybe with time I’ll get better at
this and actually design the engine during what to others would be dead time.
Well, enough writing. Just though I’d make a short note.

11:42:24 I don’t know how to implement the cross product. what else do I need
to do. I’ve got my mind set on the cross product and matrices … and of
course especially the line-plane intersection for the polygon splitting and I
can’t think of what else to do until I get the required info on that (15 more
minuites ’till end of workday :)). Oh, yeah: the octree class (which I can
mostly derive from the code I’ve written for the bsp … sorry, I meant
kdtree, not octree. It’s probably because they were used together just about
every doc on them I recently read.
12:05:07 well, working day is officially over. I’ve very fond of it. Now I’m
off to eat something and maybe read the graphicsCore mail. I really have to
find somebody to ask all these questions (and I’d also have some healthy
thinking to do on the problems I ran into today). geeeeeee. I’m such a serious
person I impress myself :))))))))))))))))))))))))))))))))


Saturday, September 09, 2000
12:14 AM
it’s been a long time since I’ve updated this doc. I’m ashamed … (even though I probably have no audience to
dissapoint). I’ve got my computer back … more or less. Sound card isn’t working under windows with the temporary
motherboard the hardware guy gave me … so I’ve kind-of moved to linux. And I’m getting very exited at how friendly/useful
it is and I’m making it. Short review of what I’ve done recently: just about nothing. Started printing on Ogl specs for
1.2.1 (I want to use multitexturing, and besides a little more knowledge of ogl isn’t gonna hurt me). It seems I haven’t
stuck to that 4h per day sistem I was hoping for. No problem. Let’s say I stick to a 1 hour a day, and not only
programming, but whatever is needed. Ex today I spent several hours customizing and getting confortable with linux (and
listening to music in the meanwhile :)). I’m getting very tempted to work under linux. … but atm I haven’t ever compiled
anything under linux, so I don’t know. Anyway I’ve been looking for an editor to use: it’s now down to xemacs and vim, and
I think it will be vim (i’ll be reading the tutorial soon, I think). Still I’m stuck to windows for picking up my mail (yep
I’m a bit lazy and scared to set it up under linux). And … there would be the issue of the compiling once in a while
where only VC++ is good for me atm. But this is not imediate as until I finish (more or less) with the bsp, kdtree and
c-buffer there’s not much to compile (but some grammar corrections/errors/warnings would be handy though).
until next time (hopefully sooner than later)


Thursday, September 21, 2000
1:06 PM
Well, yesterday I lost a version of this document :( OpenGl 1.2.1 specifications are still printing on my crappy printer (I just wonder when I’ll read them). But back to where I started. yesterday I finally starting working again :) But as I wanted to finally compile that bulk of code that I wrote while I didn’t have a computer to compile I got a lot of errors (in the process of this I accidentally erased “Roarrr.txt” where I update this doc). I spent more than an hour uselessly trying to fix one of them. We’ll see what’s been happenin’ todya.

3:44 PM nope. I haven’t been working all this time. I got too frustrated with the errors. I may need to read some sections of Thinking in c++ again (and I really don’t feel like it). I think it’s some constructor thing (turns out when I’m overloading the operators for rVertex class). but now I’m goin’ for a walk.

Friday, September 22, 2000
12:21 PM
hi. bacK? same errors that made me leave yesterday.
1:51 PM
I’ve just finished skimming though the “Initialisation & Cleanup” chapter of TiC++ (I’ll use this shorthand for Bruce Eckel’s “Thinking in C++”. I don’t think it has brought me any closer to fixing my error, which btw is:

c:\roarrr\rvertex.h(28) : error C2664: ‘__thiscall rVertex::rVertex(const class rVertex &)’ : cannot convert parameter 1 from ‘class rVertex *’ to ‘const class rVertex &’
Reason: cannot convert from ‘class rVertex *’ to ‘const class rVertex’
No constructor could take the source type, or constructor overload resolution was ambiguous

for the line:

rVertex operator+ (const rVertex &other){
return new rVertex(x+other.x, y+other.y, z+other.z);

(at the return). One thing I should remember though is that the compiler makes a default constructor if (and ONLY if) there are no other constructors.

2:09 PM
I think I’ll be heading off to somewhere in town where I’ll have some web access. I’m especially eager to send this question to whoever will have it :), but maybe I’ll also read/search something into some gCore (graphicsCore) mail and see about these new things Conor Stokes (aka Dirty Punk, DP) mentioned OBB (Oriented Bounding Box) trees and AABB (axis aligned bounding box) trees.

Sunday, September 24, 2000
12:41 PM
I got “Effective C++”, “More effective c++” and some articles by the author. Way cool. It looks like soon I’ll be reading again. Seems un-productive, but, like he said, if I wanna make it far I need very good fundations … beside I think it will be productive in the long run.

2:39 PM I’ve only reached up to the introdction of “Effective c++”. Now I’m goin’ for a walk.
Wednesday, September 27, 2000
9:25 AM
No. I don’t think I’ve been lazying around. i’ve been reading and talking c++ stuff (many thanks to Paul Nettle for his huge patience -and skill- in answering my questions). I’ve just finished reading item 31 of “Effective C++” (no, I’m not reading them in order).
Friday, September 29, 2000
I’ve been talking to Paul Nettle a lot recently. It sure does look like he’s to become my guru. He’s AWESOME. I mean it’s really great to be able to talk c++ from a guy who’s viewing it from the same viewpoint as me: graphics (eg. he explained to me quite gently that I should slowly move to using STL). Also he’s a great explainer of even the basic things I don’t understand and and already helped me fix the error I mentioned above that I wasted about an hour on with no results. Now I’m sending him another one. Oh, almost forgot: he talked me into starting doing otherwise than I do/did usually. I would have normally not worked on Roarrr until I finished the Effective C++ books. But now I’m starting to slowly also work on Roarrr. It’s really helping me get off a bit of that unproductive frustration I’ve been gathering again. I’ve really got to get online soon and update the online version of this doc.
Saturday, September 30, 2000
9:06 AM
Ok. I’ve found the reason for a really annoying problem. It seems I am creating infinite loops with my #includes. It seems this is still possible even with the #ifndefs. eg: rPoly.h has an include to rPlane.h and the other way around too. Now I also need to find a solution.

Monday, October 02, 2000
7:40 AM
I’m quite excited. I’ve found out how to solve the include problems (with “class someCalss;”), coming up with a personal rule (that I assume others are using too): I use #include-s if the class I’m currently building has as it’s subcomponents one of those files and forward references (fancy word that I got from Paul) when not (eg. rVertex needs rPlane but it a vertex doesn’t contain a plain so I use this). So without actually being able to run I can now say I’ve compiled rVertex, rPoly and rPlane with the rest. I think I’ll be reading 2-nd part of Thinking in C++, the one about standard C++ libraries, the one I never thought I’d read as “I make my own libraries”. Still Paul convinced me that I really should use the c++ libraries (the STL … is it the same thing?). I don’t want to read the MSDN stuff on it because they’re bound to trick me into using some MFC stuff, beside the fact that I don’t want to get into, isn’t at all portable. I’m also still reading the “Effective C++” and “More Effective C++” books.
Wednesday, October 04, 2000
6:29 PM
uni is wasting my time! Luckily I’m regularly printing Thinking in c++ and I’ll be able to do something useful while over there (I might even be able to think on Roarrr). Btw, I haven’t mentioned yet but now that i’m convinced I should use STL I’m reading the second part of Thinking in C++, the one I didn’t read before because I was thinking: “me use libraries? naaa”. I’m with a lot of half code right now and I don’t know what to do. I mean, I’d like to compile even if there’s nothing to see (bsp or anything else isn’t done) but then I’m thinking: what kind of structure should I keep my world in. THEN: what happens to the rest of the code I’ve written thinking I was going to make my own lists and trees and everything. Should I use STL lists or not (if I choose to do so then I first have to read about them, and c++ style file I/O — yes, I’ve been using C style stuff). Ok and back to my older problem: what should I start from. I don’t want to start from anything but that hardly seems like possible, so I’m down to 2 options: NeHe windows opengl framework or Glut. I think I’ll be going for NeHe’s framework because this way I don’t have to carry glut.dll around … but then again portability is an issue (I !want! to get it working in Linux too). I don’t know (when I started writing this I was sure I just have to read NeHe stuff again so I’m sure I understand it well).

6:39 PM
wait a moment: at the end of the lesson of making a do-nothing opengl program (the framework I mentioned) there is something about some linux code for that lesson. That means I might still be able to use NeHe framework and still get linux portability (maybe also not losing what I think I’d lose with glut: more options and double buffering).

6:44 PM
ok. nehe be it. I’m going for reading and understanding a bit of that stuff (i’m not particularly interested in windows speciffic code to tell the truth :))

7:27 PM
atm I’m slowly buiding up the basis for everything: I’m slowly reading through the NeHe doc and copy/paste the small sections of code :) . In the process I’m also getting and trying to get something I’m really fond of: REALLY pure separation of what is OS portable and what isn’t.

7:44 PM
this is advancing so slowly I’m actually understanding stuff (some might argue I’m even thinking)

8:42 PM
man, time sure passes fast sometimes. I mean it’s an hour already!!! wow. No, it’s not like what I’ve been doing was really interesting … it’s just that I’m surprised I didn’t notice I’ve been at it for so long. I’m actually happy to know 1 hour passed because that means: 1 hour plus for Roarrr (which is quite remarcable thinking how lazy I sometimes feel I am). … and the printer’s still printing !! (yep, it’s a really slow printer)

9:09 PM finally done. Now to try to compile this empty black screen :)
9:12 PM ok. cool. That’s that. It wasn’t really interesting but it did get me the feeling like I was seriously working which is good for my morals. The bad part is I was hardly thinking (that thing that usually gets me frustrated and feeling like I’m doing nothing) :) … but hey, I was too busy working to actually think (it’s a lot more confortable to just read and copy/paste). enough of that.
9:21 PM Now Roarrr has only 1 file in the workspace “win-ish.cpp”: the Nehe OpenGl framework (of course I haven’t deleted the other files. I’ll just be adding them to this). I’ve changed all the function names when necessary so that now only the functions that don’t contain “GL” are windows only. The others I have to watch out for when I’ll start porting for linux. It would btw be a good idea if I started doing that while the project contains very few files so that I can build-up there too. Well that’s enough of this for today (and i’ve also got stuff printed out for me to read at uni).

Thursday, October 12, 2000

r mayte. It’s been a while, huh? Well, that doesn’t necessarely meen I’ve been lazying around although I may have. Actually stinkin’ uni’s been taking up my days walking from home to there and back. Last couple of days I’ve been trying to actually think “design” for Roarrr. Not much came out of it. Here’s a short briefing (cut ‘n’ paste from what I’ve recently wrote Paul Nettle):

-i’ve still got my old doubts about using the kd-tree: it’s nothing conceptually
different from the bsp tree.

-I’ve just about decided that as a first step I should just implement the bsp
class (maybe from what I’ve written already, maybe start from scratch).

-I have really mixed up thoughts about having a couple of fundamental classes
that communicate but I’m afraid I’m doing the mistake of getting too OO (I hear
it’s a common temptation for people starting out with c++): a rWorld class, a
rWorldStructure class and something like a rRenderer class. It would be nice if
I could design things so that for example when I finish this first stage and
have a bsp to render with I can have a clear place to modify (the
rWorldStructure) so that things work just about exactly the same after I add the
kd-tree and c-buffer. This is something I haven’t been able to imagine yet. All
I have in my mind is a slight image of something like “rWorld asking
rWorldStructure to create a list of polygons for this position in space” ..
which gives a “core dump” in my brain after a while.

-I think rWorld should have it’s loader from file, but then again so should
rWorldStructure (a bsp in the near future). I was scared of saving a structure
like a bsp in a file because of it’s recursive nature, but I now think for
exactly that reason it might be ok.

-wouldn’t it be nice to have a base class for all the trees I might implement
(bsp and kd-tree for sure, maybe octree someday …)? I don’t know. Why should
I? Wouldn’t it just make life impossible (having 3 splitter planes not one is
quite different).

-when I first load polygons from a file (just polygons, not bsp or anything like
that) should I keep them in a
currentPoly=new rPoly();
rPoly *nextPoly;
type list or should I make an array of pointers that I allocate memory for? I’m
choosing the list because it would seem to be more flexible (I can add/delete a
poly from the list at any time). but maybe I shouldn’t. don’t know.

-I’ve looked over NeHe’s OpenGl tutorials again and he’s added a couple of new
ones. this brings up the problem: it’s on using DirectImput so that you can use
the mouse for 3d shooter type games. This means I would now be able to do that
but this would be another (impossible) bridge to cross for my Roarrr in both
windows and linux dream (I’ve accepted the idea of using Glut at least in linux
to start the window and for imput … wait a moment, maybe there’s something for
the moust too in Glut).

-i’m at a crossroad again: start coding on the few-to-none ideas I have in my
head or try to think some more.

right this moment I’m trying to move all the OpenGl functions to another file and still compile the same old black screen

9:53 AM note to self: if you don’t want to find yourself really fucked up with an error in gl.h you MUST include windows.h before gl.h (man, and this is not the first time it happens to me!).

9:56 AM ok, clean 2 files. One ONLY for the windows stuff and the other for Ogl! I better re-check by eliminating gl.h again that the windows file is completelly windows though.

10:02 AM ok. changed a “Gluint” to “unsigned int” and then test passed.

4:33 PM I sure felt horrible today and last night. Probably something I ate. Anyway I’ve just woke up (sleeping almost continuously since yesterday evening) and I think I’m in working order. During this time I was even able to think about Roarrr a little. I think I’ll be taking the approach idea Max Gilead gave me for the class design: first stage write a lot of empty classes and member functions and then when I like that I go to actually writing the code. This should really keep a clear separation between thinking correctly and implementation details. Another good news: I just got an email from somebody telling me that he’s found the OpenGl libraries I’ve been looking for (the ones that have multitexturing in the standard). Cool, huh? Anyway that won’t be in the first version of Roarrr, but it’s still cool. I think I’ve decided that the first version will be called 0.01 and will be finished when I will implement the bsp tree and compile and run with that. Ok.

4:56 PM I’ve just compiled correctly with 8 files in the project. Their content is hardly useful, but it’s cool. Still, before moving on I though I’d look at “Effective C++” chapters again: I realize there’s so much I should read and I think I’ll actually do it before designing everything and finding myself re-writing everything. Ta daaa.

5:27 PM I’ve reached Item 18 of “Effective C++”. Now I’ve reached a particularly useful looking group of items: “Classes and functions: Design and Declaration” (I’m all about design right now — although I don’t really do it much).

5:35 PM I just had this quite nifty idea while taking out the trash: how about mixing some “Effective C++” with some “Thinking in C++”. Beside seeming like a generally good idea for my getting-bored-real-fast illness it might provide a very satisfying solution to another one of my problems: mixing reading with actual coding (the later being the one that usually gives me productivity satisfaction). While reading about Iostreams (yes, I’m thinking about divorcing “fprintf” & co) I thought that when I’d get to that with Roarrr I’ll have to stop what I’m doing and start experimenting with files. Well, how about doing that sooner? :-)


9:55 PM well, in short: uni life, the good, the bad and the ugly. Today I’ve only been home for about 1 hour at noon (excepting after 7pm and before 7am ). Fun, huh. In that time I installed my mandrake linux again. Good news: although I think what I’m doing at school is totally useless I managed to get the teachers to let me work on the one linux system over there. Even if I have to pretend everything at least I know I’ll get some more active linux time, which is always a good thing, even for Roarrr. Oh, and mustn’t forget: I think I got the libraries with the recent implementation of OpenGl. CoOool! night,


Thursday, October 19, 2000

12:06 PM
well, forgot to write here, but today I finally feel like I’ve got some work (actual code) done. I’ve about finished the skeleton of rPolyPtrGroup class, which is going to be the one holding the pointers to the sorted polygons. Cool. Although I’ve done very little as far as amount in concerne: a .h file with 52 lines took me more than 1 hour :) I don’t feel frustrated. It’s cool that I’ve done this and if this is here to stay (after I also do the implementations) then it’s something well done. On the topic of the Ogl libs: nope. It seems not even the .h and .lib files I found in MS Platform SDK 2000 contain the ARB_MULTITEXTURE string. Hmmm, maybe I need to inform myself as to how multitexturing is done. But for now that is not a priority. It won’t be there for 0.01 as I first thought.
(hmmm, it seems I forgot to add a date for the last couple of days. I’ll have to remember this.)


Sunday, October 22, 2000

11:46 AM well, hope to get something done today. Today’s interest: file loading (at least the interface). Right now I’m looking into how textures are handled in Ogl so that I know what/how is the minimal data to store for a textured polygon in a file (yup, not trying to learn a file format … trying to understand how one should be).

11:51 AM I’m still unclear as to how Ogl expects to receive it’s textures (obviously a GLuint isn’t enough storage for a texture :))

12:08 PM I’m going to re-read the texture mapping chapter of OpenGl Redbook
12:09 PM hey, maybe I’ll also read the texturing in OpenGl 1.2.1 specs. Maybe this way I’ll also get a more formal introduction to texture objects! (maybe I didn’t print most of that book for nothing after all!)

8:00 PM
(hmmm, this stuff I’m just writing Paul Nettle is just right for what I forgot to write here)
I recently found out about something called SDL which might provide this skeleton for both linux and windows and give some other neat stuff (keyboard, sound …) crossplatform. I might decide on using this one since it seems I can’t find another way of doing this. Critical points I would need an external library for (however I hate the idea):
-opening a window or fullscreen at a certain resolution for which I can do double buffering
-loading some pictures (jpg, bmp ) for textures
-keyboard management
I found about it by trying U3d engine. I got in contact with the guy developing this engine. We might have some colaboration.

Right now some of these I know how to handle but I’m not happy with it:
-bmp loading (glaux)
-Nehe opengl framework opens the window and handles the keyboard input (windows
-I could use Glut for the same thing
But every library I use means more requirement for whoever would want to try the
engine. Eg. every system I’d want to try it on I’d have to assume they have
these libraries … which is a really non-realistic thing. If I do use some
libraryes (and it seems there’s no way around it … although at least the Nehe
Ogl framework was just a file I compiled with my code that used standard windows
stuff) I want to use as few as possible (hopefully only one).

Wednesday, October 25, 2000

4:49 AM
Well, big decision was taken tonight (almost in my sleep): I’ll be starting a design doc!!! That doesn’t mean I’ll give up on “The chronicles of Roarrr” though. That will be a short(er) file, only containing the current stage of things, not the process through which I got there. There’s a good chance this will include that. Ok, bye now. I’ve got to spread the news and get started!


Thursday, October 26, 2000

9:09 AM
Well, I’m working on the design doc. It seems that will indeed reduce trafic on “Chronicles of Roarrr” as some (most?) stuff that I write there, for a sec, I end up deleting imediatelly … and I don’t feel like copying everything like that here. We’ll see what comes out.

10:40 AM well, off to school. And I think I haven’t used even half this time actually designing :( … but it isn’t totally wasted either :)

Friday, October 27, 2000
8:49 PM
for the last hour or so I’ve been working with Roarrr design pages. I’m writing in html, and am trying to also give it a nice aspect. Beside the general descriptions I’ve created a classes.html where I’ll keep a brief description of the classes. Right now I’m trying to figure out how rBspTree should work. Should it include rBspNodes ? How do I make in-class classes. How should the allocation and destruction happen?

9:13 PM can’t focus right now. I’ll try to read some “Effective c++”.

Saturday, October 28, 2000
10:31 AM designin’…
10:40 AM hmmm, small (and highly welcome) degree of satisfaction as things seem to be hapenin’ (I actually wrote a couple of lines :)).

11:03 AM I should start thinking what kind of file I’ll be loading from (the editor). I’m was thinking UnrealEd, but maybe I should try 3ds. … hmmm, I myself like working with UnrealEd!

2:32 PM I feel quite good about myself right now. I’m really not well (I think I’ve got a nasty cold) but I managed to keep doin’ useful stuff. Beside the fact that I actually touched a math book (“wooow!”, huh?) I’ve just read a bit on STL in TiC++ and I’m quite excited about it. Seems really nice. Also there’s a mention of some online references which I’ll have to check. It’s really something I’m interested in right now as the class rPolyPtrGroup is really a container class. Maybe I could save myself a lot of trouble by using STL? Only question remains if I can customize STL containers to be not-too-big memory wasters in case I’ll place only 1 (or very few) obect(s) into them. Anyway, I think it’s going to save me a lot of work (AND prepare me for the future).
Sunday, October 29, 2000
5:54 PM I’ve been reading chapter XX of Tic++: “STL Containers and Iterators”. I’m very happy I let myself talked into STL. Yup, it seems it will save me quite some work. Actually I think the whole class rPolyPtrGroup on which I spent about a Roarrr day’s work (my work days are 1-2 hours :) .. hopefully will increase with time) only designing it. It seems I was simply making it into a type like ‘vector’ (just not as good). Only question with it is how I’ll handle the extreme case of using it for groups of very few polygons (maybe just one) without wasting memory (in the case of the list of pointers to a huge number of polygons I don’t care about a little wasted mem, but in the case of the polygons that lie on the splitter plane of a node I do). Maybe by specifying the number of polygons I will need to 1 or, even better by making it flexible during the bsp build and resize()-ing it after I’ve finished building to the number of polygons actually in there.
Thursday, November 02, 2000
9:14 PM
hmmm, It’s been a couple of days since I wrote anything here. But that by no means means that I haven’t been working on Roarrr (despite the fact that usually at the begining of the week I’m terribly busy with uni). Actually, I’ve decided to officially declare “preparations phase”, because now I’m reading docs and trying to imagine the global picture of everything. Docs read recently: “Generic Collision Detection for Games Using Ellipsoids” and “Radiosity In English (Part I)” by Paul Nettle. These got me into lighting/shadows and colisions for the first time (actually Jorrit had taught me some stuff about lighting before). I’ve also re-read these today and I’m starting to understand them :) Actually while thinking about light patches I think I stumbled upon an idea that would provide jpg-like compression (losing quality) for pictures (I’m very proud of this). Today I’ve read “Decals Explained” By Nate Miller, “Doing Your Own Lighting” By Sam Barham and “Matrices can be your Friends” By Steve Baker. During computer science class I wrote down on a big page how my file format should look. It looks way more serious now that I’ll have objects, shared vertices, textures, lightmaps …
Saturday, November 04, 2000
7:09 AM
we’ll be writing in the doc now, won’t we? (the design doc, of course)

10:45 AM (don’t worry — to my shame — I haven’t been working all this time) I’m starting to see that I don’t end up writing in this doc anymore … and it seems I’ve just cut away a relavilelly big portion of text which didn’t make sense anymore. Lost forever … not quite: I’ve still got it up online. I think I’ll download it and place it here… for the history of it: the whole #short term goal# section went down. Also anything related to rPolyPtrGroup (which will be replaced by STL’s ‘vector’. Btw, I’m starting to feel the need for both rKdTree and rBspTree to be be of compatible types (I’d like it if when I reached a leaf kdnode I could simply go deeper with the bsp in the same way (and keep it’s child bsps as if they were kdtrees).

Saturday, November 04, 2000
6:24 PM
come to think of it for about 2 days now Roarrr has gotten it’s first offer. Well, more or less. Anyway Muresan Robert (has/had a tech column at flipcode) wrote me, we talked a bit and he sugested it is used for a game that would be paralel to the one that would be developed using his engine. Well, I think he would have liked a terrain engine … but I’d like to think that Roarrr has just gotten it’s first offer :))))) (ps: hope he don’t mind his name here)

Sunday, November 05, 2000
5:59 AM
Ok, before making them forevr dissapear I’m including here the sections that got clipped out of the design doc (just getting them from the online version… before I update):
## Short term goal ##

}} version 0.01 {{

-a bsp based rendering engine.
-the world is just thought of as a series of polygons (no other structures for now).
-compilation of the world into a bsp happens at startup (expecting relativelly small world for now, just for testing)
-igonore the issue of shared vertices for now

A normal program execution:
-rWorldLoader reads the file containing the world (“world.rrr”) putting all the polygons in a rPolyPtrGroup. The rPolyPtrGroup is passed to rBspTree which uses it to construct the bsp tree.

in the main loop:
-handle player movement from keyboard input.
-depending on player position rBspTree returns a rPolyPtrGroup that contains the polygons back to front. This is fed to rRenderer which (surprise!) renders the polygons (without z-buffer).


and then


is a group of rPoly pointers to which you can add and retrieve from sequentially. Conceived mainly for passing the polygons to be rendered after they’ve been correctly sorted.
-it is not responsible for cleaning up the memory it’s pointers point to. That should be allocated and freed outside of it.
-other uses for this structure:
loading the world
keeping all the polygons on the same plane inside a rBspNode
-because it is to be used so often (every frame) we don’t want it to keep allocating and deallocating small pieces of memory. This it grows by a constant GROWSIZE. It is a bigger number by default but it can be passed as a parameter to the construtor in order not to waste memory in the case of 1 (or very few) polygon structures.
-Back to the rPolyPtrGroup used every frame: it keeps growing automatically when you add polygons to it, but doesn’t shrink back. This results in the fact that it dynamically determines the average number of polygons that gets displayed every frame and stays about that size.

7:37 AM reading something on particle systems. I’ll also have to get some idea on curved surfaces (where/how they can be integrated with polygons).

9:31 AM Just had a short peek at “run time type indentification ” chapter in TiC++, and it seems it’s got the solution I was looking for. I might be able to treat rKdTree and rBspTree as the same type for some operations (with a base type, prolly rBinaryTree) and yet be able to differentiate them for others … I’m thinking about checking for the bounding box of a rKdTree).

11:14 AM well, finished skimming through “RTTI” chapter. Yup. It’s what I need … or maybe not. While reading through it I realized there might be 1 (maybe a couple of) obvious solution(s) ot my problem: maybe a static member function for each class that returns it’s type.

1:21 PM won’t be able to note all the changes here. too many and too small.
1:34 PM I’m quite fond of the rTree structure I’m just coming up with. It’s only fit that there be a rTree class that knows how to handle the details of both rKdTreeNode and rBspTreeNode … and does it elegantly by ignoring their differences most of the time.
1:41 PM can’t make up my mind if rTree should be responsible for passing polygons further to children rKdTreeNodes or not. If it would be it would make more sense, because it would know when to stop the process and start making rBspTreeNodes, but then I don’t really know how to make the recursive function. But while writing this I decided on the answer: the ideal solution should be the preferred one. I’ll find out how to do it (not knowing how shouldn’t be the reason for which I don’t do the right thing).
2:32 PM finished reading “Building an Advanced Particle System”. Not much practical use (didn’t teach me anything new) … but it’s very much a design doc, so I think it helped me visualize stuff I need to focus on.
Tuesday, November 07, 2000
6:23 PM I’m just reading somehting on Xtreme Programming, some approach to design. I’ve only started reading it. I’d say it’s not much use and I would be spending my time much better if instead I’d be designing Roarrr, but even this: coming face to face with others’ approaches, I think is somehow helping (at least in knowing that “this is a way I’m not going to go because ..”).

6:41 PM well, with all due respect to my friend Max who liked this I find it to be useless talk for me. What I did decide though is writing a specification of all the things I want in my engine … just so I know about how many they are :) (well, that must mean it did have a use, huh?).
Wednesday, November 08, 2000
7:21 AM After an email from Muresan Robert I’m beginning to worry about the honourless enough people who’d take my work and say it’s theirs (something like this happened to him on his first engine) … but I’d like to get back to my original way of thinking: let them be however they want. Somebody who’s copying somebody else will never get as far as the one he’s copying. Any stealing they might do will only make my engine more popular (in showbiz even bad publicity is good publicity).
Thursday, November 09, 2000
5:09 AM k. Hope to get something done today (unlike these last days … but then again it’s been the critical first section of the week when school’s wasting my time). Anyway, this doesn’t makethe difficult task of focusing and designing any easier (yup, I’ve got to actually focus and think).

5:41 AM let’s say I try to focus by writing down here: ok. so how would I like things to work? Well, pass player position to rTree and simply get from that all the polygons to be rendered, in a front-to-back order. Is this possible? Why not? ok, so, what’s rTree going to do with things? (time’s passing)
5:45 AM (got to think low level and express myself high level) Ok, so the rTree already has all the geometry in it’s grasp (held in rTreeNode-s.

6:16 AM as can be seen, I’ve given up writing here as I try to think (yup, it does hurt). It’s too slow.
9:03 AM reading “Implementing Curved Surface Geometry” by Brian Sharp.
10:00 AM no, I’m not working on Roarrr. Playing with my keyboard (not the one attached to the PC), listening to music, trying to play-along. Just wrote this so whoever might be reading this doesn’t assume I’m working on Roarrr more than I am. Not that I wouldn’t like to take the credit … but I don’t deserve it.
10:04 AM just got the idea that I really should start printing stuff for me to read at school today.
Friday, November 10, 2000
6:09 AM
just added this to the sourceforge site diary:
“well, today I’ve started the formalities for getting a web
page at Sourceforge for Roarrr. Another notable thing is
that I’ve choosen public domain for it’s licence.” :)

8:18 AM wow. awesome thing. I’ve got an idea. I’m reading “ASIRON 3D ENGINE” whitepaper (very interesting and I think useful) and I’re realized a great idea. I’ll call this technique portalization. Roarrr is not a portal engine, that’s clear, … but how about I lose the disadvantages of portal engines (generating (optimal) convex sectors from arbitrary geometry) and keep the ups: there will be certain polygons that will be only flags. Let me explain: you’ll be able to say “all these polygons belong to sector1” … “all these polygons belong to sectorN” and if you’re in sector 1 that gets rendered but not other sectors unless among the polygons that would get rendered from sector 1 there is one that’s just a link to sector 2 … hmmm, 2 things I realized as I was writing this:
– if all the polygons are in the same tree … what’s the use?
– if they are in separate trees this is simply a portal engine
hmmmm, either way, it’s pretty cool. Let’s say that they are in the same tree: we have an extra criteria based on which
8:28 AM nope. not a good idea. That would mean traversing the tree once setting the flags and then again testing for each polygon. Nope. not good. How about if they were separate trees?
-no more unified tree. can’t imagine the results (you’d lose the world balancing provided by the kdtree).
Ok, that’s it for this idea. Looks like I’ve rushed with great excitement into “I’ve just come up with the ground breaking new idea” symptom again (I remember when after learning some assembly I started thinking up “the awesome new idea that going to compress better than any compression algorithms” :))).
11:08 AM I’ve thought about it a bit more, and it seems to me like this portalization is still possible. Still, somewhere I fee it’s not.
6:37 PM I’m dedicating too little time to Roarrr. I’ve got to have more discipline. Right now I’m trying …

Thursday, November 16, 2000
8:35 AM time’s passing things are not moving. Not good. Something’s got to be done about it (am trying again …).
Saturday, November 18, 2000
11:19 AM
I think I forgot to mention that at school Thursday I did some drawing of Roarrr’s main classes and their comunication and I think it helped. Right now I’m commenting a doc sent to me by Max Gillead. Maybe trying to understand his really “design is IMPORTANT” oriented design of his 3d library and modeller (Fictor) I’ll get some ideas for my not so idealistic design of a 3d engine (which is ok, ’cause here I am expected not to be ideal but fast). After all: I’m a graphics guy!!! :->

8:46 PM
Hey I think I’ve just gotten something done. Cool. A start for rRenderer and rObject structure (rWorld will actually be of type rObject).

Wednesday, November 22, 2000
8:08 AM yeaaaay! finished with this exam and we’re back to normal (is that good?). Anyway, I’ve slept since 3Pm yesterday to 7am today (and I don’t think I would have woken up if it wasn’t for Roarrr anyway). But how I remembered to drop by and write this: I was reading through the design doc trying to determine what to add to it. I got to the C-buffer and was about to write that it’s transforming of veritices from world space to view space must be done in the same way the rRenderer does it. So how’s it supposed to know how that’s done? Well, I think this would mean it’s got to be somehow related to it. But how? But the problem is that the Cbuffer is about culling geometry, which is related to the rTree structure and not the rendering part. How do I solve this.

8:17 AM and yet it is logical that the c-buffer should be directly related to the rRenderer. There should be hardware that can signal the stuff that the c-buffer does. Ok, I think it’s a decision: the rCBuffer has to be inside the rRenderer.

8:27 AM hey. Wait a moment! OpenGl and Direct3d may have different ways of storing their matrices, but truth be told there is only one unique set of screen space coordinates! Kewl. Cbuffer is then totally un-related to rRenderer, as it should be (of course unless I hear of hardware that can do this).

Thursday, November 23, 2000
11:03 PM hey, check it out: in UnrealEditor there’s a viewing mode in called zone/portal view. Could this be like the portalization I was talking about???!? :))

Sunday, November 26, 2000
12:34 PM I’m starting to think about the “nr. of hours per day work” solution again for me to get things done with Roarrr.
12:35 PM For right now I’m thinking about how I could do about colisions and conceiving that and writing it in the design doc.
12:40 PM which objects can move?
12:42 PM ok, let’s conceive movement: each object that can move has an associated elipsoidal bounding box (a stretched sphere). There is some kind of input for it that generates a velocity vector. This shows how far the player could move if there was nothing in his way (also no extra world friction). (btw, this is just a kind of description/re-interpretation of my understanding of Paul Nettle’s collisions paper). So we have a source and destination bounding box. We find the bounding box of the two bounding boxes and find all the polygons in the world that intersect this bounding box (they are potetial coliders). Now we transform this geometry to shpere space (the space in which the bouding boxes are no longer elipsoidal but spheres) and perform colisions here. These colisions will probably produce another velocity vector that should somehow be fed back into the system. … but how? Well, I could do it directly because the old vector still maintains his influence as the new one is produced from the old one. Oh, yes, and also compose the new vector with the new vector provided by user input or world activities, eg. some elevator movement. But how should this elevator movement be handled. An initial idea would be to have the player coordinates stick to objects it’s on so that when the elevator moves it’s position is relative to that. How can I do this? The problem would be something like this: I want that if a player sits on a box that is in an elevator that is in a spinning world the player’s position to change accordingly.

12:59 PM I was formulating the question for gCore and I think I’ve got an intuition of an answer: something like a linked list of base object that give relative coordinate systems that keeps building down (you can always add beneath it). but how? Ok, so each objects needs a support object. So, when the player/camera has the elevator as it’s support object than the player is only moving in his coordinate system which is than transformed through the elevator’s coordinate system, which is then transformed through whatever the elevator’s support object is (probably the static world). so, taking this further it would mean that each time the player steps on a platform his position is no longer in wold coordinates but in coordinates relative to the platform’s origin. So, if the platform moves he moves. The other option: his coordinates are still in world space but he receives messages from the object he’s standing on giving him a velocity upwards. Hmmm, how’s this for a solution. Well, this would work ok for just the simple special cased player but then to get the same behaviour for all the objects we’d need a system for passing this kind of messages from one object to another. The handy part about this is that we could use it for something like having an explosion send a message to all the objects around forcing them to move. Hey, this isn’t even an extra feature as we must have things like this going on for mosters and the kind (am I getting out of graphics programming and into physics programming here?).

1:14 PM the clear approach would seem to have a “support object” for each object (including the player position)
1:15 PM it seems I’m redefining the term “graphics programmer” for myself. Now I also accept things that are not directly about rendering, … it seems.

1:22 PM how do I avoid having circluar infinite loops with all the support objects that may appear?
1:34 PM Ok, so what the heck do I have to think about? I’m continuously amazed at how incredible it is that whenever you formulate the question (well enough) the answers comes for free.
1:37 PM cool, I’ve finished my 1 hour working day for today. Of course today being Sunday and all it should be a 8 hour working day … but 1 hour will be the bare minimum for me with Roarrr from now on. Anything less will be “REALLY BAD” and I’ll have to catch up with it the next day.
Wednesday, November 29, 2000
7:03 AM bad: both last 2 days I haven’t done my “work hour” (FYI the first part of the week I’m usually very ocupied with school, so I would have a kind of excuse).
7:08 AM who should provide finding all the polygons in a bounding box. I think the rTree because it holds all the world structure. Btw, objects should be held in the tree as points. But where would these points go? Wait a moment? what if we held them as bounding boxes. We could then simulate rendering them and be able to find out if a certain object does
7:18 AM this would mean re-inserting these objects into the tree every frame.
7:18 AM ok, so the polygons need some kind of flags
7:24 AM should I flag if a dummy polygon would modify the screen or should i have it hold a link to the object it’s pointing too and flag that?
7:40 AM I’m adding the rBoundingBox class.
7:44 AM how can I determine if a polygon intersects a bounding box. If a polygon vertex falls inside the bounding box it’s obvious, but if the bounding box just intersects the center of a polygon ???
7:45 AM hmmm, now I’m really getting the feeling that an hour more or less on the project really does make a difference. But maybe it’s just that I’m productive right now (of feel like it because I’ve actually added something to the classes.htm).
7:55 AM Ok, so should the bounding box be polygons or should it be just the corners of the box. Well, for the tree we need actual polygons. Yes, they could be held here and have the tree hold references to them … as it does for all polygons? No, now I remember. The tree actually holds all polygons inside it. So, I could think of it a storage for things like polygons while the world is a storage for vertices.
8:09 AM I can’t determine what more do I need for rBoundingBox, and this prooves that I need to think about Roarrr’s design a lot more as I don’t have a clear picture of it yet in my mind.
8:12 AM I think I’ll call it an hour!
Sunday, December 03, 2000
8:13 AM Ok, time to catch up. Well, let me see: Monday, Tuesday, Thursday, Friday, Saturday, … but first today, Sunday. I wonder if I’m going to make it.
8:15 AM so, what do I do?
8:19 AM ok, rBoundingBox looks really down.
8:26 AM I’m getting more and more convinced that I should drop support objects in favor of a better physics system!
8:30 AM I think I’ll read a little on the details of polygon/line intersection.
9:25 AM I think we can say I’ve got an hour! Hurray. Now it’s only Monday, Tuesday, Thursday, Friday and Saturday left :0)
9:52 AM how do I handle dummy polygons? It’s clear that they have to be inserted into rTree, then pass through the c-buffer tests. So, all the polygons that pass through these tests AND are dummy polygons should trigger a rendering flag of the objects they are associated with.
10:11 AM big question: where should a bounding box (BB from now on) hold it’s vertices. Should it be integrated into an object? Should it hold it’s vertices inside that object, or inside the rWorld? Or should it’s hold it’s vertices on it’s own and be it’s own object. It would be nice if it were integrated into an object because it is true that it’s vertices have to be transformed the same way in which the object’s vertices are transformed. So why not? Well, one thing is that we must have independent bounding boxes (for the case in which we have to determine all the polygons that are intersecting a certain region in space). Ok, so maybe we should have a super class Box, or maybe have them be 2 independent things. So, what would happen to the vertices and polygons of a BB? The vertices would be inside the object. The rTree shouldn’t care where the memory is actually stored as it should just use the pointers/references it gets. The only thing that would be different for it’s polygons than the normal polygons would be that their memory is not stored in rTree but in the BB. Would that be a problem? (it’s questions like these that nobody other than myself could answer me. they’d say it can be done but I’d understand/imagine nothing). No! the rTree doesn’t care at all as to where the memory that it’s pointing to actually is. It may be a bulk of memory that is only referenced by the pointer it is holding to it or some memory that actually is held by somebody else … it doesn’t care (and shouldn’t!). So what happens to a BB? How’s about this: the BB holds it’s own memory for vertices and polygons but it is always inside a rObject. When the rObject’s vertices are transformed it also calls this on the vertices of it’s bounding box? Hmmm, sounds nice, but it still would be neat if it’s vertices were treated just like they were the object’s. Or would it? No, it would not be a problem about worrying that these vertices would get rendered because they would not be part of any of the object’s polygons.
10:26 AM well, it’s cool. 2 days done. Now it’s only Tuesdays, Thursday, Friday, Saturday … and I think I’m taking a break as my fingers hurt.
Monday, December 04, 2000
1:21 PM hi. login
2:05 PM logout . .. no work done
Wednesday, December 06, 2000
11:49 AM well, I’m here again … but as always … I don’t know. I’ve got just about an hour until I have to get back to uni.

Wednesday, April 25, 2001
1:06 PM
hi. this is really emotional. I’m back!!! No, I haven’t died, nor given up on making a 3d engine or left the 3d (game) graphics or demo world (“to leave something you’d have to be in it, right?”). I don’t even remember what I last wrote in here. Hmmm … and some stuff I wrote I think got lost. Anyways … I’m back (and I actually have a ‘itchy tingy emotional feeling’ about it). Well, does this mean that I’ve been lazying off. Not exactly. No I haven’t been working too hard on the project either. So what have I been doing? Living like most people do, spending my time … ooogh, sounds disquisting and shamefull but I might get pushed into admitting even some of that. It wasn’t a totally willing choice however: university has been somewhere in the middle of it all (and not because I enjoy or practice much learning the stuff they teach). On the more noble side I’ve been a bit into making some more music … but let’s get to the programming: the serious reason/excuse I’ve been off the project is getting involved into this mini-engine challenge that Paul Nettle sugested me. To make a long story short: where I stand right now is that I’ve got a little app based on his graphcs application skeleton that displays a rotating cube using a all mine matrix, vector and some aux code. This project however seems to be lazying off partly because of my not working enough when he had the time and Paul not having the time to guide me now that I’m out of the woods. I’m considering getting back to Roarrr full time. In these dizzy times however what I do know that I have to do is reading from “More effective C++”. Oh, don’t think I mentioned I finished “Effective C++”. I learned a lot from that book and I’m going further with this one. Indeed the key in my designing a good 3d engine may be me understanding C++ deeper and learning to think OO, like Paul sugested. But … I’m BACK!!!!! I’m alive!!!!!!!!!!!!!!!
1:19 PM oh, and forgot to add a moment ago: I had just finished reading through what may be the longest ‘item’ I’ve read (in these 2 books): a total of about 25 page-downs … I don’t know if that translates to ‘pages’ in real world (at 1024*768) .. but believe me it’s quite a lot more time than it usually took me to finish my “item a day” diet (note: a “item” is something like a chapter on a topic in the “effective C++” series).

Tuesday, May 01, 2001
7:04 PM well, I must be reading on this “More effective C++” item for about 2 hours now. 43 page downs. (counted again and yesterday it was about 30 … hmmm, that’s not yesterday, it’s : last time I read an item :P … almost a week ago).

7:24 PM I was hoping looking through the Crystal Space documentation would get me some insight into how somebody else designed an engine … but it doesn’t seem to be what I expected :O(

7:29 PM correction: there is a section “The CS engine” that might proove interesting.

Friday, May 11, 2001
10:24 PM Here’s a copy-paste from a mail to Paul Nettle on my progress:

well, obviously you’re extremely busy but I thought I’d send you a note on my progress:
I’ve finally finished reading “More effective C++”. Yeaaaaah! Now there’s only the
articles left. However there’s so much stuff in that book it’s scary (at least until it
will infiltrate my blood thinking about even a quarter of the stuff in this book is gonna
be quite scary). As you can imagine I would be eager to actually create some code for that
‘Roarrr’ engine I’m allegedly working on … but I’ve become quite aware that I need to
chill down until I learn more on this universe. As so, I would appreciate if you’d
recomend me some readings to help me along my path. Assuming that mini engine challenge we
started on is down my own ideas/plans would be:

1) aimlessly roaming around programming sites like gamasutra, flipcode, gamedev and
reading articles. However I’m a bit scared of this as it feels very “aimless” and without
an end

2) start learning Direct3d. I think I need to do this if I am to design a class that
abstracts OpenGl, Direct3d and software. Would you please recomend where I should start
learning from? Or should I stick to my initial once-upon a time plans of only making it
for OpenGl (that would stick ‘software’ out too, … and it kind-of gives me a warm
feeling inside because I could get onto the actual engine … whatever “getting onto”
might mean … )

Saturday, May 12, 2001
7:17 PM
just finished reading

comments: lots more blabber than I expected (general principles and stuff), but I think it got me thinking (like i’ve been starting to realize I might need to devote a lot more time to _preparing_ for the engine than I thought).

7:50 PM read another article, here’s the comments I sent to the graphicsCore group:

“Architecting a 3D Animation Engine”, by Scott Corley

comments: well, I’ve been tricked into reading this article. I guess I didn’t understand
the title well. I thought it would be about architecturing a 3d engine but it actually is
just presents an interface to a animation system. However that begining part story seems
very familiar to me (I especially remembered the phrase “full-on 13-year-old giggling girl
anarchy”), I’d say from about 2 years ago when I was reading some Michael Abrash articles.
Anybody else have that feeling? Btw, do you guys know anything about what Abrash has been
doing recently?

Sunday, May 13, 2001
6:03 PM well, other than the fact that the mouse acting up is driving me nutz I should say that I’ve read an article called “Exception Handling: A False Sense of Security” by Tom Cargill, attached to the “effective C++” books. Quite disturbing. Other than that: I’ve got a new mission in life: get DirectX 8 SDK and start reading the docs. Thus I’ll get some much needed info on how a graphics system interface generally acts (by comparing it to what I know about OpenGl) and maybe be able to design a general interface. Paul (Nettle) was very helpful (again) by telling me a real-live story of how he did this. Cool. Right now I’m looking into Crystal Space engine a bit (just trying to compile / understand some points out of the docs)

Tuesday, May 15, 2001
9:42 PM I think I’ve realized a new level of design. But first, status: got DX8 sdk and started reading. Back: but today as I was coming home from uni I thought to myself: I don’t really feel the need for all the complicated features DX8 looks like. For now I’d only want some way of passing an array of ordered polygons and their textures&ligthing and the class receiving it (wheater be it Ogl or D3d) to know how to do it (and for the data to be as close a match to their native data as possible). This is the goal. But while thinking this I realized that rRenderer must be an interface which I will describe by things like: I want it to be able to receive a list/array of ordered polygons … Then in all the engine I will work with rRenderer objects not caring if they are really Ogl or D3d objects. Well, I’ll try to write a bit of the design for rRenderer interface and then take a bath and go to sleep. I’ve got a lot of DX reading waiting for me tomorrow.
9:54 PM well, that new design thing didn’t appear to be that great after writing it down

Wednesday, May 16, 2001
11:28 AM hey, this idea is brilliant (from DX8 docs) for a matrix structure:

typedef struct _D3DMATRIX {
union {
struct {
float _11, _12, _13, _14;
float _21, _22, _23, _24;
float _31, _32, _33, _34;
float _41, _42, _43, _44;

float m[4][4];

with that union you can acess the elements both conveniently and as an array. Yeeeaahh!!!

1:29 PM Hey, this DX is full of neat ideas. Check out this sin&cos function:

float sin, cos;
sincosf(angle, &sin, &cos); // Determine sin and cos of angle.

No more problems when multiply acessing them when initialising a matrix.

2:45 PM well, this DX8 reading not only helps me with my stuff but also provides me with discussion topics for my graphicsCore group. I’ve just prepared a mail based on me not understanding how their “lookAt” matrix generation function works.

Thursday, May 17, 2001
6:00 PM howdy. Read a bit of Dx8 docs

Friday, May 25, 2001
8:05 AM
reading DX8 docs, still. I’ve been harshly scolded by Paul Nettle for being a programmer that doesn’t program … and I’m afraid he’s right. But I can’t get onto programming while I don’t know what, right?

11:48 AM I didn’t mention that I’ve started a ‘questions.txt’ doc which i’m updating for when I’ll get to ask someone. Here’s a copy paste of what it contains right now:

<start @@@@@@@@@@@@@@@@@@@>

D3DXMATRIX* WINAPI D3DXMatrixRotation ( D3DXMATRIX *pOut, float angle );
-what’s the ‘winapi’ thing?

typedef struct tagRECT {
LONG left; // This is the top-left corner x-coordinate.
LONG top; // The top-left corner y-coordinate.
LONG right; // The bottom-right corner x-coordinate.
LONG bottom; // The bottom-right corner y-coordinate.

what’s that last line stuff?


Another approach involves creating the composite view matrix directly. The D3DXMatrixLookAtLH and D3DXMatrixLookAtRH helper functions use this technique.
This approach uses the camera’s world space position and a look-at point in the scene to derive vectors that describe the orientation of the camera space coordinate
axes. The camera position is subtracted from the look-at point to produce a vector for the camera’s direction vector (vector n). Then the cross product of the vector n
and the y-axis of world space is taken and normalized to produce a right vector (vector u). Next, the cross product of the vectors u and n is taken to determine an up
vector (vector v). The right (u), up (v), and view-direction (n) vectors describe the orientation of the coordinate axes for camera space in terms of world space. The x,
y, and z translation factors are computed by taking the negative of the dot product between the camera position and the u, v, and n vectors.

These values are put into the following matrix to produce the view matrix.

ux vx nx 0
uy vy ny 0
uz vz nz 0
-(u*c) -(v*c) -(n*c) 1

In this matrix, u, v, and n are the up, right, and view-direction vectors, and c is the camera’s world space position. This matrix contains all the elements needed to
translate and rotate vertices from world space to camera space. After creating this matrix, you can also apply a matrix for rotation around the z-axis to allow the
camera to roll.

why/how does this technique work?

“Note Direct3D uses the currently set projection matrix in its w-based depth calculations. As a result, applications must set a compliant projection matrix to receive the desired w-based features, even if they do not use the Direct3D transformation pipeline.”
the D3d projection matrix !!!

what is an ‘adapter’ (as used in DX8 docs)
how about a ‘device’?
which one of them is the 3d hardware (video card) and which one is software, … if any.

<end @@@@@@@@@@@@@@@@@@@@@@@@>

Saturday, May 26, 2001
1:26 PM I’ve finished another section in DX8 docs: “Using DX graphics->Textures”. I think it would be safe to say that I’ve been at it for about 2 hours. I think yesterday I worked for up to 3 hours all day. This is good … well, actually it’s bad compared to the 8-10 hours per day that I wish to achieve someday, but it’s really good compared to the fact that I used to have a aim to have 1 hour per day for Roarrr dedicated and I rarely fulfilled it. Things are looking up.

3:27 PM Paul has given me another great advice which I’m gonna follow: stop only reading like I did and read the minimal DX stuff to get to try it out in a proggie, and so on so forth. Also feels good (I might actually feel like a programmer ;P).

11:37 PM this is a great day! I think I’ve got about 6 hours of work done already. YEahh!!!! I’ve nearly completed reading and playing with the DX tutorials (producing a lot of little eye candy apps in the process)
11:52 PM well, I think that’s it for today. It’s been a GREAT day! Hope for more to come (despite the exams <shivers> to come)

Friday, June 01, 2001
1:52 PM I’m quite frustrated with DX docs. I don’t feel they clear things up on HOW TO USE something!
Saturday, June 02, 2001
11:05 AM I’m starting work. Trying to make a DX8 application from scratch.
12:46 PM This is moving along very slowly, but I’m getting quite a lot more confortable with windows message handling stuff, the loads of typedefs and bla bla (eg. a ‘HRESULT’ is just a ‘long’ and just as I originally assumed a ‘LPDIRECT3D8’ is indeed just a ‘struct IDirect3D8*’). I’m also building myself a kind of neat framework in the process and maybe even learning the stuff I’ll need to abstract windows so I can have linux too.
1:57 PM IMHO the MSDN is really fucked up to search through. Yes, it’s got a lot of stuff, but it’s really a bitch to find anything relevant. Eg. I do a search for ‘true’ a C++ langage thing … and I’m swamped in junk (even after restricting the search to Visual C++ documentation)
2:16 PM a lot of the time the Visual C++ IDE had this handy dandy feature of showing me options of what I was typing for members of a structure, functions in a class. I was expecting this great thing to happen for Direct3d too … but it doesn’t. It’s quite sad as it would be a big help because of all the function names and structure fields :(((((((((
2:32 PM the D3DCREATE_HARDWARE_VERTEXPROCESSING is actually what we call hardware transfrom (the T in T&L on video cards), right? But what possible use could mixed mode have? I can’t imagine any scenarios.

2:44 PM In what way is a D3D object connected to a device that is built with it? Is the device dependant on it? What would happened if we killed it and left the device alive?

3:00 PM Incredible. Almost 4 hours of work to produce 134 lines of code doing nothing but present a red window :P but I believe I’ve learned alot. Cool. Now I’ve got a clean framework of which I know every corner, because even though I’ve greatly copied it I did it inch by inch, typing not copy-pasting and looking into what I was doing. I’ve even read some stuff on the windws message handling loops. I iz a content man. I might turn into a real tough ass programmer after all (now I’ve achieved about 4 hours of work a day a couple of times :P) and with that I think I’m taking a undefined break :P

3:06 PM oh, and did I mention that I tried subscribing to be a nVidia devoper (meaning just that I’ll get more access to their site). I wonder if I will get that :P

8:27 PM I’m back, reading the article “Coping with Exceptions” by Jack W. Reeves.
8:55 PM I’m shittin’ my pants reading this article and remembering the other warnings in “More Effective C++” about exceptions. Is there no way to write fast (and confortable, please) code that works well ?
10:30 PM well, finished reading the article and I don’t feel like I’ve gotten anywhere except the fact that MAYBE I should avoid classic C constructs like ‘thearray[i++]=elem’

12:23 AM Hey, I’m getting productive at this (happy happy happy). Now I’ve been reading through 2 nVidia slide-type docs that I’ve downloaded: one on common DX8 mistakes and one on general DX8 overview. But check out the time. Must be another hour, maybe hour and a half for today. That would be 4+1.5+1.5==7. VERYY good :)))

1:11 AM I’m downloading quite a lot of docs from the nVidia site, mainly on vertex buffers.

Tuesday, June 12, 2001
7:20 AM Finally I’m back. I hate uni! (did I say that before?) Well, I’m in examination period … which stinks … but after that follows the summer holliday … when I hope to finally have alpha 0.01 release. Right now I’m trying to learn vertex buffers.
8:03 AM less then an hour’s work and I’m off to eat.
3:30 PM I’m in a state where I’m about to start crying. I don’t know what to do. I mean … I’m off to learn DX8. What does that mean NOW? I said to myself I’d learn vertex buffers. I’ve read or skimmed through just about all docs I had on them (DX8 docs and some I took off the nVidia site) … but everything is fairly advanced stuff and I don’t know where to start. Worst of all to try them I need some geometry. How do I get that? Do I start making an editor? Now that’s a huge task (just thinking about how to implement CSG is scary). So what do I do then? Obviously indexed triangle strips are best … but how does one get those … and are they of use in real .. game situations (just made a funny)? So what do I do now? No more tutorials to guide me .. and I’ve been playing around here and there not knowing what to do for the last hour or so. I know I should find out myself what to do … but this doesn’t seem to be taking me anywhere. I could use some advice.

Wednesday, June 13, 2001
5:10 PM well, to my little downer yesterday Paul Nettle gave me a shamefully obvious answer: if I need a tiny step forward then I should make a spinning cube :P
8:27 PM HEY, though I don’t feel much progress I guess I have been at it for about 3 hours now … and didn’t even notice. Neat!
9:28 PM well, now that I think I’ve finally written all the code needed for my lovely spinning cube I get an error such as one would get from trying to write outside video mem. I iz taking a break. Write in 4 hours for today :))

Monday, June 18, 2001
1:48 PM today I’ve been trying to figure out a weird crash in a call to CreateVertexBuffer. But since I’m getting nowhere with that I think I’ll try to build a timer class.
2:26 PM my big problem: I don’t know what I wanna do … except in the far future. I don’t know what to do right now!
2:54 PM I’m starting to figure out how the t3d unreal file format is. This could be a geometry provider for me :P
4:09 PM Just finished lunch and some arends. I’ve been thinking and I’m in quite a confusion. Until then though I think I’m gonna try do some file opening & reading, with finding a string inside. This is something I’m gonna need anyway.
6:46 PM well, I’ve run into problems with reading a line of the type

Vertex +00128.000000,+00128.000000,+00128.000000

from a file. I think I’m gonna go to sleep for now and maybe cry out for help tonight on some irc channel or mailing list. I’d like to read it in c++.
Tuesday, June 19, 2001
11:55 AM i’M BACK again (sorry, uppercase from D3D constants :P). Partially thanks to Paul Nettle now I’ve got that error fixed. Seems I was calling a function at some in-propper time.
12:47 PM I keep getting junk stuff on screen
Sunday, June 24, 2001
11:33 PM i’M NOT doing very well. errors beyond my understanding (something with the indexbuffer and it seems even D3DCREATE_SOFTWARE_VERTEXPROCESSING has some influence).


Thursday, July 05, 2001
8:54 PM I’ve got 2 incredibly great news to write down now:
1) I’ve finished my examination period. This is the summer holiday!!!!!!!!!!! The time has come. This summer I must release at least ver 0.01 of Roarrr !!!!!!!!
2) I have just managed to get a spinning cube with pretty colours going!

Monday, July 09, 2001
4:44 PM well, now I’ve got a textured cube.

Wednesday, July 11, 2001
6:04 PM did I mention I’m working over here :P I’m starting to get some hang of loading from a file a texture.
6:38 PM Yeah!!!!!! I’ve got mipmapping (not only loading but also displaying :))))) Oh, and i’ve also been able to log something to a file (don’t laugh! I feel it’s an improovement. It was something I didn’t feel I knew how to do). The challenge now when I feel this satisfaction is to keep on going (and NOT go on a walk to celebrate!)
8:13 PM Yeah!!!!!!!! I’ve got a tweak of a fullscreen going. My first dx fullscreen :)))) Me take-em break/halt
Friday, July 13, 2001
2:01 PM The question now arises again: what can we do today for the glory of Roarrr (Raorrr ;P). I’m thinking either fonts (Paul Nettle’s font loaders or geometry … or mode switching)
Saturday, July 14, 2001
4:51 PM ok, hope of a better day today.
5:06 PM no more cursor in fullscreen
5:17 PM I can’t seem to figure out how to load a texture from memory/fill it.
6:24 PM I’ve now clearly stated what I don’t know/understand. Enlightment should come :) … beside the natural law of enlghtenment coming after you clear up your questions I’m also confident because I’ve asked Paul Nettle. Here’s a copy/paste of most stuff:

needin’ your help again :->
I can’t figure out how to actually fill a texture. I’d need this for something/all of the

-if I’ll use your .f files I can get them loaded into memory using your code (I wonder if
that could be done with the iostreams stuff, not the c way?) but then I don’t know how to
make them into a texture.
-let’s say I wanna load a font/character from a file. I may very well not wanna have 255
.bmp files but one with all the characters. Right now I only know of
D3DXCreateCubeTextureFromFileEx … which seems to work (even to generate mipmaps :))) …
but only loading one thing.
-for the lightmaps inside the .oct files

The only seemingly useful functions I can find up there are
D3DXCreateTextureFromFileInMemory and D3DXCreateTextureFromResource

… but they both involve resources … which from what I’ve been able to find out about
them from the MSDN (searching in there is sure a confusing thing) have to be specified at
compile/link time … prolly with that resource editor that VC has. So I’m at a loss. Even
if there were some class that would have something like DrawPixelIntoTextureAt(x,y) I
would be happy. Come to think of it I can’t even find a
‘replaceSubtextureOfaLoadedTexture’ function.

on another topic maybe you could explain to me how texture stages work. I’ve read about
them and tried to get it … but I have not yet been able to. Here’s an example that
suposedly implements color lightmapping. if you could explain it to me step by step what
it does and why it works I’d be really happy.

d3dDevice->SetTexture(0, lptexLightMap);

d3dDevice->SetTextureStageState( 0,D3DTSS_COLOROP, D3DTOP_MODULATE );
d3dDevice->SetTextureStageState( 0,D3DTSS_COLORARG1, D3DTA_TEXTURE );
d3dDevice->SetTextureStageState( 0,D3DTSS_COLORARG2, D3DTA_DIFFUSE );

here’s what I understand based on the DX docs:

sets the ligthmap as texture 0
sets the operation between the two arguments to be a multiply
sets argument 1 to the lightmap
sets argument 2 to something about a difuse colour interpolated. … but why isn’t the
second argument to this operation the texture on stage 2 (eg. the real texture mapped onto
the lightmap). Where/when does that come in? I understand that the texture stages are a
kind of cascade where the result of one falls onto the lower stage … but how do you
specify that the texture on stage 1 for our example simply falls (no processing) onto
stage 0 … and why isn’t it one of the members of the operation performed on stage 0.

would adding something like
d3dDevice->SetTexture(1, lpRealPolyTexture);
simply do it? why? And what would it then take to mix 2 textures (I still wanna sometime
do that neat effect I saw in Unreal when you got close to walls, which I think is done
something like: from a certain distance the detail texture gets a bigger and bigger
percentage output, up to say 50% as you get close and closer to the wall)

7:00 PM just sent some emails (also to the graphicsCore group). I think I should take a break about now (at least for my eyes)

8:26 PM Yesterday night/this morning I read another article attached to the “effective c++” books: on object counting. Moral of the story if I can remember it well is to implement it through private inheritance. wait, let me check: yep, that and the “Do It For Me” pattern (where you make a template for the counter class and instantiate with the class you want counting for in the private inheritance (hey, this saying things out loud really helps in understanding/remembering them). Now I only wonder what I should do right now: I haven’t gotten an answer to my loading a texture questions from anybody (not even the DX list … I’ve got to find a good active one!). So, what to do now?

8:35 PM ok, so what to do? maybe writing it down will clarify things. How about writing a checker to see if a certain video mode is available so you can switch to it. How should this look? How about a function that takes as a parameter the desired resolution, colordepth ….
8:41 PM while looking into that: I’m ashamed. so ashamed: IDirect3DTexture8::LockRect … that is the answer!!! that is how you update a texture … so ashamed. And the exactly same thing happened with vertex buffers. I should have thought of it!!!
8:46 PM btw, I’m starting to get confortable (it seems) with this normally un-coherent thing to me that is using non OO code and yet coding OO (eg. just about all my code so far is non-OO)
8:49 PM nope, not right. Not LockRect … it doesn’t work for everything. Instead: IDirect3Ddevice8::CopyRects or IDirect3Ddevice8::UpdateTexture
9:30 PM I’m a bit morally tired. Takin’ 10 min break
11:25 PM forgot to mention that I’m back now for almost half an hour … yes, I know that was still a 1 and 1/2 hour break. I went and ate …
2:00 AM on and off I’m really stuck with this compile error. Can’t figure it out. Been asking around and still nothing.
3:49 AM well, I don’t pretend to have been coding all this time … but my time has defenetly been invested into searching docs /fixing bugs (btw, I fixed that really ugly one: just some missing includes )
3:59 AM way cool! just got something rare:

C:\work\VCprojects\CubeDX8\CubeDX8.cpp(373) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file ‘msc1.cpp’, line 1794)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
yeah. killed the compiler … why the heck am I happy ?
4:01 AM my ass hurts like hell from all this sitting down … and I haven’t relaxed my eyes in too long a time!

Tuesday, July 31, 2001
4:31 AM
Here’s one thing I failed to mention here: I just took a 2 week holiday … what others might call lazying off (maybe including me?) … anywayz now I’m back and I’ve decided I will be trying the 8 hours per day workday … starting tomorrow (when I wake up). Right now I’m reinstalling windows and everything.

Wednesday, August 01, 2001
4:59 AM
Quite unbelievable actually: I’ve just finished my first time 8 hour work day and I’m all bright and shiny … can’t even say I’m tired, or bored .. or frustrated (even though there is one really ugly bug sitting there). And you can see the results: new code. As far as I can tell it should be rendering fonts into textures … and showing one … but it doesn’t. However … there’s quite a lot of new code … admitedly doing nothing spectacular … BUT IT’S WRITTEN BY ME!!! I’m content with this decision. I didn’t even use the last (or even the first as a matter of fact) half hours for emails … like I planned. Way cool.
Wednesday, August 01, 2001
8:32 PM
possibly from here on I will be making with ‘###’ places in code that could be a problem upon porting to another OS (like interger size)
8:40 PM If you could see me right now you’d say I was insane .. and maybe I am … but I’m laughing and almost crying. Why? WHY? Because I just saw the first letters put up by me on the screen!!!!!! Yeahhhh! And writing this calmed down my isteria a bit.

Thursday, August 02, 2001
4:13 AM YeS! end of second work day is here :)
Thursday, August 09, 2001
10:24 PM As of this moment I can show ANY text character over a 3d scene :)) yeah!! (as for my absence: my motherboard is still causing data coruptions. I tried a bios update and ended up trashing my computer (it wouldn’t start) … now it’s working again but I’m back where I started).
Monday, August 13, 2001
12:29 AM Am I able to express my happiness?? I doubt it. Wow. I’ve got a text renderer going. Now I’ve only got to handle a logger and this part (text management) is done(just about). increddible! Wow wow wow. wow. And not only that but I’ve got a fps counter going. So, now in the bottom right of my screen I have 2 lovely counters, one for instant fps and one for average fps … and their text description … and a “yeahhh!!!!” in the middle of the screen. Yeahhhh!!!!

5:51 AM
very very weird: this little line “deque<string> lines;” produced about 6 pages of dense template warnings. I don’t get it. Maybe it’s my data corruption stuff again. Not knowing is very irritating.

8:01 AM Another full day (and then some) done. Though I’m fond of that I am frustrated at how it ended (stuff I didn’t understand and a program crash) … well, laterz. sleeep
Monday, August 13, 2001
7:53 PM is a mirracle I tell you. It fuckin’ works!! I can’t understand why moving a initialization routine from one function to another fixed it … but it did. Yeah!!! And guess what: now I’ve got junk text scrolling uppwards on most of my screen :P

8:42 PM found the answer to how a little line like “deque< string > lines;” can produce so many errors: “The debugger cannot debug code with symbols longer than 255 characters. In the debugger, you cannot view, evaluate, update, or watch the truncated symbols.” (from MSDN). Now if I could also find a solution!

Tuesday, August 28, 2001
10:25 AM Oh, thought I should mention: I’m back alive again (and trying the 8 hour/day schedule)
Wednesday, August 29, 2001
12:16 AM Thought I should mention that now the text is alpha blended and a green colour (no more black outlines around the characters). I’m attacking the world rendering problem (after loading from a .oct file)
3:02 AM Ok, 8 hour workday done. I think I’m likeing this new schedule idea: work 4 hours (padded with rest and stuff) sleep 4-5 hours … and so on. As for status: I’m in the process of loading/rendering a .oct file
Thursday, August 30, 2001
10:09 PM Well, my 4 hour shift is about over. Status: fixed several bugs I just made trying to load textures/lightmaps for the octmap. Right now I’ve got this resource leak that DX debug runtime reports and I can’t figure it out.
Friday, August 31, 2001
2:38 PM strangely enough the .id member of the lightmap structure seems to always be 0 (this lead to me having a resource leak because I assumed it would be different for each lightmap)
3:07 PM can’t seem to solve this mistery: I was sure it was the font texture that didn’t get released … but it isn’t.
3:24 PM Tadaaaaa: I found it. I was forgetting to release the font VB (yes, it seems I’m becoming advanced because now it’s starting to amount to quantities where I ‘forget’). Cool. Btw, did I mention that I also fixed that lightmap resource leak?
4:25 PM I’m excited. Just rendered a sci-fi looking junk that I suspect is the world :P
4:39 PM I’m looking into DirectInput right now … and thinking of a design to incorporate it … and realizing that that design would maybe be suited for DirectGraphics.
4:40 PM I’m starting to feel that programming is an adventure!
6:05 PM :) fun trivia: did you know that a ‘DirectInput keyboard state buffer’ variable would be called ‘diks’ in their code :)))
Saturday, September 01, 2001
10:45 AM Just had a look of the Roarrr desing docs I put up on my website … there’s actually some good shit up there. I’ll have to get back on track after this 0.01 release and start going back to design. I especially liked the idea about abstracting the rendering device and the world being just a special case of a object (something defenetly not done now).
12:02 PM plz forgive me. DIK seems to be a shortcut for Direct Input Keyboard :P (now I’m being too evil)
12:31 PM did you know that “break a take” is a backwards way of saying “take a break” :) I just said/thought it … ’cause I want/need one.
9:13 PM I’m looking into pointerst to functions atm because I wanna have a flexible way of assigning functions to call to keys being pressed.
11:00 PM I’m pulling my hear over hear with normal class design and figuring out where/how I should use singletons (for input/camera?). Ok, so it seems writing it down here helps me focus. I need the input to have the camera built so it can access it’s member functions (which perform actual movement and stuff based on input). So, the camera should be a singleton, right?
11:38 PM this designin’ thing sure is complicated :P (‘specially when you’re still stumbling on languages syntax here and there :P. Don’t tell anyone, but I’m just learning to really use pointers to functions).
Sunday, September 02, 2001
3:36 PM Yes yes yes! I’ve mastered the art of pointers to member functions :))) (or at least solved something I had just about given up for. “Effective C++” and a search engine is GOLD!!!
5:43 PM It’s indeed funky trying to debug keyboard errors … because you don’t have keyboard input. And right now, here’s a funny thing: all keys but the ones I was preparing for camera movement seem to force an exit out of the program.
5:48 PM I’m resetting (forced to) too often. Btw, I notice I’m starting to skip breaks (you know, the 10 min per hour relaxation breaks)
6:24 PM ok, now I’ve got ESC getting me out of the program (alt-f4 didn’t work no more) .. but still sometimes being forced out
6:44 PM VERY weird stuff with this keyboard input. I must be doin’ something embarassinly wrong. Can’t figure out what though.
6:56 PM see ya on the next shift.
yes, slept over a shift :(
Monday, September 03, 2001
2:50 PM I think I solved my keyboard bug but it involves a language thing that I still think I’m right about. It seems that:


isn’t the same as:


nope, I checked again … and it seems to be back again. Shit. (though it’s good it wasn’t a language issue).
3:13 PM Ok, this time I’ve really nailed it!!!! (took me a good 4 hours this one … but I did also fix some other stuff, like initialization moment and immediate mode keyboard trasfer)
3:14 PM Note: i’m on the good path: not only am I skipping 10min/hour breaks but I’m even forgetting to turn the clock on (which didn’t happen at the beggining). Nice to see improovement.
5:22 PM status: now I can sort-of move (just keyboard) over geometry. Geometry is really fucked up … movement even worse (axii messed up, rotations too) … but hey … it’s something!!!
8:30 PM ok, back now.
9:07 PM I just did a (to me) great thing: have a key and am able to save/load a player position :)). Very useful especially considering how fucked up keys are. My bad: it’s not the keys that are bad but the matrix handling.
9:56 PM It seems that that initiall test of the keyboard isn’t working propperly. It seems to (all functions return ok and shit) … but it doesn’t return a key that I continously keep pressed. Weird. No biggie, though
10:01 PM WOW, totally way cool: lightmaps are loaded properly .. if I only knew how to render them on top of the texture (on their own they already look great)
10:35 PM I just saved a “walls of playboy” version of the program :) Can you guess what kind of texture is on those walls?
12:32 AM that’s it for me today. Not too much done, is it?
12:54 AM goo night’
1:07 PM I’m spinning around in circles trying to figure out movement/rotation. I have updated and integrated my old matrix class though … which is really cool, and I’ve also had it replace the D3D matrices for common operation (they were being done in software anyway) … which is even cooler. Strange thing (maybe because I’m not doing things right?) is that now movement keys seem to work … just that rotations are not around camera but world. I’m dizzy.
2:52 PM well, I can’t figure out why it isn’t working. I’m trying this matrix-inverse approach (move in camera space and multiply by invers of the view matrix to get world movement) … but I keep stayin still … just jumping back and front a bit (by ‘I’ I mean camera)
9:43 PM I can’t believe it! On last shift I worked my ass out trying to figure out what’s wrong … now on this shift (I just woke up, maybe I’m more clear) I just changed some signs … and ta-daa .everything’s perfect. But I mean PERFECT. I don’t FULLY understand it … but it works.
9:48 PM As I keep adding to the matrix and vertex interface I’m starting to realize that I’m beginning to understand the ‘constness’ of things.
9:58 PM scalar multiplication of the world matrix doesn’t seem to enlarge the world. Not what I’d expect! Instead it produces a weird flickering/ray-like(lots of polys starting from a point) world. Not I’ve tried 2 variants: not even modifying the Matrix implementation to involve just the 0,1,2 line/column elements.
10:30 PM wooow. it seems it’s not a useless/just for fun thing that I did when I (just) implemented logging a matrix (with formatting) to a ostream. Just for curiosity I logged my multiplied by scalar matrix … and it doesn’t look (at all) as I expected.
10:41 PM A thought of the non-happy variety just occured to me: the building I look at is beautiful. I mean it. … and it’s got my nicely chosen marble texture all over it. Nice. And it has these wonderful white top areas. Nice … but I don’t have any texture like that. Could that be no-texture???
10:44 PM also weird: I’ve fixed the multiplication by scalar bug … very good I checked .. but ‘enlarging’ the world by it only seems to slow/increase movement not size of objects (relative to camera).
11:05 PM K. I’m gonna postpone implementing matrix inverse and use D3D’s one until later and get along with the mouse implementation.
11:17 PM ok, little secret just between me and my working diary (anybody reading through this has my gratitude enough to find out :)). Same map, same geometry, about same place, same res… my little program goes at 25 fps Paul Nettle’s at 52 … and his does collision detection too :)))))))))))))))
:))))) :))))))))) . It really cracks me up. Humiliating, I know … but it means that I’ve got a lot to learn and I haven’t reached the limit of brute-force hardware approach (even though I think I’m doin’ everything for that).
11:24 PM Yes, someting is defenetly wrong with the textures: on another (bigger) map I don’t see my marble texture at all.
11:36 PM Not to self: just a line of text per poly logged to a file during loading up for around 3800 polygons means maybe more than 30sec of loading up time for a world that would otherwise load instantly. Btw: it seems that my bottleneck is with the console because with this quite large world (or at least it feels larger) the framerate is still about 27;
11:44 PM it seems that for me all textures but texture 0 of the world are NULL. I’m not gonna fix the bug right now … ’cause it looks cool for that first map ;)
11:44 PM well, maybe I’m gonna try to figure it out :P
12:04 AM I’ve decided not to leave the bug (I solved it) in even if it does look well on that map :(
12:27 AM using CCW culling gets me a bit bigger framerate.
1:21 AM I’m nearing checkout time … and mouse is not done yet (trying to find a way to unite and elegantly handle mouse and keyboard, also keeping in mind a soon-to-add replay feature). Also I’m thinking maybe today I’ll mail Paul Nettle to ask about octmaps (copywright stuff for his code) and stuff …
2:11 AM I’m really enjoying Danzing. Haven’t listened to it for a long time ;) (yeah, still working on the mouse. Over the timeframe. hope the boss is payin’ overtime :)) … but anyway, there were times when I didn’t do my 8 hours a day .. like a couple of days ago when I slept over a shift)
2:40 AM maaan, I think sooo slowly I even drive myself nutz, lets not even talk about others.
2:52 AM my knees are starting to hurt bad from all this non-movement (did I even take a single break?)
3:16 AM definitely one of the more frustrating times of programming is when you solve an error and the error count doesn’t decrease by one as expected but rather doubles. Luckily it’s compensated by the times when you solve one and they all go away … aaaa
3:59 AM ok, finished writing code .. cross my fingers with hope … but rather prepare for debugging. hope….
4:00 AM YEEEAAAHHHH keyboard still works. Even if mouse doesn’t … i know it’s only that :))
4:08 AM woow. almost worked on the first run. Now I’ve just gotta figure out why it’s moving so strangely.
4:36 AM of all the shitty reasons to have a bug: MS/d3d send all their vars through DWORDs, so I did too … turns out that a DWORD is really an unsigned int … something I knew all along … but what I didn’t realize was that that meant that -2 for example wouldn’t be -2 but a huge number :))
5:09 AM well, something’s wrong with my rotation generating matrices (but I can avoid it (without solving it)) … and geometry gets distorted (stretched) when rolling (I actually implemented my rollling keys :P) … but let’s not complain … other than that: things couldn’t be better. Mouse is working right. Yes, it’s been 11 hours today meaning that this shift has been prolongued by 3 hours already (and I’ve still got to write that email). cool. I’m slowly becoming the work-aholic I’ve always dreamt of of being. … that is if I decide to wake up tomorrow morning, if not I count this for then :P
6:05 AM WOOW. somebody is actually reading this. Very exciting. I just got a mail from this guy Dan Wassenaar. THANKS dude! very encouraging. thanks. Feels sooo good. Thanks.
Wednesday, September 05, 2001
7:17 PM well, did some reading. Now I know the STL sort function (and it’s ‘introsort’ which is faster than ‘quicksort), maybe a bit more about COM objects (naaa) and quite some insight into DX (like the HRESULT type and the very useful I-wish-I-had-known-about-for-a-longer-time DXGetErrorString8, and DXTrace).
7:54 PM like, outch, man. outch. I was just ready to do a one line fix with ‘sort’ so I wanted to #include <algorithm> … so next moment I get errors in stl code. Where have I gone wrong, oh where?
7:55 PM ahhhh. of course it’s in their code: they try to call my inexistent operator< :)
8:08 PM I think I’m on the verge of figuring out a(nother) ‘unexpected class’ error. I’m moving my embedded class Event from Inputs private area to it’s public area … and ka-boom. However with another simple class it doesn’t mind having it public.
8:13 PM solved. Now I can also answer the guy who asked me about it yesterday night: what it was saying was “error C2629: unexpected ‘class Input::Event (‘” … so it was complaining about my constructor. Why? Because it seems that altough I didn’t notice at first I was using in it a enum type that I had only described lower in the file (when the class/constructor was in the private area it was ok, because this enum type definition was above it (I like the public:, private: ordering)).
8:41 PM ok, how about this one. What does it say?

c:\program files\microsoft visual studio\vc98\include\algorithm(583) : error C2784: ‘bool __cdecl std::operator <(const class std::deque<_Ty,_A> &,const class std::deque<_Ty,_A> &)’ : could not deduce template argument for ‘const class std::deque<_T
y,_A> &’ from ‘class Input::eventAndFunction’

1) afaik I’m sending in a vector … but maybe it’s converting it to deque for sorting?
!!! 2) how did eventAndFunction get into the picture????
8:46 PM fuck! it’s good to read the error messages (not just look where they happened). It’s a good thing to read error messages. It’s a good thing to read error messages! I was sorting the wrong shit.
8:48 PM strange, it seems to explicitly ask for operator=.
8:56 PM huh, another cool thing: as a design it seemed right that process events wouldn’t modify the events so I made ’em const (I’m getting courageous about reading stl code) … but then I tried sorting.
9:04 PM I’m really pissed off. I don’t get it at all: even down and dirty multiplication of world vertices by a number before putting them in the IB doesn’t enlarge the world (relatively to the screen size) … only makes my movement slower. I don’t get it!
9:09 PM is there some way I could stop the mouse looking around from making ‘jumps’?
9:32 PM how embaraskin’: I just put together some code that seems to be absolutelly useless :). I did a version checking portion to make sure they’ve got DX8 … and when I hide the d3d8.dll files to see if it actually catches the situation I realize that the program doesn’t even get to my code: it reports from start that it requires d3d8.dll … thus taking my chances to insert my code :P
9:35 PM I have to force myself to take a break. It’s been 3 hours now … and I should really force myself unless I want my eyes to go bad and me go unproductive. Force myself? wow, I’ve changed.
10:21 PM wow, a lot of stuff I can learn from the code of this guy, Bart Sekura, whom I found some DX8 code of. I was originally just looking at how he is checking the device capabilities … but he seems to be really good generally. I’ve got to learn from him!
10:48 PM well, I’ve sure got a lot to learn from this guy … but I think I’ll mainly just take the idea of putting my app and init into classes, and try to figure out the rest on my own. It’ll feel better. It feels wrong even looking at how he did it … (this way, by coming up with my own solutions, I feel good when I see somebody else having come up with something like that too … especially somebody who I respect for their skill, like this guy). BUT FIRST … got to take a walk or something because my knees are starting to hurt. It’s about 4 hours now. Looks like I won’t be taking advantage of yesterday’s prolongued shift, ’cause I intend to come back.
10:53 PM I’ve got to learn to be more productive: put less comments in code … and HERE!
10:56 PM I think I’ve changed my mind … I need to structure my progam much more … may take more than just 3-5 days, as I originally said, until 0.01 release.
11:00 PM you know .. I AM on the ‘right path’! really. Now I have been wanting to leave now. Really wanting (which is ‘bad’) … but then I kept staying around “just to check this thing quickly”. Now I’m really goin’

Thursday, September 06, 2001
2:52 PM Ok, despite all my blabber: here I go into the world of MFC. I really want a full scale all detail configuration system .. which would be great to have from inside the app, but for that (displaying my own fonts) I’d already need/want hardware acceleration. Or hopefully not? Let me try to see how only text goes on a REF rasterizer. (text is just not acceptable). Ok, … just for the record: I tried. I get 1 fps with just the text. But wait … since I am REQUIRING hardware acceleration I could assume some resolution is available with that and start in that for configuration? Also I’ve realized that I was starting in 1024*768 … but then again: why am I running from MFC like that. It’s not like I’ve got any ideas/plans on how to make a linux build.
3:06 PM can’t get anything acceptable. That settles it: let’s see if I can figure out how to make a window with items and shit. Yeah!
9:32 PM Ok, so what happened today, you may wonder. I did only 2 hours of work. Did I just get lazy? Well, yes, and NO! Today I met up with an old schoolmate of mine who was into programming too. He said he was interested in AI … I tried to talk him into the game industry … but more importantly: he offered to make me (personally) and Roarrr a website … one of those cool website designs with Flash 5 on which you see all sorts of effects and stuff and yet little download time. Very exciting. I’m in the entertainment business so I should know that a good package is important, so I’m really excited about all this. I’ve just got to think of a cool design and effects and Roarrr will have an impressive site. Coool!!! Oh, and I also slept some today earlier (when I should have been working) because my head hurt really bad (I think I’ve got a bad cold or something … still, it’s cool. All the time at those short moments of awareness I was designing code reorderings. Oh, and now I just visited a friend to ask about the implications of using MFC … and it turns out that chances are that people will have ‘the required dll’, and an even brighter idea (that I didn’t think of before): I can have the setup program run separatelly from the actual engine!!!
9:41 PM I think I’ve got a quite bad cold on my body :P
9:41 PM so why the fuck is he laughing? .. you may be wondering. Because in my current state I though that writing ‘on my body’ when I was tempted to write ‘on my mind’ which was obviously not suited either is funny.
Friday, September 07, 2001
2:14 PM From what I’ve read so far it sure seems that programming a nice detection code and checking won’t be a trivial task. Neither does the fact that I still haven’t decided whether to use MFC (downside being the needed dlls, upside being it’s wide use) or BC++ (upside being it doesn’t need external libs .. downside: not used, possibly primitive ..).
3:36 PM Ok, as of this second I’ve given up doing it in C++ builder and will go for MFC. Many tiny things have lead to this decision (most of which had something to do with the “it’s not as used/uptodate” factor, I guess), one of the more signifiant part being that I didn’t feel I had enough control (too much done by the app) … but the tip of the iceberg was the fact that I didn’t know how to link direcx files with it.
3:52 PM What I’m doing right now is pretty exciting. I’d call it: “a crash course in windows programming for a reasonably experienced programmer”. I’m basically jumping around from books to examples and all that in trying to figure out the ‘yeah, it makes sense!’ part.
Saturday, September 08, 2001
2:32 PM Ok, my crash course into windows mfc programming is about complete. I now know (more or less) how to build a dialog based program. I might look into listbox just a bit more. Now I need to figure out a reasonable configuration system. Ideas so far: this app will be separate from the engine executable. It’ll save the settings in a text file, with an option to run the engine directly. It will NOT be a requirement: the engine will have a way of starting up in a jerky mode: it will try to read the config file and if the contents isn’t working it will search through all hardware accelerated modes for a lowest working one (maybe just from 640*480 higher). I’m thinking of also havign an in-engine menu system for configuring … but that seems like a distant future … ’cause I still have to handle all the rest first, including a large code reorganization to move D3d into a class. Looks like I spoke too soon with that release dayte.
12:37 AM why am I moving so slowly?
5:33 AM well, I’m not programming, but I’m definitely on overtime. many things to write. Turns out that the file format and/or code I’ve been using for loading are by no means public domain but rather will be part of comercial games. this is both frustrating … but also a kind of honour or something. And it turns out that through this I meat this guy Jason Zisk of nFusion Interactive who seems to be a really cool and friendly guy. He directed me towards Nate Miller’s converter from Q3 maps … so I guess I’ll be using that. This means release date is delayed (man, I’m starting to feal like a real project company, always delaying the release date). Now I’m looking aroudn the web for converters and stuff … funny thing is I came across this doc. Wow. I hit my own site :)))
10:32 PM I’m gettin’ really sick of this: I just get get a ‘loading’ splash screen working. I’ve started a separate thread and created a window in there, and tried to display it … but it doesn’t show.
1:04 AM Ok, I’m like … totally giving up on this ‘loading’ screen … for now. I’ll ask around maybe sometime. I’ve spent more than 6, maybe 8, hours on it.
1:19 AM hUH!!!! i DIDN’T figure it out (I show a modeless dialog while quering hardware but the static text it contains isn’t displayed … as if the window isn’t properly painted) … but I fucked it: I noticed that the titlebar was rendered right so I had my text there and made the rest of the window to a minimum possible size. Looks pretty cool, actually.
4:04 AM Wow. I’m finding out funky shit about my own video card. Eg. did you know that of all the 21 resolutions that it provides ONLY 19 get hardware acceleration on fullscreen. I wonder which are the ones which don’t.
4:17 AM Seems that at least a dozen resolutions fail, the ones with R5G6B5 … prolly because this doesn’t work well with a alpha buffer of 1 bit .. or something
4:27 AM I thought I had seen it all. I really did. … but … but. Well, let me explain: I thought I’d try to see how Roarrr handles with a backbuffer of R5G6B5. The screen skewed and threw me out of the app (D3d couldn’t init) … so then I changed the zbuffer/stencil buffer to D16, instead of D24S8 which it was. Shock. Shock. Not only did it work (I expected that) … but the rendered text showed up propperly … which is impossible, because I’m rendering it using the texture alpha values (it should just show the text polys). Just a couple of moments ago I simulated the effect by turning off alpha blending. I don’t get it? Is D3D doing something behind my back? Is it by any chance emulating an alpha buffer (I don’t think it can be done that fast … after all, that’s per-pixel data …).
Thursday, September 13, 2001
11:18 AM I’m finally back. Missed 3 days. With and (as always) without reason. Among other things I got myself a portable cd player. cool. more audio adrenaline/orgasm. but back to work now.
1:52 PM a moment ago I got an error that I can’t repeat … and I hate sending the configuration utility out with a bug … I just can’t figure it out now (but maybe it won’t show up at all because I will be disabling the adapter combobox if there is just one adapter)
3:36 PM ok, right now selection management (not saving, just box and getting) is done for selecting a full mode (adapter, resolution, refresh rate (not complete) and color depth). break.
9:17 PM well, done almost 9 hours today. Now the dialog is just about as full as it can get. Now I only have to interpret the data :0)
Thursday, September 20, 2001
10:18 AM hmmm. I’m not fond of myself. another jump in time. what have I been doing. Well, there was this uni exam … and then I spent(put aside) like 3 days playing “Undying” … which is IMO a really well made game. The game that comes closest to mind artistically (as in ‘I was impressed with’) is “Unreal”. I just love ruins and stuff … someday I’ll do some map editing. For now … well, I’ve got to figure out working with files :P
8:54 PM Cool, it would seem that I can just about double the framerate by using a 16 bit color depth … and still be able to use my alpha textured fonts … strange … but cool.
8:58 PM fuckin’ strange: not only do I see serious artifacts with R5G6B5 and D16 but also … I’m moving away from the geometry :)))
9:18 PM hmmm .. I’m constantly moving (even in the other/normal colordepth) … strange I didn’t notice it before … and strange because it would be the kind of thing that happens due to an error acumulation … but … hmmm, maybe I am doing it. TODO! Right now what’s bugging me is why the fps counter keeps stabilizing at 33.33fps (the instant one, I mean)
9:25 PM did I mention that Jason Zisk is turning out to be a really great guy … possibly my next guru :) (don’t let him know ..). He’s offered to answer some questions and stuff (and I’m certanly making use) … and has even encouraged me :P <blush blush>.
2:23 AM I’m gonna insert here snips from a mail(s) I sent to Jason Zisk with questions. Lots o’ stuff I expanded on in there trying to find some answers. I’ll snip out his text though …

well, for me it feels very ‘jumpy’. See, if I strafe and move the mouse like you did in a
game to strafe and continuously shoot at the same point then it ‘jumps’. My best guess
right now would be that it’s because of the way I’m handling input: instead of processing
it one step at a time I’m doing it in bulks. By that I mean that if input has gathered in
the input buffers (keyboard and mouse) I don’t process first then goto next … but rather
kind-of do it all at once … I mean, I *think* if one could notice such things you would
see that a mouse camera rotation followed by a keyboard movement actually moves you (a
tinsy bit) generates a movement in the direction before the roation and then the rotation.
this mess is because I was lazy to/couldn’t figure out how a movement left in camera space
would translate into an absolute movement in world space so I did it the dirty way: I’m
always storing the last view matrix and calculating the inverse of that which I multiply
with my camera space movement thus transforming it from view space to world space. I also
did this because … well it seemed as a ‘should be’ that all movement processed in a
frame’s time should be handled at once. What do you think of this? Advice ?

ok, back on topic: this mail of yours
cumulated with what I’ve noticed is starting to really bug me on one question: how come my
‘instant fps’ always stabilizes at 33.33fps when looking up close and then in jumps to
50fps (just about always the same jumps). I mean: why not 33.70 fps sometims, or not in
always the same jumps. I don’t get it. I thought I had figured it out: I have a
‘minTimePeriod’, set to about 100ms right now, and the counter isn’t updated for less time
than that. .. so I thought “hey, I’ll just make that bigger to get better precision”. So I
made it 1000ms .. but 33.33fps still seems to be some kind of magic number. Maybe it’s
some float roundoff? Couldn’t be … the numbers aren’t big enough. Timing precision? I’m
using timeGetTime() to get the time. Couldn’t find anything better (the only thing I’ve
heard to be faster are the timestamps on keyboard/mouse events … but it would be shitty
to use those … because those can be old).

hmmmm … well, 2 things come to mind:
1) it’s encouraging to hear that I’m not doing anything wrong .. but I’m thinking I’m not
doing anything great either. I’m scared at my ‘maximum speed’. See, Paul Nettle sent me a
little app of his using these same .oct soon after he made his configuration stuff. So, I
run the same little map, and what do I get: at the base of the stairs 1024*768*32 he does
about 50fps … even more … and to top it all he’s also got colision detection (and
gravity). Now this really gets me puzzled. Ok, so I envy his working experience and skills
… but hey .. this is totally freakin’ me out. I mean this is the basics of all basics: I
would understand it if I knew he was doing some geometry culling or advanced techniques
… but afaik he was only throwing geometry at the card too. The ONLY difference there is
is that I’m loading a 256*256 bitmap from a file to use for my ‘universal texture’ and
he’s generating a checked texture by hand (which he might not have at 32 bit … but could
that be so big a difference?). Both apps render the lightmaps in the .oct files. I don’t
get it. What could I be doing wrong … or at least not right when I’m just sending
geometry to the video card? My best idea was that it was my console: I mean, half my
screen was filled with text which were actually polygons .. and since each char was a poly
and I did state changes per char I thought that was it … strangely enough disabling
toggling off the console doesn’t seem to produce the slightest difference (still about
33.33fps ;P)
2) I’ve initially tried to use index buffering … but due to the way geometry was in the
.oct files it seemed to me like it was no use (the vertices were in successive order in
the vertex buffer. Or would it? From some nVidia doc I understand that with vertex
buffering you can make use of the vid-cards cache (which doesn’t kick in otherwise). Do u
use it? I find it strange/difficult to simply produce geometry that uses that propperly.
Ok, sure, I tried out index buffering on my hand written super-cube … but other than
that. Oh, and one of my big surprises with D3D was when I realized that if I wanted to use
the hardware’s lighting I needed vertex normals … meaning a normal per poly-in-a-vertex
… which would mean that even if you’d like to use index buffering you still have to keep
two vertices if the vertex belongs to 2 different polys (because the vertex normal would
be in the poly normal direction) … this paradox sure gets my clock clogged up. So .. it
would seem to me that it only makes sense to use index buffering if you have a poly with
lots of vertices and you’re splitting it up into triangles for rendering (no other choice
in D3d).

Ok, all this talk about D3d has reminded me of another question I’ve been boiling inside
for a lot of time: I originally had my mind set on OpenGl (ended up hating it mainly
because of working with extensions .. I mean, hey, if even multitexturing is an extension
… and one that though was in my opengl32.dll, the runtime, wasn’t working with my
compilations). Back then, from their docs I was clear about 2 things:
-there is a matrix stack. That matrix stack is prolly gonna get accelerated. thus,
pushMatrix/popMatrix operations should be very fast
-there is a state stack. So, you can push and pop the whole state saving and reloading

In D3d however:
-there is some push/pop for matrices … but it’s in the D3X section … which would mean
that it’s just an utility or something. And … well, for things that they’re gonna do in
software anyway I’d much rather do my own code anyway (like I did with matrix and matrix
vector operations … well, all except inverse for which I’m using theirs ’cause I’m
afraid of it or something …)
-I’m completelly in the fog about saving the whole machine state and reloading it with
what DX provides.
(wouldn’t you like to have all the speed of hardware acceleration and still do your own
rendering ? :) For me it was a very hard thing to accept that I’m gonna have to use
libraries like Ogl or D3d)

a question that I’d really appreciate if you answered soon, if you had time:

right now I keep trying to figure out the dependencies of different settings. My big
questions is if I can have transparent textures (for my text) even if the backbuffer
doesn’t contain any alpha ? I’ve tried setting a R5G6B5 mode … and it apparently worked
(the textures were A8R8G8B8) … which was a big surprise to me. I’m rendering with
SRCALPHA and INVSRCALPHA for destination .. so maybe it does make a kind of sense … then
again … maybe not. Btw, the debug version of D3d kindly informed me that I had to switch
from D24S8 for depth to D16, with a message that goes something like “this device the
depth has to have the same bitdepth as the backbuffer”. I didn’t find any such note in the
DX8 docs … however I was wondering if this might be a generally true statement (in which
case I could limit some combination tests). However when changing this z-buffer bit depth
I got huge visible artifacts … and not only far from the geometry … which is a bit
surprising to me: I never thought it really mattered: could it be something else? The
artifacts are like some blackness move over some portion of the geometry and then
dissapear, and then back … in a rather regular way. But the big question still remains:
what is the actual root of transparency. If only the textures contain alpha and you only
use the SRC alpha then that would mean it works? that’s a surprise. I would think that a
card that doesn’t have support for 8bit alpha buffer wouldn’t allow this. I mean it’s a
per-pixel operation. How can it do it? … and if this is indeed possible could you like
give me some hints as how I could check all the possibilities, choose best one … and
still leave the user with a simple interface. I mean right now a switch like the following
works for me … but if non-alpha’d backbuffer works too … things get complicated enough
for me not to know where to start.

D3DFORMAT backbuffer;
case D3DFMT_R8G8B8:
case D3DFMT_X8R8G8B8:
case D3DFMT_R5G6B5:
case D3DFMT_X1R5G5B5:
backbuffer=D3DFMT_A1R5G5B5; //. crappy alpha
log()<<“We’ve had an unexpected format: “<<modes[m_nAdapter][i].Format<<endl;
continue; //. We ignore all others!
if(d3d8->CheckDeviceType(adapter,D3DDEVTYPE_HAL, modes[adapter][i].Format, backbuffer,

//. if it’s not in there already
resolutions[adapter].push_back(old); //. only if we can get hardware acceleration for it!

in the code above I’m trying to test all the formats one gets from D3D through
EnumAdapterModes(). But since it the CheckDeviceType() requires a backbuffer format which
must be identical to the frontbuffer in all aspects but alpha this code seemed natural.
However if I can still have the text display without the alpha in the backbuffer … then
… I don’t know … ’cause then it means that I would have to test all possible
combinations of 32 bit formats with all other combinations … or something like that. If
it weren’t for the really ugly artifacts I got a about double framerate when switching to
a 16 bit backbuffer.

I’d like to make my configuration tool as complete as possible … but it seems
everything relates to something else in order to test if it’s there and accelerated.


Sunday, December 02, 2001
11:56 AM well, howdy doody now. thought I was gone for good didn’t you. well, I’m trying to get back.
Sunday, March 10, 2002
daaaaaaaaaaaaaaa. I’m back for sure!!! My girlfriend is here with me … she’s reading some game desing docs :))) yeah … maybe we’ll get to work in the same field!!!! anywayz … I’ve got her support, which is awesome … and since she’s here I’m not missing her … so … I’M BACK!!! Seems like reading these .geom files conveted from Q3 bsp maps isn’t gonna be too hard. yeah!

5:05 PM NOTE from now on “!!!” will mean temporary fix/unsure
6:10 PM higly annoying … no wonder my reader doesn’t work right: seems that Nate Miller, the guy who made the Q3 bsp converter saved as binary not only the plane elements as a struct … but as a class with virtual functions :((( STINKS!!! flames go out to Nate (thanks for making the convertor though).
6:38 PM ok, I’ve guessed my way out of this shit. Just skipped over the junk data. I think it’s ok now.
6:40 PM huh. awesome. Now I’m pretty sure I’m reading the whole .geom file correctly. Now to actually use it!
7:24 PM I’m close … I know it. I must be. Sooon sooon now ..
9:58 PM I’m way too pissed off: I can’t get the D3d debug runtime working … which is really shitty … I should be there … I should be there … instead I keep wondering why it’s crashing.
Monday, March 11, 2002
12:25 PM what could it be??
1:00 PM with a really ugly tweak (only rendering the first 400 polys out of the scene) I have now been able to see a tiny section of the Q3 map. Yeah!!!!
Monday, March 18, 2002
12:52 PM I’ve reinstalled windows and all stuff and now not only can I enable the debug DirectX runtime but also the program seems to be running fine. I’ve also used the

#pragma warning (disable : 4786) // identifier was truncated to ‘255’ characters in the debug information

which Paul Herring on the C-programming list on yahoo groups has been kind enought to provide to me(I sent mails to lots of groups), and with this I’ve gotten rid of the STL related warnings, and thus was able to quicly fix 4 small warnings. Now the program compiles without warnings (but also without debug output in the VC++ debug window).
I have gotten horrible framerates (around 2fps after a lot of waiting at the startup) with a random Q3 map, while with a probably small one I got ~25 with retail DX runtime and ~15 with debug (yes, there seems to be a real difference)
1:01 PM 2 maps I’ve tried already crash. others work?
1:06 PM many files don’t work!!!!
1:16 PM I’m freankin’ out: there’s no debug output at all!!!
2:15 PM found one problem earlier: wasn’t allocating enough memory for the lightmaps (128*128 instead of 128*128*3)
2:44 PM seems it’s not my coding problem but the map file seems to have litghtmap ids of -1 and such … which is very weird … don’t you think? of course I can’t index into the lightmaps :P
2:51 PM I had to make a weird tweak since it seems the .geom files sometimes have fucked up lids.
2:54 PM YES!!!!! everything seems to be working (tested on 2-4 maps) … and surprisingly enough at decent framerates (~25) with retail runtime … even great ones without the console !!!! yeah!!!!
2:55 PM got to run!!!!!!!!!!!!!!!!!!! I’m late for a date!!!!
Tuesday, March 19, 2002
2:46 AM finally gonna update the site with this!
Thursday, March 21, 2002
2:39 PM things are now brighter, non-draw colour is now grey, you can see geometry. Mailed Nate Miller thanks and problem report. Checking out maps! realy cool! got to find the way to make the world bigger relativelly to the camera.
2:45 PM up-down movements are in camera space … however rotations are not. FIX!!!
9:25 PM got/tried a lot of maps since I last wrote. Asked for permissions on a couple of them. Tried working on Configurator today … can’t even figure out my own code properly :))).
Thursday, April 11, 2002
2:00 PM I’m on detecting hardware with Configurator.
2:54 PM I’ve just tryed this fix for the C++ language error in VC++ 6.0:

#define for if (0); else for /*. so VC++ interprets the C++ language corectly in a case like
the following:
for(int i=0;i<10;i++){};
for(int i=0;i<10;i++){}; //. yes, it appears twice

it will give a redefinition error for i … which is not according to the
standard … so that’s why I’m using this tweak. Been annoying me for a
long time … now I’m gonna fix it!!! */
… but it turns out this messes up other stuff … it seems that for a tripple for like

for(int k=0;k<d3d8->GetAdapterCount();k++);
for(int i=0;i<sizeof(bits16)/sizeof(D3DFORMAT);i++) //. for each frontbuffer
for(int j=0;j<sizeof(bits16Back)/sizeof(D3DFORMAT);j++) //. try backbuffers
if(d3d8->CheckDeviceType(k, D3DDEVTYPE_HAL, bits16[i], bits16Back[j], FALSE)==D3D_OK)

in the last line it says that the ‘k’ variable doesn’t exist. STINKS!!!! I just want the language standard !!!!
Thursday, April 11, 2002
3:22 PM I’m gonna turn VC++ 6.0 into a handy dandy pleasant just-for-me tool to use. Already I’ve got my own keys for compiling and running (far more confortable). In the end I’m going to be able to not even move my hands on the keyboard to do the usual stuff.
3:54 PM yes yes yes DUDE!!! I’ve done a complete rework on some keys. No more moving my hand to the arrow or home/end/page up-down. Just plain old keys!!! My pinky’s gonna develop iron muscles (lots of Ctrl).
4:17 PM correction: only now are the keys allright. For future reference:
Cj (Ctrl+character j) left
CAj (Ctrl+Alt+character j) world left
Cl right
CAl word right
Ci up
Ck down
Cu page up
Cm page down
Co start of line
C. end of line
CAo start of file
CA. end of file
C, delete (not backspace .. I’m still using that)
C+Shift+R go to next error
Holding down shift on any of these case does their ‘extension’ work (selecting). It took a lot of configuring but I’m very excited about this. With some routine it should proove very useful for MANY years to come.
PS: this is all coupled with my now older C` for compiling and CF1 for running.

5:01 PM In the process of getting used to these new keys I must say I’ve deleted and almost lost some serious pieces of code.
5:04 PM taking a well deserved rest (been here since about 1 … my knees are hurting)
7:00 PM talk about weirdness of coding: just spent a couple of hours code something that basically just does another way older stuff … and … well … it doesn’t do it right anymore. You should see all the junk resolution Configurator came up with. Some are HUGE … and some are even negative. Coool!! don’t you think?
7:02 PM I’m deep shit with my phone bill. Forgot the connection running during daytime … and started coding … it’s been 36 mins now. Fuck!!
7:13 PM ok. Fixed. Now I’m happy about the changes. Don’t know exactly why yet, though.
7:14 PM oh, yeah, right: now I’m properly checking 16 and 32 bit modes with all possible backbuffers
Saturday, May 25, 2002
12:06 PM I can honestly no longer understand the bigger picture of my own code (in Configurator)
Monday, July 22, 2002
11:16 AM YO, me and my love Amelia are here … starting summer work :)
5:28 PM I totally don’t get it: according to DirectX Caps Viewer you can have different types of back and front buffers (eg. 15 and 32 bit) … something which the docs explicity say you can’t have (they say the’ve got to only differ in the alpha)
6:17 PM This is preposterous: I can only find like 2 or 3 formats which can be 3d accelerated. I’d be pulling out my hair if I hadn’t cut it short recently.
Wednesday, July 24, 2002
1:23 PM I once said I’d make certain signs in the code with meaning … well, I have to write them down as I keep forgetting them:

//! commented it just for debug purpaces
//. normal comment
//.* probably could be optimized. Should return sometime

1:40 PM totally weird: I add a member variable coresponding to a dropdown list and the default refresh rate doesn’t get selected anymore :P
2:02 PM I’ve got a weird crash when somebody edits a custom refresh .. I might cut out this feature (it’s a way for somebody to break his monitor anyway … but still) .. other than that I think I’m finally done with the configurator: I can easily save all configs to a file.
6:04 PM Oh boy, oh boy: just tried to copy some text through the windows clipboard … instead of getting “576” through I got “UpdateData()”.
Thursday, July 25, 2002
12:21 PM Ok, I’ve done it. Now I can rather easily save all the data that can be selected and everything gets selected right (as far as I can figure it) … and I’ve even tested the stuff out on Amelia’s computer … for those of you who don’t know her: she my one and only love … forever and ever and stuff .. yes, me in love … forever. To top things: she’s learning 3d artwork and stuff so we’ll be able to work together!!! YEAHHH!!! I’ve also switched from dynamic link to static link with the MFC libs: it stank that I would have had to include all those DLLs.
1:25 PM I don’t know what to do about selecting the right front and backbuffer. I’ve abstracted this for the user .. but now it’s turning against me as since I search through all the possible 16 and 32 bit formats when choosing both the Z-Stencil buffer and the texture formats … so no I have no guarantee of knowing that a user selection will work as he mihgt have chosen a Z-Stencil with one front/back-buffer and a Texture format that works with another. … Wait …
Saturday, July 27, 2002
1:20 PM Don’t know what to do: I’ve now realized how I do the hardware detection right and fully … but I could very well mess up all my code … don’t know if to go for a quick hack or full data structure change. Even the quick hack could be difficult though. The problem is that they don’t make it clear what depends on what. Eg: The Directx8 SDK provides separate checking functions for say texture formats, depth-stencil buffer and adapter formats. The big question is: will they work together??? That was the goal of Roarrr: to make sure you end up with a configuration that works for you for sure.
7:53 PM This “Configurator” is starting to become a full fledged hardware detection/selection application. Cool. Now there are more functions and stuff and it’s a lot easier to do just about everything. I’m a bit scared thought that I’m too much of a C guy and not enough C++. Hope Roarrr will change that.
Tuesday, August 10, 2004
4:39 PM okay, seems like I’m finally gonna launch this beast … I’m afraid some chronicles version might have been lost. Sowwwyy. So … off it goes … I’m curious if anybody out there will ever read this … and maybe even contact me? ( … or …)
Though I have now given up programming … I’m still very much excited about making games … just that now I’m the game designer/artist (story/3d/2d/music …) looking for engine programmers :-) Contact me if you think maybe we could do something together .. or just to talk …
best wishes!!!