Wednesday, November 12, 2008

Insurmountable bugs

Creating these chat bubbles has made it clear that my 3D rendering engine is imperfect: there are occasional pixel allignment issues that cause single horizontal lines of pixels to disappear. I am sure that this is an issue caused by my projection and identity matrixes, which I created by trial and error. Fixing these issues will require the work of someone who actually understands 3D projections. Since I'm the only person working on the engine at present... this is really frustrating. 

Another issue that has cropped up is the issue of overdraw: currently, the engine renders about 3-4x more geometry than is visible. Solving this problem will require an understanding of 3D rendering and fustrum culling, which are, again, skills that I don't have.

I need to consider my options: do I want to continue working on the engine in my own haphazard way, or do I want to spend a week or more cleaning up and commenting all the code so that I can share the code with other developers.

Send me an e-mail if you understand 3D rendering, and would like to help.

Tuesday, November 11, 2008

The first NPC in the game...

... is an unfriendly skeleton.

Sunday, November 9, 2008

A week later...

I've made a lot of changes in the past week, but at the same time, I'm struggling to find time to work on this engine.
Everything in the game at this point is hueable. Skin, hair (players have hair - how cool is that?), every weapon or object.
Preliminary NPC code is complete. The next big step is to start scripting them to respond to player input.
But - bad news - I've started working on my Thesis, and I'm taking over as station manager of the campus radio station. So, as I wrote above, it's getting harder and harder to find time to work on a project that might end up just a waste of time.
I'd really like to open source this engine. Clean it up, give it to someone, watch it grow, watch it thrive.
But I'd have to clean it up first. Right now, the engine is something like the crawlspace under an old house: everything is dusty and musty and pipes lead every which way and some are empty and have been for months and others are only temporary but God help you if you try to remove them without fixing the jury-rigged solution that is in place in the wiring four feet in the other direction.

Sunday, November 2, 2008

Progress report: 11/02

I'm now able to color objects in the world. Here's an example of a Player in colorful gear (the player himself is still albino, but that should be fixable).

I spent a good deal of time trying to fix overdraw today, but to no avail. I really do not have a good grasp on 3D concepts, which means that when I try to implement marginally complex concepts such as frustum culling, all I end up doing is wasting my time. I think I'm going to stick to working on the basic engine from here on out.

This overdraw problem needs to be addressed in the future. Just not by me. I pulled back the camera just to see how much is being overdrawn. This is the result:

Saturday, November 1, 2008

Progress report: 11/1

I've been working harder on updating the game than updating this blog. I've made a lot of changes and additions.
  • When a player walks inside a building, the roof disappears.
  • Units other than Players now exist in the world.
  • When you mouse over an item, or a NPC, or anything else, the mouse cursor changes to reflect a default interaction with that object.
  • Units (a class of objects that includes Players) now draw shadows beneath them, so it's obvious that they are standing on the ground.
  • When you are preparing to drop an item on the ground, an item 'shadow' appears in the world where the item will be dropped.
I also have done a ton of back-end programming, setting up flags for NPCs and mobiles, etc. I also nailed down mouse interaction so that it's absolutely perfect. Unfortunately, this has cost me a good deal of fps (I'm down to about 70% of what I reported earlier). My goal with this engine is to make it run at good speed on just about any computer out there, so this is a little disheartening.

I have a cell-bio test coming up on Monday, so I need to study for that. Today, I'm only going to work on one thing: implementing a visibility culling test so I can reduce the number of objects I'm drawing per frame. I anticipate that this will net me a 1.5x speedup, or possibly more.

Tuesday, October 28, 2008

Progress report: 10/28

Player can now drop objects to the ground, and pick them up as well. Initially there were a few problems with updating the inventory GUI when items were picked up, and an occasional issue where a player would go to pick up one item but end up with something else altogether in their inventory, but I think I've fixed those bugs.

I would like to be able to highlight objects that the mouse cursor is over. I'm not sure how I'll do that - whether it be by rendering that object brighter or darker when the mouse cursor is over it, or with an outline. Perhaps I'll boot up UO or D2 and see how they did it.

I've also implemented a context-sensitive menu for the GUI. The menu doesn't have a real purpose yet, but I'll probably find a use for it in the future.

My next milestone is to have NPCs in the world, be able to interact with them (as quest givers, merchants, or gossipers, for example), and then I'll be working on chatting in game.

A few statistics for the project:
Lines of code (client only): 9,225
Size of the client: 496kb
Disk space taken up by resources (textures, maps, databases): 113mb
FPS*: 350

* The client currently runs at 640x480. This benchmark is done in an area of moderate detail, with a few hundred objects on screen. My development machine is a 2ghz P4m, ATI mobility Radeon X300.

Monday, October 27, 2008

Progress report: 10/27

Yesterday, I fixed the offset values for equipment graphics. Player equipment now displays almost perfectly while moving. It's not absolutely, 100% perfect, but I think that the graphic artifacts that remain are the problem of Ultima Online's art. The only way to fix this problem will be to implement an original art set... but this isn't feasible at the moment.

Today, I made it possible to have items display when dropped on the ground. Next, I'll work on picking up and dropping items.

My next major milestone will be NPC interaction and chatting. Although there will be merchants, skill trainers, and innkeepers (among others), not all NPCs will have something important to do. Those that do not will either say a canned response (possibly with a variety of canned responses based on the player's deeds and appearance), or have a simple dialogue tree.

I am excited about the personalized storytelling the supposedly will be a focus of Bioware's newly announced Star Wars MMORPG. Here's a quote from the IGN article about the same:

The problem with most MMOs, even those that have large story arcs for their characters, is that they try to apply a single story to a wide range of classes and attitudes. In designing content that works equally well for both saints and scoundrels, many MMOs are left with rather generic stories where the only real roleplaying is whatever the player projects onto the action.

The solution is to give each class its own story arc. So your class story will start right away with you being introduced to your class, not based solely on the mechanics of gameplay, but in terms of what motivates your particular class and how you should start thinking about your opportunities.

This is really intriguing - I absolutely believe that the future of MMO's will be hinged on this personalized storyline business. Writers, after all, are cheap.

Tuesday, October 21, 2008

Success!

As long as a player is standing still, all the equipment that player is wearing is rendered correctly. I'm still having some issues with equipment jumping around on the y-axis when a player moves, but I'm sure that I can sort that out with an hour of debugging.

I also need to work out the correct draw order (hair sprites always draw above the head but below the hat. Depending on the angle, swords will draw in front of the body, or behind the body). This will probably take me an afternoon to perfect, and I think I'm going to put that on the backburner while I work on more exciting additions to the engine.

So, what's next?
As soon as I get equipment rendering perfectly, I'm going to work on interacting with objects on the map: openable and lockable doors, clocks that tell the time, candles that a player can light, and chairs that the player can sit in. A player that owns an object will be able to pick that object up and place it again in the world. Objects with more than one action will display a Sims-like interaction menu. Some objects will have a preferences panel accessible from this interaction menu (for example, a clock will have the option to change its time zone). Not all objects will have a preferences panel.

The clock in this time zone just struck midnight. It's time to go to bed. G'night. :)

Monday, October 20, 2008

Progress report: 10/20

On Mondays, I have a three hour break between a course in hard science and a course in soft science. Today I spent that break working on essential item routines.

3:10 Players can now pick up items from their inventory, and organize items in their backpack.

4:03 Players can now equip items to equipment slots. I haven't yet tied in the equip slot restrictions from the new database (see yesterday's entry), so you can currently wear pants on your head. I am not entirely convinced that this 'bug' is not actually a 'feature' in disguise.

4:48 Equip slot restrictions are now implemented. You can no longer wear a bag over your head.

5:26 Four minutes before my next class begins, I put it all together: Items that are equipped on a player's paper doll now show up on the player's character in the world!

There's just one small problem: equipped item are being drawn behind the base player graphic. So players are still naked, but at least they have a 'halo' of clothing around them.

I have yet to implement bags as an extension of a player's inventory. The engine's framework absolutely supports bags, but since I've spent a good deal of time getting the basic inventory working, I'd rather move on to something new. I'll implement bags when I'm at a point where I need additional storage space in my inventory to continue with development.

Sunday, October 19, 2008

Progress report: 10/19

When it comes to programming, my biggest stumbling block has always been content. I am capable of designing formats for the databases, textures, and data that drive the engine. However, the thought of actually having to create that content - whether it is maps, graphics, or database entries - is absolutely unnerving.

To a certain extent, I can manage this problem by temporarily 'borrowing' content from other games. Over the years I've borrowed content from Ultima Online, Diablo I & II, and World of Warcraft amongst others. But in order to work on the items, I had to create an entirely new database of item attributes.

The database has about 100 different attributes for each item, and it took me 4 hours to design, implement, and fill the database with some placeholder data. I spent another hour coding an engine class that interfaced with the database and pulled data from it as necessary. However, I was unable to force myself to sit down and put this minimal database together until early this morning (again, unable to get back to sleep).

Once I had the database together, things started coming together quickly: I programmed a simple inventory panel and had the items display as an icon. Next, I'll be working on equipping items.

The art for this inventory/paper doll interface panel comes from the same old project as the statistics panel. Like everything else, it's just a placeholder.