Jump to content

  • Log In with Google      Sign In   
  • Create Account



"instancing" with DX9

Posted by , 31 December 2016 - - - - - - · 1,078 views

The new PC has arrived (i7-6700K, GTX1080), and I'm starting on the final graphics for the game.


Better grass plants were one of the first things. The placeholder graphics were ultra-low-poly, just 3 or 4 quads. I could only draw them every 5 feet or so, any closer together was too many instances. They were scaled very wide and flat to cover the gaps. it looked ok en masse, but individual plants weren't that great.


So after watching Youtube tutorials, i made some better plant models. I was testing them out, but noticed a frame rate hit. 2500 instances was ok, but a bit of a performance hit. 10,000 was a big performance hit.


So i did some experimenting. i would track the number actually drawn, and the number of polys in the mesh being used, and the FPS, and the scale. at first it seemed the number of draw calls was having the biggest effect, followed by the number of tris in the mesh used, with mesh scale (big tri rasteriization) practically no effect (scale up the grass in your game to 20-30 feet tall - it looks wild!). but on closer inspection, i was drawing about the same number of quads with 10000 one quad meshes vs 2500 3 quad meshes, but 10000 was half as fast. turned out it was the figuring out of which of the 10,000 to draw that was the performance hit.


So then it was time for some test code. The optimal way to do it would be to pre-calc the lsit of plants to draw, along with their world mats. set the texture, material, mesh, clamp, cull, tex scale, etc just once, then for each plant in the list, set world mat, then call D.I.P.


I tried it with 2500 plants. a 100x100 foot area with one plant every 2 feet. worked like a charm. no change in framerate. still 60 FPS. then i tried 10000 plants (200x200 foot area, one plant every 2 feet). worked like a charm. no change in framerate.




Posted Image


the total meshes drawn is in addition to the 10000 grass plant meshes. those are the ground, tress, berry bushes, the huts, the teepee, the fire, people, etc.


Posted Image


this shows a closeup of the grass. still needs work, but its getting better.


and here's the test code:

 optimal:  pre-calc all world mats
			set alphatest, cull, clamp, material, and tex scaling once.
			set each tex once.
			for each tex, set each mesh once.
			for each mesh, set world mat, call DIP

    #define max_grass_list 10000

D3DXMATRIX grass_list[max_grass_list];

    int num_grass_list;

void init_savanna_grass_list()
    int x1,z1;
    float x,y,z,sx,sy,sz,ry,jitter,scale;
    for (x1=0; x1<100; x1++)
        for (z1=0; z1<100; z1++)
//  MrotateRADS(0,rx);
//  MrotateRADS(2,rz);

void test_draw_savanna_grass()
int a;
HRESULT result;
Zsettex(454);   // 6=ocean
for (a=0; a<num_grass_list; a++)
	if (result != D3D_OK)
		Zmsg2("test draw savanna grass error");

so it would seem that lots of drawcalls is not necessarily a bottleneck. perhaps even less of a bottleneck than high poly meshes. i tested plant meshes with as few as two triangles, and as many as 64 triangles. as is often the case, its visible surface determination that's the bottleneck here. In such cases, optimization in the form of DOD seems to be the best approach.





I turned off the test code to draw savanna grass, and turned generate_savanna_grass back on. I kicked it up from one plant every 3 feet to 1 plant every 2 feet (from 10,000 to 22,500 plants per 300x300 foot chunk). This required an increase in the number of max_meshes in a terrain chunk (from 20,000 meshes to 25,000 meshes). but with a chunk cache of 90 chunks, that ran out of memory. So i knocked the cache size back down to its original 30 chunk size.


i'm now making 36,000+ draw calls per frame at 60 FPS - clip range in this shot is set to 400 feet for everything:


Posted Image


Since the data structure for visible surface determination is the key to all this, i'll provide a few details....


the entire graphics engine is build around a struct called a Zdrawinfo struct. it contains all the basic parameters for a draw call, such as mesh ID, texture ID, material ID, and flags like cull, clamp, alphatest, etc.


When a terrain chunk is generated, data from the world map and plant maps determine the terrain type and placement of trees etc. A terrain chunk is a list of Zdrawinfo structs - all the meshes in the chunk. it also has an index, which lists the structs in texture, mesh order. When a mesh is added to the list, an in-order insertion is done to the index. so the chunk contains the list of Zdrawinfo structs, and an index that consists of a list of textures, and for each texture, a list of meshes, and for each mesh, a list of instances in the Zdrawinfo list that use that texture and mesh combo. The index is implemented using ints for storage, and stores texture IDs, mesh IDs, and Zdrawinfo list indices . When rendering, the index is used to draw the meshes in texture, mesh order - to minimize state changes. The graphics engine includes state managers for all states such as cull clamp, alpha test, etc. - so so any redundant changes occurring there while rendering the instances of a texture.mesh combo will be automatically filtered out. Chunks are generated on-demand in the foreground if necessary, as well as being generated in the background using a multi-pass look ahead system to generate chunks around the player before they move into visible range. Generating 22,500 plants vs 10,000 in a single background pass is slightly noticeable. I'll probably need to split that up into two passes. Depending on the type of terrain in a chunk, a chunk can require up to 6 or 8 passes to generate in the background. background chunk generation runs at 15Hz. The game now features a user defined variable frame rate limiter that scales update to the desired framerate. Vsync is still on to avoid tearing, but desired FPS values of 1 through 1000.are supported by the code - if you have the hardware to do it.


NOTE: Apologies for the somewhat dark images. these screenshots were taken at 6:30 AM game time under natural lighting conditions.

Status report 6-15-2016

Posted by , 15 June 2016 - - - - - - · 693 views

status report 6-15-2016


the game is really coming along. its now complete, stable, and appealing enough that i've started playing it just for fun, instead of playing store bought games i own. "resource tracking on a per resource basis" and "lack of variety in diet affecting mood" have really made gathering and preparing food more realistic, challenging, and interesting. the addition of large and small flint points and pitch has made crafting much more realistic. it amazing how small rule changes in the mechanics of a game can result in big changes in the dynamics of a game. those two small changes have raised gameplay immersion levels by amazing amounts.


highlights of new features:
* about 20 types of quest generators completed so far
* A* (A-star) path finding
* wood palisaides
* villages
* cave painings
* numerous new actions and objects


big stuff left to do:
* quest generators
* final graphics


new since the last status report on 3-17-2016:
* game tracks last 10 types of food eaten. eating the same thing too often reduces mood.
* followers and pets now moveto owner at rng 50 and stop at rng 10.
* TAMED no longer migrate as part of graze behavior
* added msg if your pet gets killed
* all damage in the game now uses hit loction. old damage variables turned off.
* crippling affects animal and NPC movement rates and attack capabilities.
* give some indication of effect upon eating a spirit plant.
* changed popup & fullscreen menus and messages to dark stone background for greater contrast with white text.
* fixed: selected_pet wasnt hooked up.
* make BMs move out of your way when you push against them. when player collides w/ bm doing nothing, they go into collision recovery.
* fixed: sleep in bedding in hut, then get stuck in walls when wake up. sleep in bedding snaps them to bedding center. bedding center is in walls. select picks spot 3-4 feet in front of BM, inside hut. beding is made 5 feet infront of BM, and thus inside the hut walls. simply create bedding at BM loc, then its guaranteed to not be inside the wall! : )
* pets should reduce chance of being suprised - should raise alarm when encounters happen. pet within 100 cuts BM chance of being suprised in half.
* option to switch to bm if they are attacked while doing an action
* companions, warriors, and pets move out of your way when you push against them.
* make b2_avian_eatkill use meat resources, not general resources.
* defend berrybush, fruit tree and waterhole quests now fail if player flees.
* fixed: rockshelter collisions not working. terrain_in_way and terrain_in_way2 now use rockshelter_in_way instead of collision map. a rockshelter is not a BBox radius type obstacle. generic_move2 and b2_bm_move didnt do collision checks when BM was inside rock shelter. so BM sometimes got stuck in collision against interior walls.
* fixed: silvatherium attacks CHR cavemen at rockshelter, and they just stand around. friendly AI was just targeting HOSTILE, not WILD.
* new_set_tgt must consider all potential threats when selecting targets, or fight or flght won't work. so friendly AI must tgt WILD and hostile for
+ wild should target: all but their own kind.
+ goodguys should target: hostile and wild
+ hostiles should tgt all but hostiles.
+ nobody targets captured or subdued
WARROIR, COMPANION, and TAMED now use set_friendly_tgt (all wilds/hostiles) set_wild_tgt and set_hostile_tgt are already correct. set_friendly_tgt was fixed yesterday.
* fixed: forgot to add "staunch wounds" to the "other actions" menu.
* fixed: dropall and a number of similar routines (give_all, storeall, etc) didnt check for active object. all were code used by routines that call
shift_select. checked all calls to shift_select, to make sure all such routines were fixed. this was the cause of nuts appearing in storage pits!
* defend quests: takes too long for badguys to show up. i'm defending a rockshelter. gotten a dozen animals encounters (its a busy place!), but no badguys. been there almost a day. increased raid chance from 1 in 100K per sec to 1 in 10K per sec. avg of 2.77 hrs, vs 27.777 hrs between encounters.
* fixed: boost stats doesnt un-cripple limbs
* cut encounter ranges for dense terrain types (woods, grass, jungle, rocks)
* volcano collision rad is off - increased to 55. volcanos can span more than 1 collision map. so portion in adjacent map doesnt get set to impassable. will need different collsion check for volcanos. removed volcanos from collision maps. now uses true 2d rad of 70 ft.
* not many volcanoes in the world? increased chance 10x
* fixed: quest_animals_removed doesnt work with multiple simultaneous defloc encounters.
+ add is_quest_animal, quest_BM, and questnum to animalrec.
+ set is_quest_animal etc when spawn quest animals.
+ add animals_removed to questrec.
+ make remove_animals set cm[quest_BM].quest[questnum].animals_removed if it removes a quest animal.
* new: need non-defloc aggressive quest AI. if quest animal and not defloc, runs new quest AI.
new quest gens:
defend rock shelter
defend hut
defend berry bush
defend fruit tree
defend waterhole
get special item
volcano quest
* attack cave rockshelter and hut quests done
* new fuction: dist3. bbdist in ft. works up to 75K map sq range! (375,000 miles!)
* fixed: crh encounters now spawn outside the crh
* replace quest_animal_alive (any defloc alive) w/ quest_animal_alive2 (any quest animal for cm1 quest q alive)
* replace quest_animal_removed with cm[a].quest[b].animals_removed
* done: all quest gens: must trap out player simply fleeing and quest animals deactivating.
* checked volcano quest. double spawn is fixed.
* kill animals for reward - places animals at a map sq too far from questor, should be 1-2 sq radius. same for kill cavemen for reward. made a version of randommapsquare that takes a radius.
* MOVETO_QUEST (find treasure) need to change view_quest message when quest begins. general loc is now known. no longer random chance to find treasure, now must look for it.
* refactor: getter and setter functions for animal, caveman, and worldobj locations. make them call generic location getter and setter fucntions.
* success, fail, and encounter wavs for quest messages.
* fixed: friendlies talking to you: if they ask you to talk and you say yes, and you do a talk action, they greet you again after the talk action. didn't set flag to "npc done talking to player" when called the talk action. so after the talk action, it went back to NPC talks to player again.
* increase clip rad of gt moa
* fixed: cant eat w/ 1 crippled arm. EAT was not set to 1 hand action. made a couple other actions 1 hand (like staunch wounds).
* crh hostiles get stuck in / spawn in rocks. uses something_in_way_of_animal for placement. 5 calls to terrain_in_way with +1 on rad - uses collision maps for rocks. uses terrain_in_way2 for movement. one call. uses collision maps for rocks. the +1 rad fix might take care of it. have to wait and see.
* make sure new items like teepees and bedrolls are on treasure tables.
* grunt sfx for npc talk to player dialog messages.
* success and fail wavs for talk to caveman menu
* to do an action, anvil stones can now be nearby or in your inventory.
* only one BM at a time can use a dropped anvil stone to do an action.
* picking up an anvil stone in use stops the user's action.
* tried lessons and advisor
* improved character creation
* improved tutorial
* set bleeding, crippled, etc to false when bring them back to life.
* anvilstone nearby fixed
* butcher time and butcher quality fixed.
* improved getstring
* improved fullscreen menu
* new: stone buttons
* make sure all calls to getstring say "Enter <hwhatever>..."
* add success and fail wavs to run_tutor
* checked: resource depletion by other bands works with the new resource levels by type
* fixed: BM_bestwpn and npc_bestwpn now take crippling vs 1 and 2 handed wpns into account.
* fixed: if missile tries to hit animal, animal sets all nearby friendly animals to "taking fire". even if animal is killed in a single shot, the rest have been alerted.
* fixed: terrain_in_way and terrain_in_way2 sometimes returned CM terrian type, not 1. made someting_in_way_of_animal not work. thats why animals were spawning in rocks.
* put trace on pet wolf AI
* added collsion map check w/ radius to something in way of animals. rocks are still an issue.
* fixed: run_pack_ai didnt check if animal was wild. only wild animals run pack ai. bug made tamed run pack ai sometimes.
* collsion avoidance doesn't look as far ahead, doesn't move as far.
* collision recovery ends sooner
* bandmembers, companions, warriors, and tamed now follow you in and out of caves and caverns, either as owner, or via follow orders.
* fixed: friendly leaders collision avoid cm0 while approaching cm0 to greet.
* fixed: 3pv cam vs NPC huts. adjusted check for crh huts to match that for player huts. added check for crh huts to 1pv vs 3pv code. wrote new routine to check abandoned huts. made it match the code for player huts. added that to 1pv vs 3pv code.
* fixed: 3pv: draw player in hut if doing action. if they are doing an action, it does not check for "don't draw in hut".
* fixed: 1pv skin tex not set when follower joins band
* fixed: 1pv skin tex not set for playtest game
* fixed: reduce radius for fire light and sound.
* fixed: no grass area around tarpit is too big? tarpit too small? its that darn 10 rez on the ground mesh. cant model small curves well. make tarpits bigger. increased rad of tarpit from 15 to 30.
* fix: lakes should be bigger. be sure to resize both graphics AND collision checks! increased rad from 30 to 100.
* implemented A*. still ned to test it, then hook it up to the game.
* spiced veggies: findtime and findchance were not set. was using defaults (1 hour and 1% chance of success). removed spiced veggies from the init lookup functions and into the regular init code.
* learn hafting: now requires flint knife, not cutting tool as part.
* change stoneworking to knapping. require flint, knapping tool, and one hand hammer to learn.
* changed time to make wood arrow from 8 hrs to 30 min.
* add large & small flint point objects. large to make knifes and spears, small to make everything else. 300 stoneworking to make small, 500 to make large. need small to learn hafting. draw lg point as flint knife w/o handle. draw small point as 1/3 size lg point.
* make cutting tool no longer requires knapping skill. make cutting tool now increases knapping skill.
* got 2d map A* working. long setup time. high ram requirements. fast.
* got traditional 2 list A* working. zero setup time. low ram requirements. fast. not fully optimized yet.
* fixed AI vs campfires. flee from campfire has its own vars now. wild animals don't target entities near fires.
* added fight or flight to predator respond to missile fire.
* collision map system now supports collision maps at arbitrary scales. no public API change required! just get_CM_index API used by A*.
* got A* fully working in the game.
* collision checks use high rez collision maps once again.
* added +0.5 x and z offsets for collsion map checks for "pixel perfect" accuracy (rasterization rules).
* "make small flint point" action now repeats as long as you have parts.
* social is zero, but not nuking mood. changed mood reduction from 23 in 10000 chance of 1 every 15 minutes to 1 every 15 minutes.
* make cordage: says no anvil stone on or nearby, when there is. there are 2 stones, one already in use. but use of second stone was stopped by combat. it still may be flagged as in use. added stop_usng_anvilstone if new action==DONOTHING to setaction.
* removed from game: (not realistic)
stone arrow
stone spear
stone javelin
stone atlatl dart
stone fish spear
flint throw rock
* add 1 wood required for flint knife. knife gets wood handle. need model.
already added leather handle requierd. added cordgae, hafting, etc. made new model.
draw 1pv wih doen't use new model yet.
* cook foods: ask how many to make? just make all? make up to 5 at a time? already makes as many as you have parts for. how many would require modding each try_cook(somefood) call.
* pet: check health: left arm hp/dmg: need space after "l arm".
* as friendly leaders migrate and get removed, each new leader come up to player and greets them. should set all nearby friendlies to will_talk=0 when set leader to will_talk=0. now sets all freindlies within 500 feet of player to done talking when leader is done.
* quit to desktop from ingame menu
* fight or flight: should do flight for some period of time, not just until reach edge of fight or flight check range.
* CRH npc asks to trade: should do band trade, not individual trade.
* add band dialog action: ask ally to join village (move next door). checked and done!
* if CRH band is ally and shelter is within 500 of player's shelter, divide migration rate by 10 when changing the map. checked and done!
* villages - ally invite to join - add build hut quest. checked and done!
* allies should not ask you to join village if they have already asked you and you accepted but have not buiilt a hut there yet. checked and done!
* allies should not ask you to join village if you already have a hut near them. checked and done!
* added log object checked and done!
* heavy objects are exempt from container rules checked and done!
* heavy objects need only be nearby to use them checked and done!
* mark and unmark nearby objects as in use checked and done!
* added gather logs action checked and done!
* added wood wall object checked and done!
* added make wood wall action checked and done!
* inspect wood wall action checked and done!
* repair wood wall action checked and done!
* demolish wood wall action checked and done!
* select dead BM, take stuff. checked and done!
* add ability (IE action) to check resoureces in the area, see how low they are. . checked and done!
* new: fish with fishnet action. new object: fishnet. - already done : )
* new: add fishing actions to shoreline/ocean terrain . checked and done!
* new action: play with water. all water terrains. . checked and done!
* watch sunrise action . checked and done!
* watch sunset action . checked and done!
* new action: watch snow fall, like watch clouds.
* chat w/ bm action . checked and done!
* chat w/ npc action. . checked and done!
* catch rain in mouth (drink)
* catch snow in mouth (drink)
* select snow on the ground
* eat snow on ground for water. water goes up, but food goes down a little.
* melt snow with fire to make water
* shoreline: swim in ocean action . checked and done!
* select cave interior wall. checked and done!
* make cave painting. checked and done!
* new: obsidian resource. better than flint.- fisrt and easiest thing you can do is make it so you can find flint (obsidian) at volcanoes. then you can add the obsidian object (like the flint object), and the small obsidian point, and large obsidian point (takes less time, lower chance of success, higher value than flint). and then add obsidian weapons and tools. or just use obsidian to make higher quality flint tools. add obsidian object, only gather ta volcano. add small and large obsidian points. when make stuff with points, give option to use flint or obsidian, if obsidian, increase quality of weapon. or just add obsidian object, and give choice of obsidian or flint when making the point, and it increses the quality of the point, which will ultimately increase the quality of the tool or weapon. thats the easiest way to do it. so add obsidian object which can be gathered near volcanos (say within 300 feet). when make points, give optin to use flint or obsidian. if obsidian, increase quality greatly, or simply have obsidian always be 150 or 200 quality or something. coyuuld just have it display the name obsidian if the quality is high, and obsidian is just a high quality type of flint. that would be even easier. so add "gather obsidian (high quality flint)" to the volacano menu. takes a long time? yields high quality flint. requires one hand hammer stone?. checked and done!
* new object: pitch. a glue used for hafting etc. can use tar or tree (pine) pitch. to harvest pitch, wound the tree, then wait a few days. hmm - how to model that? woods - cut trees for pitch. woods gather pitch. must cut trees for pitch first. marks trees as cut - with a timestamp. when harvest, only
proceed if timestamp is old enough. clear timestamp when they harvest. make pitch use wood resources. make all objects require pitch for crafting. can't use tar yet, just pitch. checked and done!
* add to game: S_MEATVEGGIESTEW. already in there: S_STEW. object #31.
* new object: sundial compass stick. stick it in the ground pointing at the sun, and wait 15 minutes. the shadow points roughly east.
* find sundial compass stick action
* use sundial compass stick action
* researched deadfall traps, fishtraps, and tanning
* changed requirements for making tanned hide.
tanned furs:
1. scrape inside w/ scraper
2. mix brains and water, coat inside(?). soak & stretch to soften. - smoking can hasten process somewhat?
3. smoke to make insect repellent (optional)
tanned leather:
1. remove fur - scrape
2. scrape interior
3. soak in brains and water and stretch to soften - smoking can hasten process somewhat?
3. smoke to make easer to re-soften after getting wet. (optional)
so they are both basically the same, one you scrape off the fur, the other you don't.
so a tanned hide can be with or without fur.
and it requires brains, water, a clay pot, a scraper.
and all items should be made from tanned hides, not hides.
need to add brains object.... ugh could assume they take the brains with the hide... and the weight and value represents the hide and brains as a "package deal". until they make a tanned hide. then the brains are there, ready and waiting. except for buffalo, whose brains are too small to tan their own hide. no need to track eacj part of a butchered critter, just one per type of use. so for tanning you need hides and brains - in equal numbers, and you get hides and brains in equal numbers. so unless you get into trading them, you can just track one, and assume you always have the other to go with it - the "package deal" concept. so a hide is really more like "tanned hide parts".
* all objects now require tanned hide for crafting, not hide.
* removed tanned hide armors. all hide armors are now tanned.
* removed stone and shell armors - unrealistic.
* add funnel fishtrap object - inventory item
* add make funnel fishtrap action
* add set funnel fishtrap action. requires bait and stream, river, or lake. sets timestamp.
* add check funnel fishtrap action. check timestamp, add fish and remove bait
based on elapsed time.
* wood stake fishtrap object
* draw_dropped_obj draws wood stake fishtrap at water level
* make wood stake fishtrap action
* inspect wood stake fishtrap action
* repair wood stake fishtrap action
* abandon wood stake fishtrap action
* bait wood stake fishtrap action
* check wood stake fishtrap for fish action
* maps as treasure on dead hostiles. adds info to player's world map.
* musical bow object
* make musical bow action
* play musical bow action
* added stufflist_wt_carried_in_containers() routine
* added stufflist_container_capacity() routine
* added stufflist_needs_more_waterskins() routine
* added stufflist_can_carry() routine
* added encumberance checks to transfer_items
* added container checks to transfer_items
* added waterskin checks to transfer_items
* added transfer_items to storepit menu
* added transfer_items to travois menu
* added transfer_items to bandmember menu
* added transfer_items to exchange items with companion menu
* added avoid_cliffs() to B2_avian_common_part1 AI. if below and just south of cliffs, flies south and climbs.
* defend friendly questgen:
player hears of friendly w/ quest. player goes to friendly. freindly aks for help killing badguys threatening them. player hangs out, badguys attack. if friendly survives and all badguys dead, player gets reqqrd and end of quest. if frieindly dies, no reward and end of quest. if badguys get away, trigger another badguy attack after a while.
* random_active_npc now handles "all known npcs already active in sim".
* new_npc now returns -1 on error.
* all calls to new_npc now handle -1 errors.
* all calls to set_npc now check for npc_in_sim first
* fixed: add_gift_giver now checks for npc_in_sim already. was just adding the first npc found. used by both gifts and call for aid. get both at once and it tries to add the same npc twice - and BOOM! animation controller collision!
* turned off title screen
* allies ask you to join village: menu() is off by 1.
* fixed: allies give gifts too often?
* fixed: allies ask for help too often ?
* fixed: allies ask you to join village: menu() does yes when you click no and vica versa.
* decreased time for find wild veggies
* increased food boost of wild veggies
* fixed: gather pitch was missing from savanna and jungle menus.
* sleep goes down 10% slower on average.
* reduced frequency of ally gift encounters
* reduced frequency of ally call for aid encounters
* fixed: search dead BM: shows player's inventory, not dead BM's. says "give 10" and "give all", not "get 10" and "get all"
* exit cave: place them a little farther from the entrance.
* can't select cave interior to paint cave painiting!
* collision rad for cave interiors is a little too big.
* don't let them select the sky when inside a cave.
* adjutsed time and chance to find flint.
* fixed: gather pitch: shows fail msg after showing success msg.
* fixed: dont let them start gathering pitch if another BM in the map sq is already gathering pitch. action stops if another BM gathers the pitch first.

Status report 3-17-2016

Posted by , 17 March 2016 - - - - - - · 902 views

Major changes to Caveman v3.0 since the August 2015 release of beta 21:



ENCOUNTERS: (encounters and treasure now scale to party size AND level, not just party size)
* regular and quest encounter number appearing now scales based on party strength (numbers AND combat skills), so you get tougher encounters at higher levels of experience.
* regular and quest encounter treasure quantity scales with number appearing - which is now based on party strength (not just party size).
* quest treasure quality now scales with party strength.
* time of day now affects encounter chances.
* remaining resource levels in a map square now affect encounter chances in that map square.



* hit location and damage by body section, including cripppling, and its effect on combat, movement, and all actions.
* modeling of critical hits.
* modeling of bleedout, including a new "staunch wounds" action.
* check follower health and and check pet health actions (shows dmg by section, bleeding, etc).
* separate weapon hotkeys for each bandmember.
* new orders: alarm! (IE battlestations, we're under attack), stop what you're doing (stop current action).
* new action: automatically walk around and pickup ammo. super nice when you have dozens of arrows lying about after a combat.
* you can now change weapons while attacking. you just have to start the attack over with the new weapon, thats all.
* option to switch to bandmember when they get an encounter if they are not the current bandmember (IE the one the player is currently controlling).
* new skill: combat defense. works in lieu of hp increasing with level. refects you getting better at defending yourself.
* new combat move: dodge. quickly moves you fwd/back/left/right.



* new land predator AI.
* new defend location AI (used by quest encounters).
* new pack hunter AI.
* new domesticable wild animal AI (used by dire wolves).
* new follower AI
* new pet AI
* new combo defend/maintain distance AI - maintains distance from stronger animals, stands its ground and defends against others.
* respond to missile fire by animal type (all of a type attack or flee, not just the one fired upon).
* animals flee from campfires.
* graze behavior (wander, stand, flock, migrate) for pets.
* improved (but not perfect yet) AI for avians vs cliffs.



* re-balanced amount of meat, hides, tendon, etc from animals. amount of meat, bone, hides, etc on an animal is now based on animal weight. all animal types now have a weight. the heaviest being Stegodon (a type of mastodon) at 28,000 lbs.
* individual tracking of meat, hide, bones etc left on a carcass (and thus available for harvesting). also tracks meat quality - and meat on carcasses spoils over time too.
* butcher actions now take a short amount of time, and yield one unit of resources, and continue until you can't carry any more or there are no more resources. it used to take a long time (like a week for a single caveman vs a mammoth carcass!), then give you everything at once.
* multiple band members can now butcher the same carcass simultaneously.



* implemented 20 of 50 planned quest generators.



* teepee - basically a portable hut.
* bedroll - basically a portable version of bedding.
the teepee and bedroll combined with the travois means you can now take your entire camp with you.



* you can now build huts and lean-to's in caves.
* new dialog option: greet caveman
* new dialog option: exchange news - added in anticipation of adding fame and / or reputation to the game. exchanging news is how fame/reputation will travel.
* added ability to abandon quests you no longer wish to pursue.
* success or failure sound effects and messages for all actions upon completion



* re-balanced trade value of items
* traders now have limited quantities of inventory and money.



* max band members increased to 50
* max active animals increased to 500
* water stat goes down faster in hot weather.
* band members now stop most actions if their mood drops too low.
* improved domestication of dire wolves.
* local temperature now affects rate of food spoilage.
* tracking of resource depletion in a map sqaure on a per type basis, instead of as one generic resource.
* resources now replenish continually over time, instead of being totally depleted for a while before instantly replenishing to 100%.
* wild vegetables and poison plants are now found in more types of terrain.
* ability to exchange items with your travelling companions. includes tracking ownership, yours vs theirs. and NO, you can't take their stuff!
* gifts to NPCs now appear in their inventories.
* automatic transfer of liquids with containers finally works correctly.
* rafts have now been fully implemented. collision checks, AI, actions, etc - everything works with rafts now. during testing, it was very cool sailing across the ocean on a raft with one other band member, one companion, and my pet dire wolf, and seeing a new shore for the first time.
* friendly cavemen now have a chance to come up to you and initiate various dialog actions when you encounter them.



* better animations
* correct materials
* correct pitch relative to the 3pv camera
* drawing of equipment



* added making a wood spear to the tutorial - the stone knife object became a cutting tool, which is no longer a weapon.



* numerous minor adjustments and fixes to game balance - god is in the details!




a long period of time was spent addressing the question of "what to do when you're high level?".
the traditional solution of "Build a castle, raise an army, conquer the world!" from classic Dungeons & Dragons doesn't really work that well with a stone age setting.
turns out, its not "what to do when you're high level?", its "what to do when you've done it all?" (IE used up all the content in the game).
players need a continual supply of compelling new content appropriate for their level, not that hard in classic D&D, given an obliging DM. somewhat harder to do in video games (free high quality DLC to the rescue).
regular and quest encounters and treasure that scale to player's level provides content of appropriate difficulty for the player's level.
the ability to generate 50 different types of quests (compare to two for Skyrim's radiant quest system) will help keep things from getting repetitive too quickly.
a quest editor is also planned, along with some number of quests made with it, such as one or more optional story line campaigns. this will allow users to create and share their own quests. which may provide another possible source for compelling new content appropriate for the players level (since quest editor quests -IE number appearing, and treasure quantity and quality- will also scale automatically to player level).




* the ability to build a castle - caveman style. IE wood, dirt, and stone wall objects.
* multi-band settlements (proto-villages) - ask you allies to move next door.
* making the player seek out a wide variety of foods so they don't just stockpile and eat nuts all the time (for example). eating the same thing all the time will nuke your mood. maybe your stats too if mood isn't enough motivation.
* there are still a number of new actions, objects, and animal types still to be added to the game.
* misc features such as browsers for object types, animal types, and actions.
* multi-band gatherings
* mini games:
- stick and hoops (similar to lawn darts)
- chunkey (hit the thrown ball with the spear)
- non-lethal combat
- archery competitions
- and of course "rock", as in rock-paper-scissors. but its the stone age, so its before they invented paper and scissors, so they just have "rock"<g>. pretty boring game actually - always ends in a tie! <g>.
* boss monster and boss caveman encounters for high level players.
* final graphics



and then it will finally be time to release. Posted Image


there is currently no beta demo available. the public beta was a smashing success, with only two users reporting issues, one related to startup resolution detection, and the other unrelated to the game (corrupt UAC file interferes with install/launch, causing the dreaded BEX error). as a result, the startup resolution detection code has been beefed up to explicitly check caps, instead of assuming that caps which should be there are there.


I may run a semi-private beta for folks interested in providing feedback on gameplay. not sure at this point. if anyone is interested in something like that, PM me. you can never have too much feedback - whether you're talking games or guitars! <g>. (yeah, i play the electric guitar).

Beta 21 w/ skinned meshes released!

Posted by , 31 July 2015 - - - - - - · 820 views

Beta 21 w/ skinned meshes released!

guys look kinda dumb, girls aren't that pretty, the guy walk ani is kinda awkward (leg bones rotated outwards too far), no action animations or drawing of equipment yet other than weapon in hand, but its a start!


action animations and drawing equipment is next. I'll clean up that guy walk ani too. i found an unbelievably beautiful female head while looking for PD skinned meshes, which i plan to try and "Dr Frankenstein" onto a body. plus i also have the pretty girl heads from the rigid body models. Good looking guys - not so much luck. Just ultra high poly stuff i cant use - such as my original rigid body guy - the search continues. Just like a writer / producer / director in the film industry, i want/need/should use the most photogenic actors. My players deserve no less.

Work on skinned meshes continues

Posted by , 16 July 2015 - - - - - - · 865 views

Work on skinned meshes continues

I added the ability to draw weapon-in-hand to the skinned mesh test routine. It can toggle between weapon types, and uses the game's built-in matrix editor to position the weapon with respect to the hand bone. The test routine is used to determine the fixup transform for a weapon, which is then added to the database info for that weapon type.

It now draws all 65 or so different types of weapons in a skinned mesh female's hand.

A fixup transform for male meshes is next. Male and female meshes share almost identical skeletons, so just a single fixup for male vs female skinned mesh is required to make all the weapons draw in a male skinned mesh hand as well - IE move everything down and right a bit to account for the difference in the male and female hand meshes. These fixup transforms are roughly the equivalent of positioning a weapon bone for each skinned mesh in the modeling software, and transforming all weapon models in the modeling software so their grip point is at the origin, then drawing the weapon at the weapon bone with no transform. Unlike your typical shooter, not every weapon in Caveman has a uniform type and size of grip, such as a pistol grip or sword handle. so tweaking on a per weapon basis is really required to get the best possible fit.

Then comes the remaining attack animations. One hand attack is already done. spear thrust, bow attack, and a few others still need to be made. It looks like I can even share animations between male and female skeletons. It also looks like I need to clean up the skin weights a bit on the male meshes - the upper arm influences the ribs area. I thought it was from using the female attack animation, but its just a weight tweak issue, not an animation sharing issue.

I'll need to make a version of the skinned mesh textures for use with the existing 1st person attack animations - a simple copy/paste type operation in paint.net or gimp.

I also need to make some improvements to the startup resolution autodetect code. Right now its selects the resolution with the highest horizontal value that supports A8R8G8B8, and assumes 24bit depth buffer support is available at that resolution - which may not be a safe assumption in rare cases. I've only had two people report such issues.

And then its time to release beta 21. Beta 20 has already expired, so at the moment there is no beta available for download. Beta 21 should be ready in a couple of weeks. In order to get beta 21 out sooner, it will not draw armor or equipment, and won't have action animations. those will all be included in beta 22, which will probably take 2-3 weeks from the time beta 21 is released.

And then comes skinned mesh animals....

<whew!> i'd better get back to work! <g>

Adding skinned meshes to Caveman

Posted by , 08 July 2015 - - - - - - · 967 views

Adding skinned meshes to Caveman

A quick update since i haven't posted anything in a while.

I'm busy adding skinned meshes to the game.

When i started working on the game, i was not sure if i could draw the required number of skinned meshes on the target platform, so i used rigid body models to start with.

Now that i'm putting the final whammy on graphics, i decided to give skinned meshes a try.

A test run of the DX9 multianim sample showed the code could draw the required number of characters onscreen at once on the target platform.

So I turned the code from tiny.cpp into a skinned mesh library, got the dx9 animation controllers working, and figured out how to get blender and directx to work together.

You can take a look at the code here:

I'm able to share skeletons in blender, share animations via a batch file of copy+ commands, and the code has been designed to share meshes, textures, and materials. meshes, textures, materials, and controllers are all pooled.

The first thing i did was a test routine in the game to test the drawing of 100 characters onscreen at once with individual animations.

so far i've made all the human models and all the movement animations, and they are all up an running in the game.

i also added "change character appearance" to the playtest menu, allowing you to change a band member's appearance (even sex) at any time. This was required to assign new skinned mesh values for the band members in the long term playtest game.

attack animations are the next step. and then comes drawing weapons in hand, and equipment which is worn. i hope to simply attach all equipment to a bone, but i may need to animate some with the skeleton, the way i do for bra and loincloth. even attaching to a bone, i'll probably need a fixup transform on a per object basis to position it precisely with respect to a bone. and there are 65 kinds of weapons....

and then comes action animations.

and then comes skinned mesh animals... i'm going to be busy for a while!

actually, its going faster than anticipated. about 2 weeks to figure out dx skinned meshes. about 1 week for coding - really only about 3 days work there. another week or so to figure out blender. perhaps a week to do the meshes - there's basically just two, a male and female, 5 versions of each with different facial features and shared skeletons and animations. animations are taking about 30 minutes each on average to create, add to the game, test, and fix as needed.

i think there are only about a dozen attack animations per sex. and two to three dozen action animations. maybe a week's worth of work there.

for animals, i hope to use a few basic skeletons (such as quadruped) scaled to various body meshes, with shared animations. i think i'll be able to share animations between similarly scaled quadrupeds. so maybe one set for large quadrupeds, and one for small. each animal will only need about half a dozen animations. but there are fifty of them....

i don't plan to release a new beta until i have at least the attack and a few placeholder action animations in, as well as drawing weapons and equipment. The current demo expires soon, so there may not be a demo available for a while while i make the necessary changes.

once attack and weapons are in, i'll post a new demo, then move on to doing more action animations and skinned mesh animals.

Caveman v3.0 Beta 20 released

Posted by , 13 April 2015 - - - - - - · 1,225 views

Caveman v3.0 Beta 20 released

New for beta 20:

Turned off draw_animal_AI. draw_animal_AI displays AI related debugging info above active animals and NPC's. I forgot to turn it off in beta 19.

Download page:


Caveman v3.0 Beta 19 released

Posted by , 10 April 2015 - - - - - - · 1,348 views

  • savanna grass
  • "instancing" in DX9 - implementation in the game
  • "instancing" with DX9 - closeup
  • "Instancing" with DX9
  • Best bow shot ever - close up
  • My best bow shot ever in the game!
  • And last, but definitely not least - Savanna
  • prairie terrian
  • Improved animal models and animations: Smilodon Fatalis
  • Improved tall grass using the new generic random map.
  • Swamp effect with jungle vegetation
  • Swampy woods
  • Lots of batch calls!
  • The edge of the world!
  • Don't look now, but your skybox is showing!
  • Alpha blended snow
  • Title screen
  • The animation editor
  • The modeler

Caveman v3.0 Beta 19 released!

Play now!

Numerous changes in Beta 19:

* added export band member
* added import band member
* added de-activate band member
* make pigment rock object smaller.
* draws obj in hand for find pigment rock action.
* confirmed game won't run on XP.
* added obj in hand for make/find objects #70 pigments thru #173 blanket (103 objects - some need new anis though). added dinfo and fix as needed. made draw_dropped_object use dinfo where appropriate.
* added: stone drill required to make stone top armor.
* completed first pass at assigning obj in hand for make or find anis for all 237 object types. but some still need new graphics and / or anis. so most make, find, and repair animations draw object in right hand now, say 400-500 animations or so.
* reduced size of clay object
* make, repair, demolish type animations drawn closer to ground.
* increased NPC base chance to hit from 50% to 70%.
* increased BM hand attack base chance to hit from 60% to 70%.
* increased BM missile attack base chance to hit from 50% to 70%.
* moved make ani back down to -1.5
* made selected_dropped_object the first check in select().
* turned off colision avoidance in rocks. terrains is so thick they appear to just cycle between collision avoidance and collision recovery.
* select: checks for shelter before bedding.
* collision recovery: cut recovery time in half, since they now move at sprint speed (2x run speed)
* BM attack AI: explicitly calcs rng to tgt for start of attack. rng may have not been preset in cases such as "attack orders tgt", which overrides the tgt set by set_tgt. set_tgt pre-calcs rng and rh to tgt when it set the tgt.
* BM AI: no badguys nearby: priorities changed to:
1. do action
2. collision recovery
3. do orders
4. recover fatigue
5. stand
* BM collision recovery: cut recovery time in half, since they now move at sprint speed (2x run speed)
* maintain dist ai: added is_maintaining _distance AI state flag to animalrec.
AI now flees at 25 and stops fleeing at 50, instead of starting and stopping at 20.
* added BM AI on/off for CM0 via backslash key w/ AI display
* BM AI: draws wpn if attacking
* BM AI: reduced start atk rng
* sleep ani drawn lower to ground
* made sleep take a little longer
* increased rad for "inside perm shelter" from 5 to 10 feet
* daydream, watch clouds, stargaze: mood now goes up one every 5 minutes not 6.
* improved bigdice routine
* AI backs up at half speed
* BM AI start attack range for missile wpns set to 50.
* turned off collision avoiadance in woods - too dense
* collision avoidance rng reduced fro 15 to 10 ft
* playtesting
* flint spear: reduced cordage required from 3 to 2
* doubled value of hides and all objects made from hides
* done - made int affect building and fixing hut
* done - made int affect learn action: time, chance, and xp earned.
* done - fill waterskins takes too long
* done - draw all bm's on local map
* done - remove dead / butchered / sacrificed anilas after a while
* done - kick bm out of band
* done: "<bm name> you learned something new about <skill>" msg
* done: show bm name for a few secs when tab to next bm
* done: changed "do" and ".do" keywords in cscript to "d" and ".d". removed all c++ code blocks from source code. all code is now cscript or c++ that does not conflict with cscipt keywords. no c++ code pass thru blocks required! no "cpp" and ".cpp" everyhwere in the code! recompiled all source code with new version of cscript.
* done: made perm shelters a world object
* done: repair: parts reqd: 1/2 round down, not up.
* done: repair: quality is now avg of old and new.
* done - too easy to find cool rocks
* done - adj party str - too many badguys?
* done - companion ai stop when within 20
* done - increase base chance to make lean-to
* done - made int have greater effect on time and chance to learn stuff
* done: increase value of hides and stuff made with hides
* done: make flint tipped spear: only reqires two cordage.
* done: objects ropped in aved get placed outside caves.
* done: made int affect qual of tirm repaired
* dont let them pickup player huts - and abandoned huts - and landmarks
* adjust hut collision checks
* separate key for pickup dropped object. - z?
* bmsg "you pass out from lack of sleep"
* add "quiting caveman" screen at end of prog
* storepit full msg added, objects no longer lost when pit is full.
* precip increases water table by twice as much. no precip reduces water table by half as much. water table goes to baseline twice as fast over time. had global warming issues.
* automap_small_stuff radius increased to 300 feet
* fixed: automap_small_stuff does huts now.
* added next idle band member hotkey "N"
* daydream etc increases mood faster
* bmsg you arrive at your dest
* quiting caveman screen
* show all parts / skils for action if you dont have something
* joke and story actions: increased chance of relations improvement, increased mood boost.
* doubled find time for flint and cool rocks
* added initializing blank game msg
* increased base chance to make temp shelter. made int affect chance. improved how chance is calculated.
* increased chance to make storepit
* reduced caveman base number appearing.
* reduced effect of party strength on cavean number appearing
* party strength based on those within 300 feet, not on those in same map sqaure.
* increased drawing radius of bedding and storepits
* fixed: party_strength: using a continue statment in the while loop skipped the call to next_active_BM at the end of the loop. hazards of using a "findfirst/findnext while loop" instead of a "0 to max for loop". bloody generic iterators!
* make cordage, make arrow actions: now continue until you run out of parts.
* show next BM name in UL corner of screen for a moment when tab to next BM.
* remove butchered / sacrificed animals after some period of time.
* increased no draw rng for huts and storepits.
* fixed: common ai: tgt is stronger: was using BMs hp adjusted for diff lvl, not base hp for a type 2 animal (homo sapien). predators would close, then flee during common fight or flight.
* fixed: subdued and captured animals shouldn't be able to move.
* turned off atk to subdue. doesnt make sense for domesticating dire wolves, and you can't subdue and capture cavemen, and you shouldnt really be able to domesticate anything else, so...
* dire wolf hp reduced to less than humans so they dont atk people.
* need to implement new way to domesticate dire wolf. dire wolf goes for dropped meat. drop enough they follow you. drop more they allow you to approach. give meat action. give enough meat, they become pet. added new dire wolf AI: if dropped meat nearby, they goto dropped meat and eat it. eat enough, they start following the closest BM at that time. eat more, that bm can approach and select and get dire wolf menu (give meat, cancel). give enough eat, they become state=TAMED.
* dire wolf - they dont move to the meat - exhausted? called run (spd based on rng to tgt) instead of run maxspd
* fixed: predators ignore stronger animals. sets pred tgt (ignore equal or stronger) only when hunting, and sets wild tgt (dont ignore any) the rest of the time.
* fatigued animals now rest until fully rested, not 2% rested
* wolf: moveto owner: runs if rng > 100
* wolves with relations > 1000 are not removed when distant
* player can now accel tieme faster than 128x when only predators weaker than humans are nearby
* added message when tame wolf
* added "enter name for new pet..." when tame wolf
* fixed: other wolves attack your wolf when you tame it. friendly wolves no longer count as leader for flock behavior. other wolves now wander off.
* fixed: wounded tame animals flee forever. made AI flee from closest threat, not current target (pet owner if pet is far from owner). added closest threat function based on animal type (wild animals and hostile cavemen, -or- pets, warriors, companions, friendly cavemen, and bandmembers).
* predators now only target weaker foes, not equal or weaker.
* wild leaders for flock behavoir now excludes tamed animals and friendly wolves.
* fixed: drink from leaves: says its snowing when its raining! used 40 degrees instead of SNOW_TEMP. searched the entire code. this was the only place SNOW_TEMP wasn't used when it should be.
* fixed: pick fruit crashes game. tool_and_part_quality: calculating avg quality of tools and parts used: did divide by zero if numtools and numparts was zero. now returns quality of 100 of numtools and numparts is zero. did same fix to RR_tool_and_part_quality. no other occurances of similar code "/ sum count" in the game. shift select blows up if list full, no range check? - same bug.
* fixed: pick fruit action - game crashes. tool_and_part_quality: calculate avg tool and part quality: divide by zero if numparts and numtools = 0. now returns quality 100 if numprts and numtools = 0. did same fix to RR_tool_and_part_quality. searched entire code for: "/ sum" to find bugs similar to: "/ sum count". none found.
* fixed: full storpit - get stuff - scroll way down crahses? select_object and shift_select_object: list was 20 long, now is 40 long, scroll limit was still max-20, not max-40. no similar bugs found.
* animals list full? added error messages everywhere the game adds animals.
* cool rocks still too easy to find. doubled time required. cut chance in half. works out to about 4x as hard.
* fixed: demolish wood shelter doesnt take long enough. demolish_shelter action used buildtime(world_object_index), not buildtime(world_object_index.shelter_type) oops! <g>.
* fixed: demolish leanto doesnt take long enough: fix to demolish_shelter action fixed this too!
* base chance to make bedding too low? increased from 50% to 70%
* bow wears out too quickly? cut avg rate of wear by factor of 10.
* add storepit - doesnt rest chunks and collision maps? the low level funtion now does it for all calls to add storpit.
* fixed: demolish bedding in shelter demolishes the bedding. was demolishing sheletr_index, not sheleter_index.bedding_index oops! <g>.
* fixed: shelter weathers away while bm inside asleep, or inside in general. added msg that your temp shelter weathered away.
* fixed: ingame menu: increase width of hotspots
* fixed: ingame menu: video and gameplay hotspots overlap
* fixed: ingame menu: only play klik when the click on an option.
* fixed: dont let them move x-country from inside temp shelter. did "up a tree" too! now can only move x-country when OUTSIDE or ONRAFT
* fixed: npcs: all interests should be unique
* show msg when complete search dead caveman action, then show the take item screen.
* search dead caveman: if they dont have anything, just show a msg instead of the take item screen.
* fixed: daydream etc should reduce fatigue. energy wasn't set to 1 for daydream, stargaze, and watch clouds actions. energy=1 means they recharge fatigue while doing that action.
* fill waterskinrain doesnt take long enough - increased time by factor of 10.
* done: to make / fix (skills list) msg: dont say make / fix. its used for stuff like learn too!
* fixed: collision recovery moves before it finishes turning? now it doesnt move until abs(rh) < ~11 degrees, not <45 degreees.
* what happens when run out of ani players? turned on error msg in z3d library
* fixed: falling rain should not wake up bms inside a hut. BMs in player huts and rock shelters are not woken up by precip.
* fixed: move following bm's moves any following even if not nearby or following someone else. only move nearby who are following the BM in question.
* increase size of collision map cache. increased from 20 to 40.
* done: make mouse wheel zoom camera in and out faster. did keyboard controls too (numpad plus and minus by default).
* done: 3pv cam vs hut interior - switch to 1pv temporarily? uses 1pv when player is inside hut.
* fixed: glypto moves too fast. cut speed in half.
* big cats get stuck in woods
. big animal encounter spacing vs rocks and other dense terrain
. big animal encounter rng too close
. elasmo vs woods
. imp mammoth encounters too close to player.
. imp mammoths start too close togetehr. flip betw collision avoiddance and recovery.
. palorchestes gets stuck in woods
increased spacing. increased encounter range based on size of group. now near edge of group, not center of group, is at encounter range. fixed something in way of animal - it didnt take radius into account - thus the animals stuck in rocks etc. now it checks center, and the 4 bbox corners for something in way of an animal when doing initial placement of animals encountered.
* fixed: game crashes when you try to fix something that can't be fixed (wood grindstone, 1 hand hammer, etc). now it gives you a message saying that type of object can't be repaiered.
* fixed: follower joins band: rain sfx stops. player stuck in collision with new BM.
action sfx init-ed to 0 not -1. didn't adjust bandmember location. adj bm loc didnt handle radius.
stuck in collsion with new bm: rounding error: animal_in_way_of_bm used float rng, bm_in_way_of_bm used ints. now both use floats.
* fixed: move followers, moves those with orders to the contrary suchas wait here goto here, etc. followers with goto orders, or orders to follow someone other than the moving BM, dont get moved.
* attack thief - all neutrals become hostile? only if you attack before the dialog shows.
* yield: init NPC_type so yield works? test yield. make sure it works. it may not use npc_type anymore. yield works. npc type is set already. make thief_dialog set thief to NPC_KILLER if they
become a HOSTILE.
* cave hyena didn't attack? increased hp of some predators so their AI will attack humans
* orders: atk: doesn't work when no tgt? or at all? need to test it some. if no orders tgt, uses current tgt, if none, doesnt atk. tested. woking fine.
* fixed: order pet to wait here doesnt work. b2_issue_animal_orders told animal i to goto bandmember i's location, not animal i's location. a copy-paste-edit error, introduced when converting the code from cm[] to animal[]. but follower AI still needs help. they follow owner before following orders!
* follower ai needs help - make it like bm ai. changed follower ai:

old priorities:
do common AI
move2owner if > 100
if tgt nearby do orders or atk
listen to story etc
moveto owner if > 20

new priorities:
do common AI
do orders (if has orders)
atk nearby tgt (if has one)
listen to story etc
set move2owner_flag
move2owner (if flag set)

* fixed: game doesn't model spoilage of food in storepits
* already done: teach doesn't take as long as learn? already fixed: learn was called once per game minute, and teach was called once per frame (update or turn) - IE 15x per game second.
* show skills: dont show last 3 undefined skills. dont show mapmaking. is bonelore used? mapmaking? re-did view_skills - made a new view_skills2 routine. bonelore and mapmaking are gone.
* order everyone: gets goto location, target, or who to follow just once, instead of once for each party member ordered.
* fixed: didnt set bedding's world object ID when resting on bedding.
* DONE: dont let 2 BMs use the same bedding at same time. when select bedding, need to check all other bm's for bedding action with that bedding, if found, show msg saying someone is already using that bedding.

* improve how water and waterskins work. move the water with the container.
make sure they have sufficient waterskins whenever they transfer water. store in pit, drop on ground, fill waterskins (water source or rain), give water to bm, pickup dropped, etc.
when they transfer a waterskin, transfer water as needed. dont let them drop water. only let them drop water in waterskins. abandon water as requierd if they abandon waterskin.
need to possibly mod calls to add2inventory and add2stufflist. fill waterskin watersource, fill waterskin rain, give water to bm, npc menu (trade, ask for item), trade with band (get water).
* fill waterskins and fill waterskins rain check for waterskins full and max encumberance at start of action handlers. fill waterskins didnt check encumberance until water was gathered. fill waterskins rain didnt check it at all!
* all fill waterskin from water source actions now use try_fill_waterskins.
* made sure fill waterskins and fill waterskins rain check for player has waterskins. so now - for sure - they can't gather water without waterskins. can only get it from storepit, other BM, NPC, or trading with a friendly band.
* checked: get stuff from storepit makes sure they can carry water before giving it to them. so it makes sure they have enough waterskins.
* store stuff: checks for waterskins in the pit, and not all full. now you cant store water in a pit that doesnt have non-full waterskins.
* drop object: no longer lets you drop water. tells you to drop a waterskin instead.
* checked: pickup dropped object calls can_carry, which check encumberance, container capacity, and waterskin capacity. so they can't pickup dropped water without a non-full waterskin.
* newtrade and trade_with_band: doesnt let you trade for water if you dont have non-full waterskin.
* ask for item: doesnt give water if cant carry
* trader hut: doesnt trade for water if cant carry
* give_item2bandmember: doesnt give water if cant carry
* getstuff and storestuff: transfers water as needed when get/store waterskin.
* give_item2bandmember: transfers water as needed when give waterskin.
* trade_with_band: removes water as needed when trade away waterskins
* new_trade: removes water as needed when trade away waterskins
* trader_hut: removes water as needed when trade away waterskins
* fixed: some calls to indexdropat checked for return of 0, not -1 on error.
* indexdropat activates new record for each waterskin dropped. no longer adds waterskins to existing active records. so each active record with a waterskin has only one waterskin, and data[0] can be used to store how much water is in it.
* drop object: transfers water to dropped waterskin as needed. amount of water is stored in waterskin worldobj[].data[0].
* abandon object: removes water as needed when abandon waterskins
* transfer_to_waterskin_as_needed: calcs avg qual of water transferred, and stores it in worldobj[].data[1]
* pickup_object: if object is WATERSKIN, checks encumbrance vs waterskin+the water in it, and transfers the water with the waterskin, if they can carry both the waterskin and the water in it.

* DONE: turn clip ranges and autocliprange on again. this also fixed: clip rng for animals too far compared to clip rng for terrain chunks.
* cant see small dead animal under the water. draw them at y = 0. dead animal in water are now drawn at y=0 (water level) - IE half floating in the water.
* 3pv cam, make min altitude ground + a few feet so its above ground coverage. defined MIN_ALT_3PV_CAM. set it to 3.0f (three feet). old hard coded value was 1 foot.
added it to set 3pv cam for: cave, cavern, outdoors, perm shelter, rockshelter, and hut.
* make anis: need different y's for male and female.
* dawn & dusk are a little to dark. they are now lower limited to nighttime lightness.
* fixed: doesnt do fire light in adjacent map sq
* make 3pv cam look over avatar's rt shoulder
* sleep ani - draw at different heights dependingon has bedding
* dont draw avatar in 3pv if player is looking almost straight up.
* make sure accel time display, tutor messages, hud, etc dont overdraw each other.
* already done: not stop and start anis correctly when NPC joins band?
* already done: view inventory: flush sprites before drawmouse
* sleep on bedding: make them line up on the bedding. adjust location and orientation.
* dont play rain sfx when snowing
* doesnt play fire sfx in adj map sq. typo bug. called dist w/ mx,mx,x,z, not mx,mz,x,z.
* view stats - only play klick when they click on the done or rename buttons.
* add tada sfx to game saved.
* make animals do sliding collisions
* already done during playtesting: show all BMs on local map
* make mouse wheel zoom world map in and out.
* reinit dice from time to time. now calls initdice once per game day.
* more animals ? double the base chance of animal encounters?
increased by 10x. try it and see...
* more water. rocks etc?
water: every map sq, to once every 10-100 map squares
chert, flint: 28% of land = 1 in 3.57 map sq's on avg.
obsidian, quartzite: 1 per 230 map squares (mtns & volcanos only)
volcanoes: one per 4600 map sq on avg. in lines along plate boundaries.
tar: seeps from underground oil deposits which cover perhaps 10% of the planet. = 1 in 10 map sq's on avg.
* talk to caveman: ask directions to rocks, berry bushes, good hunting grounds, etc. a simple goto location quest. getting there is the reward. talk to cavemen: ask directions to water, woods, rocks, etc. do they always know where stuff is? do they always tell you? do they sometimes tell you a bogus location? can you ask them more than once and get a different response?-no
+ trade maps w/ npcs, will they trade? do they gve you a bogus map? can you trade more than once and get different maps?-no
+ npcs: ask whats around: do they always know? will they tell always you? do they sometimes give you bogus info? can you ask more than once and get a different response?-no
+ combine ask directions, whats around, and trade maps, and what do you get? an extended whats around. npc: exchange knowledge of area. caveman: ask whats nearby - automaps everything in a 1 or 2 (or more?) map square radius around the player. not as realistic as tracking what each npc knows, wheter they will tell you, if they give you bogus info, if you've already asked them, etc. so you need flags for "what they know", and "if you've asked them already" for each thing you can ask them (where's rocks, water, wood, whats to the north, etc)
+ simpler - relations governs if they tell you or not, and it reveals world map in a 2 map sq rad (for example) on success, and nukes relations some on failure. but can ask again, (with ever decreasing chance of success due to ever decreasing relations from repeatedly asking ; ) <g>).
+ or would early humans freely share such knowledge? friendly caveman: exchange knowledge of local region. why wouldnt they? resource competition? not in early stages when resoureces where plentiful. cant see why they wouldnt share knowldge of local area. it would automap say, everything in a 1 map sq radius around current location - world and local maps - completely - IE entire local maps revealed.
* talk to cavemen, ask if you can travel with them. - if yes...then what? you can follow them around -whooptie do! if no...then what? they throw rocks at you to keep you from following them? i mean - hey, its a free planet - right? if you happen to go where they do, as long as you dont interact with tem and nuke relations, no biggie. - or- you become their companion, and must hang out near them, and they fight with you, and give you orders. go here, wait, attack that, etc. but a nearby friendly will generally fight with you. so ask to travel with may not be needed. you can just follow them if you feel like it.
* add dismiss follower action
* already done: encounters don't correct for encounter location in adjacent map sq when player near map sq edge.
* "move storepit" added to playtest menu
* fixed: Zdomessages, getmouse, and mouse wheel. now fps view and world map both zoom with mouse wheel.
* grogs game converted to new savegame format.
* new world map generated for grogs game. moved the base camp. added new huts and bedding. moved all storepuits. abandodned empty storepits.
* finished converting grogs game to new world map. demolished all old huts and bedding. now they're all at the new camp, making arrows, gathering wood, or sleeping.
* made BM vs BM and BM vs NPC relations go to zero over time
* followers: take shares. original version, followers took a share of hides, meat etc from kills at the end of fps combat mode. now follower reations go down over time. if < 50, they leave your party. so you have to give hides etc to keep them in your party.
* types and numbers of animals at crh's is not persistant. when gen encounter, have to set type and num. when one dies, reduce num. added animal_type and num_animals to crhrec. added is_crh_animal and crh_num to animal rec. if game does cave or rocksheletr animal encounter, if crh2.num_animals<1, it generates crh2.animal_type and crh2.num_animals. else it uses the current values. when an animal is killed, if animal.is_crh_animal, crh2[animal.crh_num].num_animals--.
* eruptions: should be 10% chance per year per volcano of 1 eruption. = 10/365/24% chance per hour for a given volcano. reduced from one per week on avg to ~10% chance per year, specifically: 11 in 1000000 per hour.
* improve timing of state changes in graze AI. reduced chance for state changes by factor of 10. flock rng changed from 50 to 25*animaltype.rad.
* make int have greater effect on time and chance to make and fix stuff. some of this is already done, but not all make and fix actions. make int affect time, chance, and qual of all items made or repaired. also added adjust for dex as needed.
teach bandmember (learners int only, not teachers)
poison wpn
train (w/ wpn)
* improve avian ai. fixed: move_avian set y to ground height! made "orders: maintain distance" use new maintain_distance AI code. made avian AI code match animal AI code. collapsed some redundant code into single stand alone function calls.
* drop object doesnt handle dropping objects across a map sq edge into the next map sq! need to normalize dropat location rel to cm0. either that or remove distant dropped doesnt work across map squares. fixed: drop_object now normalizes drop location. any_BM_near_worldobj: added check for BB map sq dist < 2. it already handled map sq edges in other respects.
* game doesn't model bedding weathering, just wearing out from use.
* fixed: bedding.data[0]=is_in_shelter, bedding.data[1]=shelter_num, shelter.data[0]=has_bedding, shelter.data[1]=bedding_num
* make teachers int affect "teach bandmember" action.
* fixed: bm_in_way_of_bm: call to BBdist: typo: was mx1 mx1 mx2 mz2, not mx1 mz1 mx2 mz2. duh! took all morning to find and fix. will check all calls to bbdist for similar typos. and calls to dist2!
* fixed: get_fire_sfx: typo in call to bbdist
* fixed: get_fire_sfx: typo in call to dist2
* checked all 174 occurances of BBdist for typos. only found the one in get_fire_sfx.
* checked all 68 occurances of dist2 for typos. get_fire_sfx was the only one.
* fixed: getstuff and storestuff: was if index==WATER, not if object[index].type==WATER.
* fixed: getstuff and storestuff: was "if index==WATER", not "if object[index].type==WATER".
* fixed: drop_object: was "if index==WATER", not "if object[index].type==WATER".
* fixed: too many encounters are elephants. now all 6 elephant types collectively have the same chance as any other single animal type of appearing in a given type of terrain. IE if there are say, 32 differnt types of common animals in a given terrain type, now just one will be "some sort of elephant". what sort of elephant is then determined based on the terrain type (not all types of elephants appear in all terrain types). this for example, reduced elphant encounters in savanna from 16% to 3% of all animal encounters.
* checked out skinned meshes. code looks doable. .x files look ok. truespace has rigged models ready to go. need to learn how to animate models in truespace.
* eat/drink: show a menu of edible inventory to choose from.
* make mouse wheel zoom world map faster.
* butcher: add bmsg(). added "<bandmember name>: you butchered an animal!"
made all messages such as "you get some meat!" read "<bandmember name>: you get some meat!". that should help keep things straight when the band is butchering kills after a hunt.
* automatically load last saved game if player dies (except in tutor). added to continue, new, and load.
* replace all calls to select_item with shift_select_item. now only repair_object and sell_to_trader actions have you select just one object at a time. only "select item to trade band for" needed to be changed. all others already used shift_select_item.
* implemented new zoom-able local map! : )
* more hotkeys for world map: arrow keys and numpad arrow keys to scroll u/d/l/r.
* more hotkeys for local map: arrow keys and numpad arrow keys to scroll u/d/l/r.
* fixed: 1pv w/ wpn drawn, or sprinting, can see 3pv avatar! code got screwed up when "dont draw avatar in 3pv when looking almost straight up" was added. this also fixed: still draws 3pv cam when look up
* fixed: 3pv cam is too far to the right. moved to from 1 foot to 1/2 foot right of center. #defined xofs_3pv_cam. made all six versions of set3pv cam use it. there are six versions to adjust to the six different types of complex environments in the game (outdoors, in hut, in rockshelter, in cave, in cavern, and in playerhut).
* girl sleep on bedding: bandmember y is too high. chnged from baseline_y-1 to baseline_y-1.5
* increase drawing clip rad of animal #30 small antelope. increased from 2 to 3.
* change loading screen to copyright 2015. made new loadmsg() routine.
* add ability to toggle between world and local maps
* test avian attack ai - not working right?
+ fixed: didnt call set_predator_tgt (weaker prey only) when hunting. it would target strong prey, then flee when close!
+ fixed: didn't call do_animal_attack when attacking! it would dive on a target correctly (the hard part), but not attack when it got there!
+ fixed: avians start their attack too late. doubled avian vs ground target start_attack_range from 30 to 60. makes perfect sense. the new AI attacks at sprint speed, not run speed - IE double the speed it used to. so now it needs to start its attack twice as far away. i love it when the physics works out correctly! now once again, if there are big hungry avian predators around, you'd better do something or you're going to die!
+ fixed: avians now land before resting due to fatigue
+ fixed: set xr (pitch) to zero when standing.
+ fixed: climb/dive vs avian tgt: it was setting desired_altitude to ground level at target's location for all targets, even avains. now it sets desired_altitude for avian targets to the target's altitude.
***** still need to test avian vs avain start_attack_range. in general, start attack range formula may need to get fancier, and take into account speed and direction of attacker and target, not just speed of attacker and range to target. stuff done to fix avian vs avian AI:
* renamed b2_avian_attack() to b2_avian_attack_ground_target(). B2_avain_attack() is tailored for ground attack.
* added b2_avian_attak_avian_target()
* added: b2_avian_match_targets_altitude() for use by avians against avian targets.
* fixed: draw_animal_model: if dead: if in water draw at water level, else draw at ground level.
was backwards: if in_water draw at ground level, else draw at water level. (oops!)
* fixed: didnt start to land to eat carcass until right above it. now: if not at carcass, but within within 50: if flying, lands, else fly a bit (towards carcass). landing starting at 50 put them close, fly a bit (which causes oscillation betwen fly and land, until at carcass) make them "hop up" to the carcass - just like a real bird.
* added instructions to the "create a new character" screen
* demo now starts player in temperate savanna terrain.
* end demo: removed references to atk to subdue and capture.
* tutor: added info about "z" key to pick up dropped objects
* turned off playtest hotkeys in demo
* increased cave hyena hp in demo so they attack player.
* tutor: gives encounter advice right after the normal encounter message - not right before.
* upatree: badguys dont leave! simply have them ignore targets that are up a tree. set_predator_target now ignores band members who are up a tree if the animal type can`t climb trees.

A quick update. march 19th 2015

Posted by , 19 March 2015 - - - - - - · 1,148 views

While I wait for a build, I thought I'd do a quick update. Its been too long since I posted a progress report.

I've been play testing the game a lot recently. About one game year so far with the same play test character (Grog).

I've gotten perhaps half of the screenshots from that posted.

Play testing revealed no major problems. A few things to tweak and adjust. One I make those changes I'll post a new beta.

One big change is that attack to subdue is out, and "dances with wolves" is in.

Domestication of animals has been totally re-designed to be more realistic.

No longer do you attack to subdue, capture with rope, then tame with meat, for any animal you can catch.

Now, you drop meat, and dire wolves will eat it. Dire wolves have been reduced in hit points to just less than humans, so they won't target humans as prey. And they will flee if apprached too closely. relations with the wolf increase by the quality of the meat dropped. when relations go over 1000, the wolf "adopts" the closest band member at the time, and will begin to follow them around - at a respectable distance. dropping more meat will continue to increase relations with the wolf. when relations go over 2000, the wolf will allow the band member to approach. then the player can select the wolf and get the "dire wolf" menu. just one action: give meat. when the player gives the wolf enough meat to increase relations over 3000, the wolf becomes tamed, and fights at your side just like any other follower.

I'll post a proper update with details, and the rest of the screen shots soon. I'm torn between needing to keep the world abreast of progress on the game, and needing to finish the darn thing!

Back to dancing with wolves!

An example of a big change in Caveman

Posted by , 04 February 2015 - - - - - - · 1,580 views

  • savanna grass
  • "instancing" in DX9 - implementation in the game
  • "instancing" with DX9 - closeup
  • "Instancing" with DX9
  • Best bow shot ever - close up
  • My best bow shot ever in the game!
  • And last, but definitely not least - Savanna
  • prairie terrian
  • Improved animal models and animations: Smilodon Fatalis
  • Improved tall grass using the new generic random map.
  • Swamp effect with jungle vegetation
  • Swampy woods
  • Lots of batch calls!
  • The edge of the world!
  • Don't look now, but your skybox is showing!
  • Alpha blended snow
  • Title screen
  • The animation editor
  • The modeler

An example of a big change to Caveman

I've been playtesting a lot recently.
Drawing objects in an avatar's hands in animations
is the next thing on the todo list - and that's just
eye candy. I'm into gameplay, not eye candy.
So I've been playtesting my long term playtest game,
making note of fixes to be made. I've gotten to the
point where I have 10 bandmembers in my band!
Occasionally I'll stop and make a change necessary
to continue testing. But that is becoming less
and less frequent. I can test for an entire day
with no changes required to continue testing.
That's a sure sign that the game is getting closer
to completion, when everything is working correctly
and no major issues are encountered while testing
for hours or days on end.

I just finished a change that was really required
for futher testing. Permanent shelters have been
replaced by a new type of object, a PLAYERHUT.
Before the change, each bandmember had to create
or takeover their own hut, and they were limited
to one each. Now, each bandmember can create
or takeover as many huts as they wish, and huts
are owned by the band, not individual bandmembers.
So one bandmember with lots of construction skills
can build huts for all the bandmembers.

A description of the changes involved:

#declare object type
defines an ID number for this type of object.

the game tracks items in the world using a
"objrec2", which is an instance of 1 or more
items of a given type and quality at a given location.
lists of objrec2's are used for containers, PC and
NPC inventories, and the world objects list (dropped
inventory items and items built by the player -
such as huts! <g>).
The game uses a relational database design, with
objrec2's pointing to object type instances in the
object types database, via a object type ID number.
object type instances contain info like name, weight,
and price which are common to all objects of a given

inits the object type's entry in the object types
database. IE sets name, weight, price, etc.
not much here, i set the name and radius but the
code uses neither! :o

PLAYERHUT methods:
in_way_of_drawing // boolean. dont draw plants etc in huts!
in_way_of_moving // boolean. collision check
// adjusts 3pv camera location to hut interior
raid // conducts hostile caveman raid on a player hut

<going off on a tangent>
should get_3pv_camera_coordinates be a camera method or a
playerhut method?
it uses both...
continuing along those lines...
should in_way_of_drawing be a render method?
should in_way_of_moving be a physics method?
should add_to_collision_map be a collision map method?
should first_BM_nearby be a bandmember method?

more and more its seems that for loose coupling and tight
cohesion, code ought to be divied up into two types:
1. low level classes that know only about themselves,
2. controling code that uses low level classes.

then the controling code would do something like:
loc2=calculate 3pv camera location from loc
bandmember, playerhut, and camera only know about
themsleves. only locations are passed between them and
the controling code.

<end going off on a tangent>

world objects list methods:
// checks if a world object is in any player hut
// checks if a bandmember is in any player hut

render methods:

process_input methods:
selected_playerhut // boolean
playerhut_menu // playerhut actions

update methods:
remove_distant_dropped_objects // dont remove stuff near huts!
model_playerhut_raids // calls playerhut.raid if a raid occurs

other methods:
// boolean. checks if bandmember is near a player owned cave, rockshelter, or hut
// boolean. checks if player owns a cave, rockshelter, or hut

The actual changes were pretty straightforward.

permanent shelters used:

and player huts use:

all the code already existed, it just needed to be changed to use
PLAYERHUT world objects instead of a bandmember's permanent shelter.

One prime motivation for this change was the fact that caves,
rockshelters, and NPC huts you can take over now occur at random
locations in a map square (a square 5 miles across). They used to
be at most one of each per map square, and always in the same place.
And if there was water in the map square it was always nearby all
of them - IE everything was near the center of the map square.
Now its much rarer for a cave or hut to be near water and all
rockshelters are more than a mile from the closest water. So
building a hut is the best way to get a shelter close to water,
which is the most frequently required required resource in the
game. And it takes a lot of skills to build a hut. The research
tree is incredibly long and complex. So requiring each bandmember
to go through this to be able to build a hut when their fellow
bandmember(s) already have the skills to do so didn't make sense.
Not sufficiently realistic, needed to be improved. Thus the change.

And now...

I'm off to build huts for all my bandmembers! Posted Image

You should see what its like trying to cram all ten of them in one
hut so their mood doesn't go down from being out in the rain! <g>.

January 2017 »

151617181920 21

Recent Comments