# ayrton2388

Member

24

100 Neutral

• Rank
Member
1. ## What heuristic should i use for A* ?

Im working on some basic pathfinding in 3D space. Im able to create a navigation graph, using a flood-fill algorithm. I start in one point, and extend it in 4 directions, if there are no colliders in that particular direction. Its pretty nice until now. Works ok. Creates a nice grid, without the inaccessible nodes or edges. But theres one more thing i have to do in order to make enemies / NPCs come to the player or go to a certain place. Use A* to find the shortest path from a node closest to the enemy to a node closest to the target. I studied A* 1-2 years ago in college, gotta read a bit more about it though, to refresh my memory. But still, which heuristic is the most suitable here? Is it ok if i use the straight distance between 2 points? And the cost being the number of graph edges traveled until the current position? (since each edge has the same length.) And is there anything else i should need to know about this? Im gonna look into it today, but a direction, for a head start, would be really, really nice.
2. ## Need help designing a Character class

1st of all, i made a game, having just 1 controlled player in it. No other chars. So i wrote almost everything i needed for that in a single class. Character input, animation control, everything. Thats like 0 reusability. Well, now im working on another project, and i wanna do things differently. Gonna have a player character, enemies and maybe NPCs. How should i separate everything? I was thinking about creating a Character class, which has a "State" structure that links a state to an animation, and the common fields like health, etc. Then creating 2 subclasses for Player and Enemy. The Player class should treat and change states based on a character controller class (keyboard input, etc), while the Enemy class would have a kind of action queue. Like .attack(target) , .walkTo(position) etc. A separate animation player class would play animations corresponding to the players / enemys actual state. Will this be ok? What kinda problems will i walk into? Any suggestions, ideas?
3. ## Got my 1st interview on monday...

Thanks for the advice, guys really appreciate it. Hope everything goes well.
4. ## Got my 1st interview on monday...

So. I applied for a job in a small company, who produces iphone / android games. They asked me to come for a short interview, to talk about their games and the tools they use, and about the games i created. Well, i have an incomplete RPG game, which i will bring on monday. Thing is. Will they be interested in the source code? if so, what will they be looking for? The game still has some small glitches... oh, and they will probably think the code is messy (this game being more of a learning experience) ... I still got like 2-3 days, so how should i prepare? what should i expect? any help would be greatly appreciated.
5. ## Full white shadow maps, problem with far and near planes

Im trying to create shadow maps, based on Riemers tutorial. Everythings fine, except that the shadow map is 100% white, instead of showing different shades of gray due to their distance from the light position. I realized its because of the lights projection matrix. The frustum of my normal view camera is set from 10 to 50000. I cant set the same value for the lights projection matrix because it will be either invisible or full white. So im trying to find the right lights proj. matrix. If i set it to (5 000 to 100 000) it works. I can see different shades of gray. If i set it to (2 500 to 50 000) , i can still see different shades, but overall, the image is a bit lighter. What should my lights projection near and far planes be?.
6. ## Help me improve this ocean foam...

My water component is not 3d, and its not a post-process. If it was a post-process, this wouldve been easier Its just a simple plane. Sticking to a cheap water cause i still got a lot of things to do. Might switch to a better ocean technique when all the other things are done. Anyway, do you guys have any ideas how can i improve this for now? At the moment, im drawing the foam texture and the white lines on the terrain, not on the water plane. You probably wont notice this. Theyre animated, getting shorter or longer, based on a sin(). Any ideas on how can i do a better foam on this kinda water? [media]http://ayrton2388.deviantart.com/art/Ocean-foam-test-254893022[/media]
7. ## Need some help designing a 3d vegetation system.

I decided to use some 3d models for the vegetation. Nothing very very fancy. Not very detailed model, but a bit more than the 3 quads, star-formation grass. I do have some individual, bigger plants, but also small patches of grass. Each type of small patch as a model. I havent implemented a quadtree/octree yet, but i definitely will. So heres my question. How should i store the plants/grass positions? - should i manually place them? store all the positions in a vector or something? - should i use a color map? If i use a color map, generating just a patch of grass or a plant might not be enough. Im using a 1024x1024 heightmap for the terrain, and a scale of 60. So the plants could be wide apart. Should i also generate lets say 10-15 more random plants around the one placed on the vertex? Either way, the number of plants needed might be big. Lets say 300 000. Just an example. Should i store all those 300 000 positions somehow? Guess its not a good idea. Should i store only the positions from the color map, and generate few random positions around each, every time i enter another block from the quadtree? When im drawing the vegetation, should i have a fixed block size, and draw just the surrounding quadtree blocks, around my character?
8. ## Getting the height value for a position in a heightmap triangle

Oh, just got it, thank you! The Z offsef should be inverted, too. zNormalized is actually -zNormalized. Works now,. Both problems solved. Thank you. 1st time, i wrote the function based on Riemers book, and it was a bit confusing, since his and my heightmap were pretty different. Did try the same thing there, but i guess i had other bugs, too. Anyway, works, so a big thanks, Postie.
9. ## Getting the height value for a position in a heightmap triangle

public float GetHeight(Vector3 pos) { float height = 0.0f; if (heightMap == null) return height; int left, top; left = (int)pos.X / (int)scale; top = (int)pos.Z / (int)scale; top = -top; float xNormalized = (pos.X %scale) / scale; float zNormalized = (pos.Z % scale) / scale; float topHeight = MathHelper.Lerp( heightData[left, top + 1], heightData[left + 1, top + 1], xNormalized); float bottomHeight = MathHelper.Lerp( heightData[left, top], heightData[left + 1, top ], xNormalized); vect = new Vector2(topHeight,bottomHeight); height = MathHelper.Lerp(topHeight, bottomHeight, zNormalized); return height*scale; } This is the version that i adapted from MSDNs example.
10. ## Getting the height value for a position in a heightmap triangle

Need a bit of help. Im having trouble getting the right value for Y. Heres how my axis system looks like. The heightmap starts in (0,0,0) and extends towards X and -Z. http://imageshack.us/photo/my-images/580/49630723.jpg/ Got two problems, actually. Sometimes, the object is set under the triangles. And not only on steep slopes. You can see that at 0:15, or even clearly at 1:10 in the video. Second problem is that the object moves smoothly on the X axis. But kinda ... jagged? on the Z axis. Around second 0:35. i tried to write 2 totally different GetHeight() functions,with the same results, so could it be something else than this? any ideas?
11. ## Using FBXimporter from XNA 3.1 in 4.0

Is there any way i can use the FBXimporter from the XNA 3.1 version in XNA 4.0? Is this possible? I would like to use it as a custom importer. I added a reference to c:/program files/.../MS xna 3.1/... /Microsoft.Xna.Framework.Content.Pipeline.FBXImporter.dll. I renamed it, cause i cant have 2 with the same name, and when i try to compile it, i get the following error: Assembly Microsoft.Xna.Framework.Content.Pipeline.FbxImporter was built with a reference to Microsoft.Xna.Framework with an incorrect version 3.1.0.0 when version 4.0.0.0 was expected. &nbsp;&nbsp;&nbsp;SkinningSampleWindows Any ideas?
12. ## drawing Shadows with the DepthStencilState. Need just a bit of help. [XNA 4.0]

Thank you, Geri, i will look into it! Thanks.
13. ## Backside of transparent textures aren´t visible at certain view directions

Thing is, every time you want to render some transparent/semitransparent (using alpha-blend) models, you have to sort them 1st. You have to sort them by the distance from the camera, and then draw them backwards. So.... you draw all your opaque models. Sort the transparent models/meshes/MeshParts/polygons , whatever they are . You turn on alpha blending, draw them backwards, and then turn off alpha blending. Have a look at this. http://forums.create.msdn.com/forums/p/82491/497908.aspx#497908 Or you can can do as i did. Using a two pass rendering technique. You need a bit of knowledge about shaders. * Pass 1: draw the solid part: alpha blending disabled, alpha test set to only accept the 100% opaque areas, and depth buffer enabled * Pass 2: draw the fringes: alpha blending enabled, alpha test set to only accept pixels with alpha < 1, depth buffer enabled, depth writes disabled
14. ## drawing Shadows with the DepthStencilState. Need just a bit of help. [XNA 4.0]

yes... dsstate.DepthBufferWriteEnable = true; right?
15. ## Created my own animation library, but got a bug in XNA 4

Thanks, but... thats definitely not it.