Journals

froghair2 months ago2024-11-27 01:38:32 UTC 1 comment
I have been a "mapper" since the earlier days of Half-Life. I was never one of the greats. I had always wanted to create a map that would propel my name to Half-Life celebredom and see my bsp smeared all over the server lists. That was not in the cards for me. My maps were either proof-of-concepts awkwardly trying to push the boundaries or overly artistic with no substance.

My five year old son has been playing Gary's Mod recently. Since he took an interest in it, I loaded one of my old (2007ish) HL2 maps into it for him to play. I didn't expect him to like it. It was more of a, "Hey look, your old man used to do this stuff!" But days later, I was walking past the computer and he was playing my map. I asked him, "You actually like this map?" and he replied, "Yeah daddy, its fun!"

It was a very heartwarming moment for me. I never made the map knowing that over a decade later my son would be the one enjoying it. I felt like I had finally got validation in the best way.
froghair11 years ago2013-12-04 03:42:13 UTC 14 comments
With coding, I have always been uncomfortable with abstraction, meaning letting the computer do the work for me without really understanding whats going on under the hood. Sure I can tell the computer to draw a cube at such and such coordinates, but how did it know HOW to draw the cube, and how the hell did it project this 3D object onto my flat 2D monitor?

Mappers need not concern themselves with such things, as the beauty of their work is dependent on the landscape, not the raw understanding. But someone looking to modify the game behavior will quickly find themselves lost in a world of vectors and quaternions.

Since playing (and mapping) DukeNukem3D (I was very young) I have been plagued by my lack of understanding of the 3D world. Half-Life made it all the worse. It wasn't until this year while day-dreaming during class that a thought struck me that a 3D object could be projected onto a 2D surface (in our case, the computer screen) by drawing lines from every corner of the object to the perspective point. A plane would sit in front of the perspective point, and where the lines intersected the plane would correspond to the pixel that corner would occupy on the screen.
User posted image
Each corner would know what other corners it was attached to, so lines could be drawn after the projection.

To see if this would work, it seemed easiest to go ahead and choose corner coordinates forward of the XZ plane, and derive parametric equations using the XZ plane as the plane of intersection, with the perspective point being slightly behind it (in the negative Y section). This led to the equations:
User posted image
Where the X, Y, Z coordinates of the perspective point are P1, P2, P3
and the X, Y, Z coordinates of the corner being projected is V1, V2, V3
(After testing, this only works directly behind the origin. Y is the only coordinate the axis the perspective can move along without distorting the object)

Following this, I used the Arduino Development Board in conjunction with the TVout library to create a 3D cube on my old TV (Inspired by the rotating cube that came with the TVout library sample).
User posted image
Its not pretty, its not that impressive, but how can I understand goldsrc if I can't even make a cube from scratch?

3D graphics are really taken for granted these days, and I admit that goldsrc is not the prettiest to look at compared to modern engines. But goldsrc is extremely beautiful and innovative, and perhaps its not until you attempt to write 3D from scratch that you are able to realize that.