Jump to content

  • Log In with Google      Sign In   
  • Create Account

Trienco

Member Since 22 Aug 2001
Offline Last Active Yesterday, 09:57 PM

Topics I've Started

App folder influencing swapbuffers behaviour?

17 May 2006 - 05:50 AM

For the first time I just noticed something confusing. I ran my old terrain renderer after recompiling it with VC++ Express and was somewhat "impressed" by the well over 1000fps it showed me. I started Fraps to confirm and was about to take a 5min giggling break, when I ran it again. This time directly starting the binary and it was back at somewhat more believable 200fps. So whenever I run the release build from within VC++, something is not just screwing with the internal timing, but also throwing off Fraps as well. App is using OpenGL, rdtsc for timing and somehow Denmark is smelling funny today. What could it possibly be doing to cause that kind of weird behaviour? Especially since it makes profiling a real pain (change to explorer, copy binary to working directory, running binary... compared to pressing F5). [Edited by - Trienco on May 18, 2006 12:26:39 AM]

More life-like dialogues through emotional states

11 April 2006 - 05:33 AM

I've only been thinking about this for a few days now, mostly because yet again promises of a great and realistic AI have been broken, which usually results in the need to come up with something better. So, let's take a break from path finding and wargame AI. After a closer look at the Oblivion Editor I noticed, that much of it IS already going in the direction I had in mind (even though you really couldn't tell in the game *cough*). But to the point and most of all the one point I think should be done exactly the other way around: how about a characters mood influencing his answers? Now, OB seems to assign emotions to certain lines, which is cool to make him look sad when he's talking about his dead wife, but apart from weird and sudden mood swings just doesn't feel right. The alternative, however, would be a lot more work for your writers. I'm thinking about a system where a conversation can actively change his mood, based on the attitude the player is displaying (also to some degree the topic or what the NPC says). A paper about the Artificial Emotion Engine made me realize, that this kind of thing has actually been researched for a bit (even though not exclusively in the context of AI or games). Based on that, this would be my rough idea, which you should feel free to criticize, shoot down, correct or point out serious problems with it. What we need: -a way to describe the personality, the EFA-approach looks fine (extroversion, fear, aggression). In short, E sets the limit on how strong a positive mood will be displayed, F does the same for negative moods and A sets the amount and ease of mood changes. -moods, seems that the six pack of joy, surprise, anger, sadness, fear and disgust are quite common (and conveniently, facegen already has this six expressions) -a lot of variants of the same answer, depending on mood. For now, let's stick with 7, one of them essentially neutral. Sounds like a lot, but in many cases generic replies can be used for many characters. -stimuli, basically I would plan it as weighed mood changes, with the difference that it won't just increase or decrease a mood in a straight forward fashion, but that the actual change depends on a) the current mood and b) the personality -keywords, each of them being assigned a "sensitivity" per character (how strong he feels about it, ie. how much it can influence his mood) and optionally an attached stimulus -attitudes, which are like user selected stimuli in that their effect depends on mood and personality. Still trying to reduce it to not more than half a dozen. Things like threatening, comforting, sneaky, careful, etc. To make things more complicated, extracting information is usually an important part of games. Where Oblivion is only using "disposition" as a measure, I can't reduce it to less than two factors: willingness to talk and sympathy. The reason is this: you can threaten a timid character into telling you something, but he still won't like you. In fact, if he WOULD like you, he might give you additional information or warnings. Sympathy might be a function of what kind of moods you cause in a conversation. Trying to improve his mood will increase his sympathy, while making him feel bad.. not so much. In return, sympathy might have an initial effect on his mood when starting a conversation (well, scratch that, players would just start and end conversations to improve his mood, unless ending a conversation will have the oppositve effect). Willingness to talk, I'm not so sure about. Might be easier to instead use the level of either fear or sympathy. Many moods could be used, but usually all moods are directed at or caused by something. If the character is angry at us, he won't tell us anything, but if he is actually angry at the guy we want to know some dirty secrets about... Though joy itself is hardly a reason to give away information. Trust might even be a third factor, but I have no idea how to get that in. Might just as well fall together with sympathy. The goal would be a game, where you have to influence an NPC to get information without doing it in some isolated and silly mini game and where it won't get you anywhere to just walk into a tavern to some guy and say "hey, I heard some guy slit your wives throat, what did he look like?". The reason I prefer keywords is that you can combine them with just "toggling" your current attitude without having to write a gazillion versions of the same question. As a result it would completely depend on the NPCs personality whether the best option is bullying or comforting. In fact, one NPC might turn from sad to angry and complain about not needing your pity, but might drop his tough guy act when he's pushed enough. Yet another might start a fight right there or completely lock up and yell for help. Obviously important characters would need to be hand tuned to make sure they can be convinced at all and you still couldn't easily pull off things like "make him sad so he gets drunk and talkative", but I could imagine it to feel more dynamic. Unless it just results in a huge buggy mess with many dead ends if you screw up. Though beating up or bribing might always be available as last resort. [Edited by - Trienco on May 23, 2006 11:00:51 AM]

Patch through GUI

10 December 2005 - 04:07 AM

Just some ideas and left overs from the last "project", but if anybody with experience with some large and complex programs would have any comments or insights that would be appreciated. Last time around I did the whole boring Gui part first. Managing characters, equipment, the whole drag and drop stuff. Then it was time to do more of the actual game (a pretty boring combat tool for the old D6 system with optional 2D/3D, square/hex/polynet maps). Laziness (and lack of planing) made me create this map as another gui element and add more and more game logic to it. But it worked nicely, as part of the gui it had its click, drag, move and key functions called and just added some more specific callbacks (onCharacterSelected instead of onClick, etc.). Only drawback was that it needed to have the focus to register key events. Planned on solving this by allowing to register a default receiver for events that aren't handled by any other element. Writing yet another Gui I am wondering if this might actually be a useful (optional) feature. So let's say you are using input library x where you would usually go and register callback functions for mouse and key events. It would seem logical that these callbacks pass them on to the gui and if the gui doesn't handle them will pass them on to the game. But say the gui is like one of these old Voodoo cards and lets you register callback functions for unhandled mouse and key events, you would now register the gui input functions as callbacks for the input function and the games input functions as callbacks for the gui. The functions would still return whether they handled it or not, so you're not forced to use this. Question is: would that seem like a concept that makes using it more comfortable or am I missing a lot of special cases and difficulties that would reduce it to useless bloating?

LoD error metrics and headache

06 July 2004 - 05:52 AM

so, after figuring out a great way to introduce twice the number of lods for gmm terrain the frustrating part begins. subdivision is kind of alternating like so:
even lods:  odd lods:  next even:
xxxxxxxxx xxxxxxxxx xxxxxxxxx
xx      x xx     xx xx  x  xx
x x     x x x   x x x x x x x
x  x    x x  x x  x x  xxx  x
x   x   x x   x   x xxxxxxxxx
x    x  x x  x x  x x  xxx  x
x     x x x x   x x x x x x x
x      xx xx     xx xx  x  xx
xxxxxxxxx xxxxxxxxx xxxxxxxxx
calculating the errors i get results that make me doubt my sanity. not only would pairs like the first two examples end up with the same max error most of the time, i sometimes even get situations where the first has a SMALLER error than the second and everything inside me goes "thats not possible". it has more points (ok, just one in this case) and twice the triangles. so basically my error calculation must be completely whack (iterating over all levels and points, comparing the interpolated value to the real value with and without the central value and according to the triangle configuration). so: is there really a possibility for strange results like that? why does simple distance based selection give much better results and why did i do all the extra work to get error pairs that effectively skip every second level? just in case someone is feeling bored and feels to desire for a medium headache:
for (int lvl=1; lvl <= numLevels>>1; ++lvl) {
  int step=1<<lvl;
		
  for (int pat=0; pat<numPtch*numPtch; ++pat) {
	for (int iz=0; iz<PS; ++iz)
	for (int ix=0; ix<PS; ++ix) {
		float relx=(float)(ix%step)/step;
		float relz=(float)(iz%step)/step;

		int seg_x=ix/step, seg_z=iz/step;
		int seg_left=seg_x*step + Patches[pat].x;
		if (ix==PS-1) {seg_left-=step; relx=1;}
		int seg_right=seg_left+step;
		int seg_top=seg_z*step + Patches[pat].z;
		if (iz==PS-1) {seg_top-=step; relz=1;}
		int seg_bottom=seg_top+step;
				
		float y=Heightmap[(Patches[pat].z+iz)*MapSize + Patches[pat].x+ix];
	        float tl=Heightmap[seg_top*MapSize + seg_left];
		float tr=Heightmap[seg_top*MapSize + seg_right];
		float bl=Heightmap[seg_bottom*MapSize + seg_left];
		float br=Heightmap[seg_bottom*MapSize + seg_right];
		float mid=Heightmap[(seg_top+(step>>1))*MapSize + seg_left+(step>>1)];

		float height_odd=-1, height_even=-1;

		if (relx<=relz) {
			if (relz<=1-relx) height_odd=tl + relz*(bl-tl) + 2*relx*(mid - .5f*(tl+bl)); //left
			else height_odd=bl + relx*(br-bl) + 2*(1-relz)*(mid - .5f*(bl+br)); //bottom
		}
		else {
			if (relz<=1-relx) height_odd=tl + relx*(tr-tl) + 2*relz*(mid - .5f*(tr+tl)); //top
			else height_odd=tr + relz*(br-tr) + 2*(1-relx)*(mid - .5f*(tr+br)); //right
		}

		bool bl2tr=!((seg_x%2) ^ (seg_z%2));

		if (bl2tr) {
			if (relz<=1.0f-relx) height_even=tl + relx*(tr-tl) + relz*(bl-tl); //topleft
			else height_even=tr + (1-relx)*(bl-br) + (relz)*(br-tr); //botright
		}
		else {					
			if (relx<=relz) height_even=tl + relx*(br-bl) + relz*(bl-tl); //botleft
			else height_even=tl + relx*(tr-tl) + relz*(br-tr); //topright
		}

		float error=height_even-y;
		if (error<0) error=-error;
		if (error > Patches[pat].Error[2*lvl])
		        Patches[pat].Error[2*lvl]=error;
				
		error=height_odd-y;
		if (error<0) error=-error;
		if (error > Patches[pat].Error[2*lvl -1])
			Patches[pat].Error[2*lvl -1]=error;
	}
  }
}
for those with gf fx or newer radeon: http://festini.device-zero.de/Programming/Downloads/jstart.zip relevant console commands: terloddistance (toggle distance/error based lod) tersetthreshold (set threshold for error based) tersetlodstep (set stepwidth for distance based) terdrawwater (toggle the annoying water on/off) wireframe (toggle wireframe) page up/down scrolls the console or moves up/down cursor keys move, middle mouse frees cursor config.cfg contains a few settings autoexec.csf contains console commands to be run at start up other commands: terloadmap <file> <size> <patchsize> (loads a map, 16bit raw file of size+1 ^2 dimension, size and patchsize should be power of 2) tercreatemap (create random terrain, most likely broken by now) teruselod (toggle lod on/off, when off tersetlod sets global lod) camsetviewdistance (obvious) camsetfov (also obvious) i definitely need to add a help <command> command. the map used is from the far cry demo for better comparison. fake detail textures can be enabled by "inverting" the comments in terrain.psh

Test my 3D App Framework

23 June 2004 - 09:21 PM

Direct Link or if you use a browser either based on the gecko engine or one handling xml/xslt quite well: Via Page first off, if it complains about missing dlls or other problems related to openal i still missed adding some needed dlls or added the wrong version. whats in so far: -console + scripts -terrain (not finished) -simple particles -"2d animations" (nothing special) -input configuration via file (config.cfg) required: -card supporting fragment programs under opengl -tested on ati, problems with nvidia would be the most interesting -last time i tested nvidia wouldnt display the terrain and particles. i think i found the bug in the shader, but couldnt test it in the meantime. usage: -console should be whatever is left of the '1' on your keyboard. if it doesnt work, change the key in the config file. -console autotype: the console will autocomplete after each letter if the choice is obvious. you can turn autotype off if that annoys you (you can still autocomplete by pressing space) -console commands: listcommands will list all available commands, page up/down scrolls -nvidia isnt as touchy about non aligned data (or secretly changes the alignment), so you can set unaligned vbo to 1 in the config (and reduce the buffer size for terrain to a 1/4th, theoretically allowing terrain up to 8192x8192 using 70mb). -the normalmap for the water is 64x64, so dont be surprised that it looks crappy. again, wanted to keep it small. -skybox is drawn as cubemapped quad in front of the cam. in external view (console) you would see this quad inside the frustum very close to the camera position. as its drawn in the background you wont see it. its a funny effect, so if you want to see it you can just rename water.psh and "sabotage" the water rendering. -particles have their own set of console commands. the autoexec.csf is executed automatically and includes basic creation of a system with 5000 particles. a life time of 0 means they dont die. all commands prefixed "part" can be checked in the console (param names should be obvious). also: after changing a system (size, color, whatever) it needs to be reset with partresetsystem (second parameter means restart it right away or just reset it) -particle count. try setting the number a little higher (5000 is just to be safe). 100000 should work ok, 250000 bring it down to 19fps on my system (2100+xp, radeon 9800). its using immediate mode to send particles and a vertex programm to "billboard" it (as ati after 6 driver updates still didnt fix their completely broken point sprites.. anyhow, might be just half as fast but allows for individual sprite/particle sizes). -wireframe will look wrong in some places. im using line_strips as changing the polymode to line seems to be horribly slow on nvidia, so single edges might be missing (most obvious on the terrain) -profilers: you will notice strange green boxes with even stranger numbers. thats the code profiler using rdtsc to count ticks. three numbers on the left are max,avg,min (ticks and percent of frame time), the white line is a graph with the number in the top right giving the scale (ie. line at the top of the bottom means <value> ticks). bottom right is the last value, bottom left is the time (ie -5s means showing 5 seconds of samples). some numbers are updated out of synch with others, so max percentages for frame time above 100% shouldnt bother you, the average should be close enough. -source code on the site is really old. current source is available if somebody feels like digging through messy code. -the weird lines: theres a 2d coord system with a big white square in the scene. pressing 'a' will rotate a plane and set the square in motion. the annoying buzzing sound comes from this square and if available you should hear it in nice 5.1 sound (especially when moving past you). basically just fooling around with openal and uselessly optimizing sphere-plane collision to death. -terrain comes with only a 128 map to keep download small. for more interesting terrains you can either use tercreatemap <size> <patchsize> to create random terrains (ie. tercreatemap 4096 32 .. but this size takes quite a few seconds) or: maps are simple grayscale raw files with 2bytes per value and 2^n+1 size (try making a grayscale 4097x4097 cloud in for example photoshop, set channel number to 2, save as raw.. load it via console: terloadmap filename 4096 32 where 4096 is the terrain size and 32 is the patch size.. use 16, 64, 128 or whatever you feel like is working best) -linking pieces between lods arent included yet (i could just copy paste them from the old version, but id like to keep it cleaner this time). also the textures arent "serious" and theres no normal or lightmap yet. lod is selected by distance alone (for the same reason, dont want to just copy my old code to calc screenspace errors) -terrain is aimed at single level games (no huge seamless worlds) of up to 4096x4096 heightmaps (next step is fine on nvidia, but would use 280mb on ati without the heightmap itself). the quadtree is using spheres only (box is only stored so you can display it, but not actually used anywhere) and is stored as continous array using indices to navigate the tree.

PARTNERS