Progress report - Nov 2013
Progress report - Nov 2013
Its been a while since I posted any info on the Caveman project, so I thought i ought to post an update. While I haven't posted any blog entries or screenshots in a couple months, I have been very busy working on the game.
As of the last update in mid-September, a first pass had been completed at making it draw everything in the game.
Since then, most work has been on polishing the graphics, with some optimization of accelerated time mode as well.
The following was completed in the last half of September:
adding dead as well as alive bandmembers led to the "code change in 99 places!" thread, and a bit of modding of the code. In the end, its refactored, better designed, more generic, and more flexible for use with adding further features.
a simple alpha texture blending effect was used to draw snow on the ground with fixed function pipeline.
a generic ground mesh generator was created, then added to the game to create cavern floor meshes on the fly as needed. its based off the "new way" chunk terrin mesh generator, and is generic enough to be used for caverns, caves, even the outdoor terrain meshes. but the chunk system works fine, so i see no reason to refactor it to use the generic mesh generator. however, all future features will use the new generic mesh generator.
I've actually done this with a number of systems developed for the game. For instance, there are three different internal API's available for checking the conditions for beginning an action. The original API could only perform basic checks, such as some level of a single skill and some quantity of a single object. The second API expanded this some. The third and current API uses a "requirements record", a struct that contains all the info related to performing an action: skills, tools, and parts required, in what quantities, and of what quality, and what skills you get experience points in when you successfully complete the action. Since the game has 100 types of actions, and many can be triggered in multiple ways (gather wood is an option on both the jungle and woods action menus), and since the older APIs worked fine for the actions that used them, i never went back and refactored them to use the newest API. When i do need to make changes to the trigger for an action, i update it to the new API if needed. This is basically a case of "not fixing it if its not broken", because there's so much other work to be done.
I added a Zaudio library to the collection of Z libraries - a wrapper for the Xaudio2 and 3D sound APIs, and made the game use it. So the game can now play wav music and sound effects. However i still have yet to create any audio content for it. at the moment it simply plays track one off of an Offspring album as a test. can't remember the name of the album. "self esteem" and "gotta keep em separated" are on it.
Npcs now use all types of weapons and armor in the game.
The code has been modified with conditional compilation to create both a full version and a demo version of the game. the demo will be used for beta testing, and as marketing material.
The game now lets you view the model of your player.
A caveman model viewer has been added that lets you view any caveman model in the game - of which there are almost 600 now.
As an example of the level of detail in polishing graphics:
The game now draws rain outside an overhang, not inside it, when you're under an overhang. Not even Oblivion does this. try it. goto weynon priory, and walk through the "tunnel" to the stables when its raining. it rains inside the tunnel! Actually most games do this, they draw rain if outdoors, and don't if indoors, and leave it at that. It was only after i added the effect that i noticed that Oblivion doesn't do it.
A generic random map API was created. Since pretty much all of Caveman is procedurally generated, it relies heavily on "pattern maps" of various sorts. these maps specify the location and orientation of things like trees, bushes, rock outcroppings, plants, as well as things like what ground texture tile to use on a given ground quad. The heightmap for canyon floors needed improvement. it seemed a perfect time to experiment with a generic random pattern map. the map itself is a simple structure:
its seeded with random values from 1 through 100. the map can then be interpreted as one sees fit for any purpose. for its first use, i wrote a routine that converted an x,z location to a y altitude based on the random map. x and z were dvided by 10, then modded to get the
"randmap[x][z]" indices. an flerp was done along the north and south edges, and then between the edges, to the the exact point between the corners [x][z] and [x+1][z+1] on the randmap.
the user interface for the game was changed. it no longer displays any stats whatsoever, no health bar or anything! instead, when a stat gets low, an "idiot light" such as "low water" or "high damage" is displayed. this seems to make for a much more seamless and immersive experience.
besides the above mentioned, the following graphics were done during late September:
chasecam view in interior scenes
improvements to clouds, sky, plants, skybox, dropped objects, and lighting.
* drawing swamp
* bandmember attack animations based on weapon type.
* player's model animated in 3rd person view.
* i found an interesting typo / logic error (yes, a BUG in one of MY programs!):
frame % 15 == a,
a % 15 == frame
this made NPCs numbers 15 and higher never select a new target, causing them to all run off in the same direction.
* new AI for bandmembers and npcs with missile weapons.
* hit points were re-balanced from body_wt / 10 to sqrt(body_wt). the old formula made big critters unrealistically hard to kill (like 100+ spear hits to take down a mammoth). now the hit points and damage system are in line with all available archaeological evidence as to just what it took to kill these animals.
* made accelerated time run faster. this was done by using the 2D indexes for the flatfile cave and hut databases. The game has 50,000 caves, 5000 rockshelters, and 28,000 huts. all in one big flat file database (array of structs). the first 50,000 structs are caves, the next 5000 are rockshelters, and the last 28,000 are huts. looping through 5000 rockshelters checking for encounters with their occupants isn't too bad, but doing so for 50,000 caves or 28,000 huts is a bit slow. so 2D indexes were created for caves and huts. the index is a 2d array whose indiecs are the map square coordiantes. the entry is a list of the indexes of the caves caves or huts in that map square. so encounter checks are only done vs the caves and huts in the player's map square, not all 28,000 or 50,000. this sped up the periodic encounter checks for occupants of nearby caves and huts. as a result, accelerated time runs much faster now. A fast as one game hour per real world second, while still doing full simulation of everything.
* drawing missiles (arrows, altatl darts, sling stones) in attack animations. it already draws the weapon, and draws the missiles in flight and on the ground.
* improvements to rain and falling snow effects
* improvements to rendering tall grass terrain. added a second grass texture, tweaked the textures for more realistic coloring. added functions that use the new generic randmap to do texID, scale, rotation, and offset for grass. Now the tall grass terrain is generated using a single generic random map - the same one used for canyon floor heightmaps! looks good. i'll post a screenshot.
on october 30th i started on improving the animal animations. its now November 27th, and i'm still at it. The game has about 50 types of extinct mega-fauna in the game. each type of animal has 5 animations: stand, walk, run, attack, and dead. So far i've done about 40 of the 50 animals in the game. Each animal takes about half a day. The game is now up to about 110 animations total. reuse of animations between animal models has been less than hoped for. this is partly due to inconsistencies in the modeling. if a body mesh is flipped around end to end or upside down when creating the model, the rotations for the animations are backwards, resulting in some interesting moonwalk type results. This requires separate animations for critters with flipped bodies. next time, i'd just use two separate un-flipped body meshes so i could share animations. size of the animal also can make animation sharing impossible. large and small animals seem to need to move at different speeds. and the leg length of an animal has a definite effect on the speed at which a walk or run animation should play to sync properly with their forward progress across the ground. One of the big surprises is the stand animations. you would think that one generic animation of standing around doing nothing would work fine. As it turns out the stand and attack animations tend to be unique for each type of critter. Stand is where the personality of the animal comes out. so the stand animation for a hippidion proto-horse must behave like a horse, and camelops must behave like a camel, and silvatherium must behave like girrafe, and... well you get the idea... so slowly but surely i'm bringing all these extinct mega fauna back to life. testing the animations is quite interesting. You start a playtest game, punch up the animal in question, and watch it - like on animal channel! makes me feel like the crock hunter, or marty stoufer of wild america, or marlin perkins of mutual of omaha's wild kingdom. Once you've got them behaving correctly and have the walk sync'd up to the right speed, then you punch up some caveman encounters and watch the combat. this lets you check out the attack and run animations. after much back and forth of "this leg kicks out to far" and "runs still seems a bit slow", you eventually get something that starts looking and behaving like a real live animal. as i go along, some need improvements. i redid similodon populator (the biggest saber tooth ever) and homotherium (american scimitar cat) from scratch. Since taking on a saber tooth tiger was the original inspiration for the game, figured i HAD to have a better looking smilodon. so it was back to the reference photos, and the downloaded models to create a new set of limb meshes and assemble a new model. results were better than expected. A couple other models got minor adjustments to improve the head pivoting of the model for animation purposes.
i'm currently working on animal type 61, the dire wolf.
between the terrain graphics and the animal models and animations, there are times when its really starting to look like the real thing! which is much more than i could ever hope for - given that its just me, and not an army of graphics coders, modelers, and animators.
improved animations is last major thing for graphics. i'd really like to get some rayleigh in-scattering atmospherics going, but that will have to wait. there are more important features to be implemented. savanna and prairie terrains still need to be improved. looks like i'll be making my own acacia tree model from scratch, as none - even those for sale on turbosquid - looks correct. a few other minor things, and animating flames, is about it for graphics. Then its time to implement the remaining high level features such as raidung and inter-band rivalry. and then its test and tweak time, along with beta testing, and when its ready (but not until!), release!
wait, is that a speck of light i see at the end of the tunnel?