Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 14 Nov 2007
Offline Last Active Feb 01 2013 06:02 PM

Topics I've Started

Follow target behaviour tree

20 March 2011 - 12:56 PM


Now I'm trying to add behaviour trees into my project. Today I've finished implementing simple movement and started the "FollowEntity" behaviour.

It's algorithm is:

1. Actor receives "Follow" order and target entity.

2. Actor's DesiredDestination is set from the position of the target (for simple movement DesiredDestination is set from input).

3. "MoveTo" behaviour is executed which is Sequence of 2 Actions - "FindPath" and "FollowPath"

4. If target entity starts moving, we should update DesiredDestination at some frequency and re-run step 3 from the beginning.

5. If we reached the target (distance < threshold), actor should stop and optionally face it.

6. If target is lost behaviour fails and decision maker chooses other one to execute.

Can anyone explain me how to construct tree that implements this algorithm? Steps 1-3 are easy but I'm not so familiar with tech yet to understand how to make tree do steps 4-6.

Also I have few points to discuss about BT data storage and Action->Action communications through Actor variables. Need I to start a new thread or it will be normal to ask here?

Thanks in advance.

Trouble with conversion to DXT

27 October 2008 - 02:37 PM

Hello all. I'm trying to cut very big texture (16384*16384, D3DXFMT_P8 - grayscale bmp for memory usage reduction while debugging, later I will use different common formats such as A8R8G8B8) into small rectangle regions and then save them converted to DXT1 or DXT5. My idea is to load whole texture with //Source texture D3DXCreateTextureFromFileEx(pDevice, InputFile, 0, 0, 1, 0, D3DFMT_UNKNOWN, D3DPOOL_SCRATCH, D3DX_DEFAULT, D3DX_DEFAULT, 0, &TextureInfo, NULL, &pTexture); pTexture->LockRect(0, &Src, NULL, D3DLOCK_READONLY); if (!Src.Pitch||!Src.pBits) FAIL; //Destination texture pDevice->CreateTexture(clusterSize.X, clusterSize.Y, 1, 0, DestFormat, D3DPOOL_SCRATCH, &pCompressedCluster, NULL); pCompressedCluster->GetSurfaceLevel(0, &pClusterSurf); then in loop set rect for current cluster and perform conversion using D3DX, like here: CreateRect(X, Y, ClusterW, ClusterY, ClusterRect); D3DXLoadSurfaceFromMemory(pClusterSurf, NULL, NULL, Src.pBits, TextureInfo.Format, Src.Pitch, NULL, &ClusterRect, D3DX_FILTER_NONE, 0); I checked that source texture is loaded right. Then I convert its rect with D3DXLoadSurfaceFromMemory, when DestFormat is D3DFMT_DXT1 or source format (for test). Then I lock destination texture and manually check pixels, they look right at least when compression is not performed & rect is simply copied. After all I save cluster in both DDS & BMP formats (for test too). But in file only white rectangle appears, & when I load texture just saved, all 0xffffffff pixels loads. Did I anything wrong? Can anyone tell me how to solve my task better or simply RIGHT way? Thanks.

Octree for dynamic objects

15 November 2007 - 06:36 AM

Hi. I have some questions about this topic & I hope somebody here has answers. 1. What's better - store object in node, that entirely contains it, or continue subdivision (while number of objects in node or node depth not fit the predefined condition)? 2. Then, what when octree is generated and object's AABB (OBB, any other volume) is changed? For example, object moved, resized or rotated. I must a) detect all nodes, with that object is associated b) remove object from them c) re-add object into the octree Am I right? And anyway how to do it all the best way? I searched in the Net, but there's no answer. I understand that the best methods depends on concrete situation, but I need optimal decision only for my one.