Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

About this blog

This journal may contain languages not suitable for minors and some occasional swearing.

Entries in this blog


I'm in Honduras!

I'm writing this post from Honduras, we drove here this morning and we'll probably head back to Guatemala tomorrow, it's only a few hours away. And next week, I'll be in sunny Cancun, Mexico. It's gonna be fun.

What am I doing in Honduras you ask? not much, hanging out with my friends, I tagged along while they run a business. I am working with them on a separate project, so we'll probably spend a few hours working on that later tonight.

It's pretty damn hot here, even though it's raining quite a bit.

Anyway, not much of a technology oriented post, but I dont have much news about that, other than my SGE website, if you haven't seen it, go check it out.





Adventures in animation

So I'm working on getting importing models with full skeletal animation support. I've been doing this for the past couple of days, but mostly I had just been evaluating my options. First I gave Cal3D a try, setting it up was a pain; I'm not fond of DLL's, not for something that's not a plugin to an existing application, I know they're useful in some cases, but if I can avoid them I'm happy, I actually forgot what was the ultimate reason why I decided against it, I didn't like the way it was coded, I didn't like how a model was broken up into many files, just too many negatives. In the end, I decided to go with Microsoft, I mean, I'm already using Direct3D, so why not use their file format?

It took me about 20 minutes to get a hacked in animated character (that completely bypassed my entire rendering architecture), and now I'm working on actually making it conform to the architecture; here's the first thing I saw when I compiled:

This is actually better than I expected, I expected my computer to die a horrible death, but instead I got that! So it's all good, it just means somewhere the data is getting read or written incorrectly and it's jacking up the indices, or the vertices. Shouldn't be too bad to figure out.

Alright, I'm going to keep at it because it's pretty exciting.

Cool, just a few minutes after writing this post I found my error, I forgot to account for the index buffer stride, so after quickly fixing that:

Now, I know that looks weird, but, that's just because I have only converted the geometry over, I completely ignored all the transforms, so every "submesh" is being drawn at the origin (everything has the identity matrix as its transform), so now, it's only a matter of getting the right transforms for each submesh, then I'll have to also get the frame data for the animations and get the bone information as well.

If all goes well, I'll have an untextured, skeletal animated model tomorrow, making it textured is the easiest part, all I need to do is load the textures into the manager and save the handle in the submesh's material, it's so easy, I'll leave it for last.




Trip is back on. 90% sure

It seems I now fly out tomorrow morning, with a somewhat upside down schedule... damn stupid money hungry airlines... they f'd me up on purpose from what I can gather. I'd complain tomorrow, but then they'd probably spit in my crappy airplane food, I'm not sure if that'd be an improvement, but still.

On game development related news, this morning I got the rest of the 3d transformations to work properly, and I now have a rotating triangle that is also moving along the Z axis with perspective projection.

Next step will be to get the textured polygon rasterizer, and then I'll finally be able to check if the BSP code is working, and I believe it is.

I was also very happy that with all the transformations, I didn't lose much in terms of framerate, it did go down a tiny but, but it's just a fraction, so it's good, it also means that the fixed point math is doing what it's supposed to, and that makes me happy.




Beware of zombies!

I thought this was pretty funny, so I decided to share it...

I can never go near that file again, I do not wish for it to eat my brains.

*edit: I had the wrong image before...





Didn't write anything yesterday, it was quite a day, I was refactoring a bunch of script. My first idea didn't quite work as planned. But I was mentioning the problem to a friend and he suggested I try a point to line distance solution. Turns out that gave me a very nice, elegant and reliable solution to the problem. It took me all afternoon, but once the point to line stuff was working everything else just came naturally and started falling into place.

Today is one of those days in which I'll spend most of the day getting the level stable, playable and looking good. Then I'll add a feature and everything will go to hell, just like always.




a game?!

Ok, so I'm FINALLY working on a game project. I started yesterday with some real basic stuff. It's going to be a small puzzle game in C# that I'm going to try and sell similar to how I'm selling EasyShots and all that.

I figured, I already have 3 programs out there, instead of using my time and energy on a fourth one (which is already in development), I'll give making a game a shot.

So here's a bit of what I know:

- Will use C# with .Net framework 2.0
- 2D puzzle/action game
- Uses DirectX (Direct3D for 2D, no HW stuff)
- Single player
- PC standalone & web version (web version will be a port, no details right now)

Here's what I have:

- A prototype game design
- A basic 2D drawing library (at 'alpha')
- A photoshop mockup of the game interface
- A high level design of the game mechanics

And that's it... I'm still thinking and writing down ideas because I currently don't know where to begin, and to me that means I have not properly planned and design the game, so opening up visual studio and programming blindly would cause this project to quickly make its way to the "incomplete" bin, instead I'm going to go plan more... way more.




xRC, my new toy

So here's something new... a little while ago some bad shit happened that have put me in the place where I am today, long story short, I currently don't have a TV, except for the TV tuner card in this computer. Unfortunately, it's a pretty old TV tuner, so it does not have a remote...

Let's take this story back a few months, to E3... at E3 I won a cool wireless XBox gamepad, not long after I bought an adapter so I could use it on my PC (mostly for game development, I have no PC games that are suitable to play with a gamepad).

Fast forward to the present... one day while watching TV and wishing I could just lie in bed and switch channels, I saw the xbox controller lying around, so I thought to myself... why don't I just write a little program that will map the gamepad's output to keyboard keys...

I have not fully established whether I'll try to sell this, or release it as freeware, I guess I'd like to gauge interest on it and then decide, so, if you're interested and want to try it out, GET IT HERE

Here's a screenshot so you get an idea of what it is:

Oh yea, system requirements:

- Windows XP
- .NET Framework v2.0

Feedback, comments & bug reports are greatly appreciated!





I was FINALLY able to get all my projects in their right locations with all the perforce bindings working correctly, at least it seems more likely that it worked this time. It seems that everytime I think they're working when I come back at night and start messing with the projects, they're not quite right. I do think I got it right this time, that's the one thing I don't like about perforce, it's not always easy to get the projects working correctly, but once they are, it's so damn cool.

So, I've been thinking a lot about it, and I think I've finally accepted what I always knew, but didn't really care. I've been concentrating too much on writing an engine, which is fun and all, but it's not going anywhere. This is perhaps because the goal is elusive.. a moving target even, the closer I got, the newer more advanced thing I wanted to add... there was a lot of work, but not enough direction, no vision.

So I've decided that I'm going to take what I have, do a quick evaluation of what stays and what goes (I already have a pretty good idea what that is) and I'm going to move in the direction of writing a game.

On the game design side of things I already have an idea, an idea I like quite a bit, so I'm working on evolving that idea into a design. Currently I have a page with a story overview (I'm keeping the story light, but I do want some story elements) and a couple of mindmaps with ideas and structure.

Hopefully, I'll be able to keep this simple and finally evolve SGE into something more real.





Sunday is almost over and I don't feel like I accomplished anything this weekend. Well, that's not entirely true, I did find that I'm not gonna be able to use EaseImport http://www.easeproduction.new.fr. I liked its simplicity and how easy it was to get something up and running, but it appears to be buggy. I thought the problem was on my end, but I saw a post on the site's forum where someone else is experiencing the same issue. If the issue were to be fixed relatively soon, then I'll give it another shot, but I won't be as patient, I already wasted a lot of time.

For now, I'm back to using Flexporter (http://www.codercorner.com), but unfortunately, it is giving me its share of problems. For once, this is a significantly more complex software, so integrating into an existing project is not as easy. And the other part is that again, I'm experiencing some strange behavior with me model's pointer, so it's crashing when I'm trying to build it. This time, I'm pretty sure the problem is on my end, I'm just getting tired, so it becomes difficult to spot problems.

Anyway, I'll have more (though, not much more, since I'll be at work all day) tomorrow.


Got flexporter working, I can now load the files, (geometry only). I'll do the textures tomorrow, then I'll move on to loading animations (skeleton hierarchy and the like). But now I gotta go to bed. yay.




Busy, busy

I keep wanting to post here, and go back to programming at home a bit, but I've been really busy, not so much at work, the work is cool, maybe a bit slow since we're in post-E3 mode, but nice. But Im still unpacking, and the last two nights I've gone to pre-natal classes with my wife (we're having a baby REAL soon), so we have tons to do, like setup the nursery and finish unpacking and cleaning up.

In addition, my computer is going real slow, so I think it's time for a good ole format of the C: drive, but that's time consuming and I have to do it in one sitting, I don't like leaving the computer crippled or vulnerable by not doing it correctly, perhaps I'll get a chance this weekend, Monday is a holiday here in Montreal, so it's a perfect opportunity.

And now I gotta run off to work, yay!






So, does anyone know how to determine if CapsLock is enabled/disabled with DirectInput? I can detect if the key was pressed, but I need to know in what state it currently is in.





x-mas wish list

Ok, so I decided to share with you and at the same time immortalize my list for Santa for this year so that one day I can look back and say "why the hell did I want that?".. but here goes:

1. Dell Inspiron 9300 laptop (with the good video card)
2. Dell Axim x51v (with the good video card)

hmmm, when did I become a Dell fanboy? hehe dunno... but those two are pretty awesome.

3. For EasyShots and Explore++ to sell really well.

That's it for my material wishes, I have a ton more non-material ones, such as "to become one with the universe and steal all of its knowledge"... I also have some new year's objectives, like "launch the first privately owned satellite made from old circuitboards and chewing gum into space". But I'll save those for a different list.

Happy holidays!

BTW, is it not cool this year to say Merry Christmas? jeez, next year they'll have to sell talking toy Santa's that either 1. have a disclaimer that is very quickly spoken after each "HO HO HO" or 2. Santa's new phrase will be "HO HO HO Happy time off work, but in case you do have to work, happy day at work!"...




Introducing EasyShots!

So here's my latest and greatest!

I wrote this program because I was tired that every time I wanted to show a friend or a coworker a screenshot of something I made, some weird bug, or something I was working on I had to hit PrintScreen or Alt+PrintScreen (for a specific window), fire up Photoshop, create a new image, save it, then find it and send it... to me this was way too much time and effort, especially when I had multiple programs running, the debugger and my engine all in the background.

EasyShots was born, this program quietly sits in your systray and whenever you press PrintScreen or Alt+PrintScreen, that screenshot gets saved into a list of thumbnails. From EasyShots you can preview the screenshot, you can save it out, you can also save out ALL the screenshots you've taken, and most importantly you can drag a screenshot out into any other application. This could be Photoshop, email, instant messenger, anything!

You have no idea how easy it is, and I've also made it pretty affordable, only $9.99! Go ahead and download the free 15 day trial, if you share a lot of screenshots, you're going to love it.

Download it here





So, I didn't do much progress with the event system yet, but for fun, I decided to plug in LUA real quick to see what I could come up with, and here's what the output looks like:

Unit Test: UnitTest_EventSystem

Event System Test - OnStart
GOOD_SHIP: I'm hit! (health=90)
EVIL_SHIP: I'm hit! (health=90)
GOOD_SHIP: I'm hit! (health=80)
EVIL_SHIP: I'm hit! (health=80)
EVIL_SHIP: I'm hit! (health=70)
GOOD_SHIP: I'm hit! (health=70)
GOOD_SHIP: I'm hit! (health=60)
EVIL_SHIP: I'm hit! (health=60)
EVIL_SHIP: I'm hit! (health=50)
EVIL_SHIP: I'm hit! (health=40)
ship_evil: dominating!
GOOD_SHIP: I'm hit! (health=50)
EVIL_SHIP: I'm hit! (health=30)
EVIL_SHIP: I'm hit! (health=20)
EVIL_SHIP: I'm hit! (health=10)
ship_evil: dominating!
GOOD_SHIP: I'm hit! (health=40)
GOOD_SHIP: I'm hit! (health=30)
GOOD_SHIP: I'm hit! (health=20)
ship_good: dominating!
GOOD_SHIP: I'm hit! (health=10)
GOOD_SHIP: I'm hit! (health=0)
The winner is ship_good
Event System Test - Display
Event System Test - Stop

So yea, it's pretty much the same, and for the most part it is, except this is the LUA that's driving this:

winner = "none"

ship_good_health = 100
ship_evil_health = 100

good_streak = 0
evil_streak = 0

while 1 do

dice = math.random(100)

if dice > 50 then
ship_good_health = ship_good_fire()
evil_streak = evil_streak + 1
good_streak = 0
ship_evil_health = ship_evil_fire()
good_streak = good_streak + 1
evil_streak = 0

if evil_streak > 2 then
evil_streak = 0
print("ship_evil: dominating!")

if good_streak > 2 then
good_streak = 0
print("ship_good: dominating!")

--[[ print("ship_good_health: ", ship_good_health ) --]]
--[[ print("ship_evil_health: ", ship_evil_health ) --]]

if ship_good_health 0 then
winner = "ship_evil"

if ship_evil_health 0 then
winner = "ship_good"


print("The winner is ", winner)

Not the most elegant thing you've seen, but hey, it was just for fun... and what the hell is up with those LUA comments? that looks real ugly to me... oh well.

I guess you're wondering what the code side of things looks like... it's not that great either, but here it is:

int ship_good_fire(lua_State *L)

int health = ship_evil.health;
lua_pushnumber(L, health);

return 1;

This is the main:

// initialize Lua
L = lua_open();

// load Lua base libraries

// register our function
lua_register(L, "ship_good_fire", ship_good_fire);
lua_register(L, "ship_evil_fire", ship_evil_fire);

// run the script
lua_dofile(L, "ships.lua");

// cleanup Lua

The rest is handled by the event system. This is all hacked in, so don't think too much of it, I'm just trying to learn how LUA can be used, and I'm still figuring out how to do a better event system.

I really wish LUA played nicer with C++, I'd love to just be able to do this:

lua_register(L, "ship_fire", SpaceShip, SpaceShip::Fire);

or something like that, I've looked into some of the libraries some people have made that better integrate C++ with LUA, but they all seem so cumbersome.




EasyShots 2.1

I just released an update for EasyShots
it is now version 2.1

I did a few cool things with it which I'm pretty happy about, I added a small toolbar that when you enable it it's 'always on top' and gives you shortcuts to capture screenshots, this has two new things, first is that it gives you the ability to take a screenshot of an area of the screen, the second is that it gives you a small stopwatch to take a timed shot.

The other cool features are in the "preview" window, which is now called "edit" window. You can crop, rotate or flip screenshots, and either save them out to a file, or update the screenshot list with your changes.

In other news, tomorrow I start delving into writing a BSP renderer for the PocketPC, this is gonna be so much fun =)

Time for bed (it's 6am.... heh). Cya!





I'm really pulling my hair out on this one...

So, I'm filling up this vertex buffer with data imported from a file. When I build up the buffer, I'm printing out the texture coordinates to my log file, at this point they are correct. When I build my index buffer, I'm printing out all the contents of the vertex buffer, using the indices into the vertex buffer (I started doing this for debugging). Now on this pass, the UV's have changed, they are no longer correct, EXCEPT, for the last 2 faces (the last 6 tris are correct).

What's scary is that I'm not doing anything with the vertex buffer at between those two things, so something is not telling the truth, I wish I could say that the printing out of the full vertex buffer was wrong, but the scary part is that I see the wrong results in the rendering.

I've gone over the code so many times, everything looks fine...

This is just bizarre, check this out:

for ( i=0; i _topo->_NbFaces; i++ )
CImpFace* srcFace = mesh->_topo->_Faces;

DPrint("--- Face: %d", i);
for ( uint16 ref = 0; ref 3; ++ref )
uint16 vIndex = srcFace->VertexRef[ref];
vertices[vIndex].u = srcFace->UV[ref][0].u;
vertices[vIndex].v = srcFace->UV[ref][0].v;

DPrint("%d: %.2f %.2f %.2f [ %.2f %.2f ]", vIndex, vertices[vIndex].x, vertices[vIndex].y, vertices[vIndex].z, vertices[vIndex].u, vertices[vIndex].v);

This prints out correctly:

--- Face: 0
0: -20.00 -20.00 0.00 [ 1.00 0.00 ]
2: -20.00 20.00 0.00 [ 1.00 1.00 ]
3: 20.00 20.00 0.00 [ 0.00 1.00 ]

Now, when I do this:

for ( i=0; i _topo->_NbFaces; i++ )
CImpFace* srcFace = mesh->_topo->_Faces;

for ( uint16 ref = 0; ref 3; ++ref )
uint16 vIndex = srcFace->VertexRef[ref];

DPrint("%d: %.2f %.2f %.2f [ %.2f %.2f ]", vIndex, vertices[vIndex].x, vertices[vIndex].y, vertices[vIndex].z, vertices[vIndex].u, vertices[vIndex].v);

If you notice, I'm not doing anything except printing the data again (I got rid of anything else other than this just to isolate this behavior).

This is the result:

0: -20.00 -20.00 0.00 [ 1.00 0.00 ]
2: -20.00 20.00 0.00 [ 0.00 0.00 ]
3: 20.00 20.00 0.00 [ 0.00 0.00 ]

And my cube reflects the incorrect texture mapping.

So annoying, I hate problems like this.

Here's what it looks like:




Cloak shader

So, I offered I would write a little about the cloak shader I implemented, so here it is.

The vertex shader is really straightforward

struct a2v
float4 position: POSITION;
float3 normal: NORMAL;
float2 texcoord0: TEXCOORD0;

struct v2f
float4 position : POSITION0;
float3 normal : TEXCOORD0;
float3 view_vec : TEXCOORD1;

v2f main(a2v i){
v2f o;

o.position = mul( i.position, world_view_proj );
o.normal = mul( i.normal, model_to_world );
o.view_vec = camera_pos - i.position;
return o;

The only thing worth mentioning is that it is sending the view vector in TEXCOORD1 to the pixel shader, this will be used to calculate the reflection vector as well as lookup into a texture that gives the object the "oily" or "soapy" look to it. The pixel shader is where the fun stuff happens, the shader requires two textures, the first is a 1D texture that gives the object the "oily" feel described before. The next texture is the cube map that will be used for the object's reflection.

sampler Rainbow: register(s0);
sampler Environment: register(s1);

float rainbowiness: register(c0); // 0.0 - 1.0 ( 0.5 looks good )

float4 main(float3 normal: TEXCOORD0, float3 viewVec: TEXCOORD1) : COLOR
normal = normalize(normal);

float v = dot(normalize(viewVec), normal);

// lookup into the 1D rainbow texture
float3 rainbow = tex1D(Rainbow, v);

// Calculate the reflection vector, then lookup into cubemap
float3 reflVec = reflect(-viewVec, normal);
float3 refl = texCUBE(Environment, reflVec);

// interpolate reflection color to rainbow color
float3 color = lerp(refl, rainbow, rainbowiness * v);

// return the interpolated color and use 1-v as transparency
return float4(color, 1 - v);

The line:

float v = dot(normalize(viewVec), normal);

The first use for the dot product between the view vector and the normal is to lookup into the 1D "rainbow" texture, what this will give us, is a smooth sampling of the texture. The texture will be sampled from left to right, the leftmost color will be used for the places where the normal is least aligned to the view vector at, and gradually up to the rightmost color at the places in which the view and the normal are most aligned. Here's a screenshot of the effect only looking into the rainbow texture:

Click for full size

The next two lines are very straightforward

// Find the reflection
float3 reflVec = reflect(-viewVec, normal);
float3 refl = texCUBE(Environment, reflVec);

All they do is calculate the reflection vector and use it to lookup the appropiate texel in the cube map.

The next use for the dot product is to calculate the transparency of the object, it works in the same way, the object will be fully opaque when the normal is least aligned to the view vector and will gradually become transparent as the view vector and normal become aligned. You can see this in the last line of the shader:

return float4(color, 1 - v);

Here's a screenshot where I hardcoded the ship's color to green just so you can see how the alpha looks:

Click for full size

Here's the rainbow texture I used:

Right click here then Save as...

The pixel shader needs to be compiled in PS2.0 because of the dependent texture read where we lookup the rainbow texture.




EasyShots 2.0

I'm happy to announce the release of EasyShots 2.0!

EasyShots is quite improved over 1.0, for starters I believe it has a more professional look.

Here's a list of the new features:

* Improved User Interface
* Menu options & keyboard shortcuts for all functions
* System tray icon can show balloon notifications
* Screenshots can now be emailed (as attachments or inlined with HTML)
* Window position and size is preserved upon exit
* Supports JPEG, GIF, BMP, PNG and TIFF file formats

I find myself using EasyShots quite a bit now, if you're working on a project and you'd like to take screenshots of it, but you don't want to take just one, quit, save it, take another one... just use easyshots, it even works when you're running a fullscreen game. Just take screenshots normally with PrintScreen, as many as you like, when you leave your game all your screenshots will be waiting for you in EasyShots =)

Best of all, it's only $9.99, unlike all the other screenshot programs that I found, some of them were ridiculously expensive for what they are.





So I haven't been around much these past couple of days... my wife got a job that requires me to wake up at an extremely early hour in the morning to go drop her off... being the night person that I am, this is problematic because now I feel tired at night when I need to be up and doing my stuff. But, I'm sure I'll get used to it and I'll be able to get back to my old routine, or close to it.

Not a lot of interesting stuff, I'm still having that UV problem, sorry I keep missing you Rick, I've been in bed when you've msg'd me... =(

Hopefully I'll be able to lock that down during the weekend, it's gone on for far too long, it's weird, I didn't have this problem when I wrote my own 3dsmax exporter back in the day... now I've tried two exporters and I get the exact same results, and the author of one of these exporters said my code was fine... so annoying.




DirectX SDK

An update has been posted for the DX9 SDK for anyone interested:

DirectX SDK April 2005

They fixed some PRT stuff and added a new feature that generates UV mapping for an arbitrary mesh... seems interesting.




cool site

Found a cool site...


it's 3D graphics stuff with lots of code samples.





Just signed up for the World of Warcraft stress test. I didn't get into the beta back when it started, and not being a real MMORPG fan I wasn't devastated. But from what I've heard, this one will be worth picking up, so I'm happy I get to play it in a couple of days, or whenever they open it for testing. It's downloading on my home computer as I write this.

On other news, I'm fucking starving, lunch won't be here for another 40 minutes...

What else? oh yea, I guess I'll finish this with another quick tip.

Never, EVER hardcode numbers, if you need to, use a const variable for it, this will describe what this number is being used for. Doing stuff like this:

float fAltitude = fCurrentAltitude * 0.304799f;

will just confuse the hell out of whoever tries to read your code, instead, do this:

const float fMetersToFeetRatio = 0.3040799f;
float fAltitude = fCurrentAltitude * fMetersToFeetRatio;

by doing it this way you don't have to guess what's going on, it's plain to see you're converting fCurrentAltitude from meters to feet.

And that concludes todays quick tip.





I'm at work and I have nothing to do... especially since I start my vacation tomorry. Well, I still need to come in two days next week, but that's not bad.

I got a new book:

3D Game Engine Programming by Stefan Zerbst.

I no longer buy these books to read them in their entirety, I just got them to read a few interesting chapters and as reference when I'm stuck on some problem. But I'll at least skim through most of the chapters and read anything interesting. I also like to support game development authors whenever I can, they are usually people who not only have a full time job, but they make the time to share their knowledge and experience with the rest of us. Knowing what it's like working in this industry, I know how valuable free time really is now.

Not much else going on, turkey day is upon us, I'll probably spend a good amount of this weekend doing some research programming, writing a couple of shaders, or maybe setting up a little client/server app, I've always wanted to play with networking programming, but until now I had been too busy.

Anyway, I think it's check out time.




Sign in to follow this  
  • Advertisement

Important Information

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

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

Sign me up!