Advertisement Jump to content
  • Advertisement

Darsin

Member
  • Content Count

    31
  • Joined

  • Last visited

Community Reputation

122 Neutral

About Darsin

  • Rank
    Member
  1. Darsin

    Predict Interception

    That would be a great solution indeed if i had time to redo my entire AI section but sadly i don't. It would be a nice upgrade since now it's really static and looks kind of shocky. But we're gonna have to think of a "fairly" quick solution to the prediction and then in my free time i will build on this application to get it to run smoother than it is doing now. i guess i could find some kind of way to incoorperate both of the methods in a future update. using steering as soon as they have a target.
  2. Darsin

    Predict Interception

    i've done a little throw-up in paint to illustrate the issue. 2D: 3D: As seen in the 2nd image. The green blob thingy saw the red blob thingy and has calculated his path towards that position. that's the code i have now. works perfectly. Problem is the red blob thingy moves. So i want to calculate the position of the purple blob thingy. According to velocity and the yaw of the red blob thingy in relation to the velocity and distance of the green blob thingy [Edited by - Darsin on January 26, 2009 6:21:44 AM]
  3. I've been working on a project for my final college project before i can graduate for my bachelor degree. And i've run into quite of a problem. I can't seem to figure out how to calculate where i need to go to intercept my pathfinding players. The AI is search 'n Destroy and looks for my players which determine their path according to A*. they have an acceleration or velocity whatever you want to call it. And they have a yaw to show me what they are looking towards. Their position is put in a D3DXVECTOR3 so x,y,z How am i gonna go about calculating their position. I've found a book that showed me how to do it on a 2d plane but he spoke of a Magnitude function which i've never heard of or seen in his book. Any ideas? What i did right now was calculate the distance between them. Calculate the cell they were in on the grid. And look in which direction the cell of the player they've seen should be raised or decreased. I did this by the amount of the distance but that will never work. // EDIT Basically i'm trying to figure out. How to calculate what cell i need to move my AI players to In order to meet up with my human players. [Edited by - Darsin on January 26, 2009 6:08:23 AM]
  4. I had a certain type of that at one point but my colleague asked me to look into this way of doing things. I had my suspicions this was not the way to go. or atleast it went against my programming beliefs but i thought i'd ask before i decided not to try it.
  5. I'm trying to make my code more efficient. Class Entity (holds the .x mesh) Class Creature: public Entity, AI (Holds the Creatures / Characters info) Class AI (holds the basic AI functions) Class AINotControlled: public AI (Extended AI + functions for NPC's and Enemies) Class AIPlayerChar: public AI(Extended AI + functions for playable characters) is there a way to define my classes so i can hold playable and non playable characters in Creature with a dynamic AI? I've boggled my mind over this but can't come to a very definite solution.
  6. The reason being i denied that was. their paths are never blocked the slopes are always above 0.7 and there is some serious steepness.
  7. For now i just need to know if the surface is sloped more than a certain amount so let's say 45 degrees. how do i go from the normal to an angle? if the normal is at more than 45 degrees that cell should not be accessed ever.
  8. Perhaps a little more explaining why i want to use the normal. Me and my friend used the difference in height between 2 cells earlier. But that results in the characters walking along a wall sideways and up. which is kind of strange since if something is to steep you won't be able to walk along the side and upwards. In fact it's easier to do that in Reality but reality is not what we're going for. Next to the fact they shouldn't walk up walls sideways. it just looks strange.
  9. I've been working on a my path finding algorithm for some time now and I've got that working. (it chooses the path which is cheapest). But now i want to add the factor of road blockage to the equation. Me and my friend are using a height map which calculates the normal of each Cell within the grid. It takes the 4 corners to determine the normal of the surface. I didn't write this code myself but i know how to use it. Now my question is how do i go from here: i receive the normal for this cell. it's stuffed in a D3DXVECTOR3. i figured i should look at the y value of this normal. figuring that 0,1,0 would mean the surface would be completely flat. but what do i do when the surface isn't flat. I've currently tried "normal.y < 0.7" would mean it would be blocked. well that's obviously not the way to go. But i lack the knowledge of the needed math here. Any pointers? P.S. this should have been in the Math forum >.< sorry
  10. Alright, just did that and that leaves me with another issue. ThreadHandler<T>::waiting_line': multiple template parameter lists are not allowed
  11. so like this? [source language="cpp"] private: static queue<T*> ThreadHandler<T>::waiting_line; static bool ThreadHandler<T>::threadDead; and what for my methods?
  12. The one that is giving me headaches is the queue.
  13. So what exactly do i need to do. I've worked with templates well in the past but it's been so long ago i can't remember alot of it.
  14. Could you provide me with a small sample that would apply to my code? since i think i understand what you mean but have no idea of how to solve the issue at hand.
  15. Hello, I'm trying to template my ThreadHandler Class as shown below. problem is that whatever i try i keep getting errors on the line where the queue is being defined. and if it manages to parse past that i get lnk errors. AI.cpp ThreadHandler<PathStruct>::addAction(new PathStruct(pEntity, pEntity->pAI, moveToPosition, shortestPath, v, tempTerrain)); ThreadHandler.h #pragma once struct PathStruct; template <typename T> class ThreadHandler { private: static queue<T*> waiting_line; static bool threadDead; public: static void addAction(T* action); static void KillThread(); static void Run(void *); protected: }; ThreadHandler.cpp #include "Stdafx.h" template <typename T> queue<T*> ThreadHandler<T>::waiting_line; template <typename T> bool ThreadHandler<T>::threadDead; struct PathStruct { Entity * entity; AI * ai; D3DXVECTOR3 moveToPos; stack<D3DXVECTOR3> shortPath; TerrainVertex * terVert; Terrain * terrain; PathStruct::PathStruct(Entity * pEntity, AI * pAI, D3DXVECTOR3 moveToPosition, stack<D3DXVECTOR3> shortestPath, TerrainVertex * v, Terrain * pTerrain) { entity = pEntity; ai = pAI; moveToPos = moveToPosition; shortPath = shortestPath; terVert = v; terrain = pTerrain; } }; template <typename T> void ThreadHandler<T>::addAction(T * action) { waiting_line.push(action); } template <typename T> void ThreadHandler<T>::KillThread() { while(!threadDead) Sleep(100); while(!waiting_line.empty()) { waiting_line.pop(); } } template <typename T> void ThreadHandler<T>::Run(void * pointless) { threadDead = false; while(Main::applicationRunning) { while(!waiting_line.empty() && Main::applicationRunning) { AI::CalcPath(waiting_line.front()); waiting_line.pop(); } Sleep(100); } threadDead = true; } What am i doing wrong.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!