Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / [WIP] My FPS+TPS Game Project [Need AI]

Author
Message
Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 14th Jul 2012 21:49 Edited at: 14th Jul 2012 22:09
Here is my Game Project so far...









Whole Map is Created By me in 3Ds Max
(Anyone Want to create map like this, for his Game just contact me)

Need Simple AI
Enemy can shoot player
Enemy normal Behaviour

and Please Help me if u can, to add some AI in it... so that enemy cam shoot player...!!!

Video Link
[youtube]http://www.youtube.com/watch?v=M4S4KNxqfVY[/youtube]
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 14th Jul 2012 22:22
Get DarkAI. It works very well for what you are doing.

The fastest code is the code never written.
Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 14th Jul 2012 22:39 Edited at: 14th Jul 2012 22:39
don't have money to buy it... ;( need its free alternate... if there is any...
Mr Bigglesworth
16
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 15th Jul 2012 17:00
There are free c++ pathfinding libaries and tutorials out there on the web.

http://www.policyalmanac.org/games/aStarTutorial.htm
Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 15th Jul 2012 18:28
Quote: "There are free c++ pathfinding libaries and tutorials out there on the web."

The best free ones that I've found are Micropather and Recast/Detour. Neither is a complete AI package but they're both decent(if properly used) pathfinding libraries.

Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 15th Jul 2012 18:33 Edited at: 15th Jul 2012 20:44
i will try it....

EDIT: can not buy Dark AI...
Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 16th Jul 2012 10:24
How can i integrate MICROPATHER with Dark GDK??? Please Help
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 16th Jul 2012 14:16
I have to work today, but I'll look at it and see if I can figure it out.

The fastest code is the code never written.
Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 16th Jul 2012 14:25
Thank u.......!!!!
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 16th Jul 2012 18:51
A few questions:
-is your game only 1 level?
-are there any obstacles that move?
-do you have collision detection?
-are you interested in learning about making your own waypoint plotter? (I already have a prototype)

I may think of more questions later......

The fastest code is the code never written.
Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 16th Jul 2012 21:32
- Yes game has just 1 level still
- Obstacles are part of map they are not movable
- yes i have collision detection( SC library)
- yes i am interested to learn making waypoints...


Thanks
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 16th Jul 2012 21:51
Good. Are you skilled enough to make a GUI interface? If you are wanting to make more than a few levels, making an editor will save you loads of time in the long run. The good news is that you can simply copy your game to another project and make that your editor. Simply do a slight modification of the controls (so you can move around freely without colliding), add a GUI and *poof* you have an editor. Oh, yes, you will need to be able to load/save info for your levels. Here is a structure I've been working on for 3hrs:

I'm not big on comments, so poor over it and let me know about anything you don't understand.

The fastest code is the code never written.
Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 16th Jul 2012 22:25
ok I have to make a project and copy the game code into it...with no collisions...to move around freely...the one thing I m unable to understand...is, how to use this structure in the new project (the editor)....
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 16th Jul 2012 22:38
I'll explain step-by-step. I'll give you the entire WP later. One part at a time.
Here is the main structure:

First things first.... Do you understand structures?

The fastest code is the code never written.
Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 17th Jul 2012 10:34
yes i understand Structures.....!!!
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 17th Jul 2012 13:45
I modified the controller a bit. Here is the entire structure:

Here is a quick example of how to use it. Do all of this outside your game loop:

tp1 is just a variable I used for testing so I could output the results.

Take it for a spin and let me know if you have any questions about the controller.

The next thing you will need is something to control how the NPCs will react. Are you able to determine if an enemy can see you?

The fastest code is the code never written.
Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 17th Jul 2012 20:14
Thanks... i will try it and tell u about if any question... No i am not able to determine that enemy can see me...
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 17th Jul 2012 21:17
You can use the built-in collision detection system. I am using GDK2.0. Are you?

First you will need to determine if the object (your character) is within the enemy's view angle. This can be done with some math:

If the "AngleToTarget" is greater than the enemy's perifrial vision (for practical purposes, about 180 degrees), then ignore, else check for view collision:

GDK1.0 has some collision detection. Maybe something like dbIntersectObject(..). Can't remember what the actual syntax is, but it has "intersect" in the funtion name.

GDK2.0 has
Quote: "float dbIntersectObject ( int objectID, float x, float y, float z, float x2, float y2, float z2 ) "
The 2 sets of coordinates are start(x,y,z) and end(x2,y2,z2).

Unfortunately with this method(1.0 & 2.0), you will have to check each obstacle to see if it collides. This method is fast, so it shouldn't be a problem unless you have a HUGE number of obstacles.
To avoid costly detection with complex objects, use simple boxes (that are hidden) to represent the first "layer" of this collision detection. If the collision occurs with the box, then test the actual object.

The fastest code is the code never written.
Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 17th Jul 2012 21:27
i m using DarkGDK 1.0 without any update.. bcoz no animation in updated .....
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 17th Jul 2012 21:45
Check out those commands and see if they work. BTW, how are you checking to see if the bullet hits anything?

The fastest code is the code never written.
Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 17th Jul 2012 21:51
i detect bullet collide with SC rayCasting....
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 17th Jul 2012 22:33
If you Sparky's, you can do better collision detection than the built-in stuff. I think Sparky's SC_intersectObject(..) is better than GDK's.

The fastest code is the code never written.
Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 18th Jul 2012 01:42
Quote: "If you Sparky's, you can do better collision detection than the built-in stuff. I think Sparky's SC_intersectObject(..) is better than GDK's."

It's definitely faster. Still performs the same function if I remember correctly.

Hawkblood, is there a way to somehow automate connecting all the waypoints? Like perhaps adding a "connectWaypointsByCreationOrder()" method/function but with a shorter name? I can see that creating waypoints and connecting them by hand being a giant time consumer.

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 18th Jul 2012 04:42
The problem with doing that as a default is that you may create waypoints that you don't want connected and then have to delete them. This method is designed to be used with a GUI, but as you can see, it can also be done by keystroke.

The fastest code is the code never written.
Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 18th Jul 2012 06:08
Quote: "The problem with doing that as a default is that you may create waypoints that you don't want connected and then have to delete them. This method is designed to be used with a GUI, but as you can see, it can also be done by keystroke."

I forgot to mention that I was thinking of this being an optional functionality more than the default. Especially if it's being done programmatically, that would be a lifesaver.

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 18th Jul 2012 13:41 Edited at: 18th Jul 2012 13:42
Quote: "I was thinking of this being an optional functionality more than the default."

Yea, I considered that. It would be easy to empliment that funciontality:

and change the definitions:


The fastest code is the code never written.
Sana_Sajjad
11
Years of Service
User Offline
Joined: 9th Jul 2012
Location:
Posted: 19th Jul 2012 07:08
Hi Hawkblood. Just found this thread, this is interesting and very useful, but your mentioned waypoint's codes are in many parts, i am very confuse how can i use this in my game? is it complete? can you give a quick example how to use it?

=============================================================
G!rLz CaN C0d3 GaM3s....!!!!
=============================================================
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 19th Jul 2012 13:49
Here's the entire code:

The example use is at the bottom. I didn't give an example of "AddNextWP()", but I think you can figure that out....

The fastest code is the code never written.
Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 19th Jul 2012 18:33
Sorry my internet is dead from last 2 days... Posting from my mobile's GPRS
Hawkblood i copied the structures and pasted them like this

and in the main



i am getting lots of errors.... cant' upload debug info bcoz of internet...Where i m wrong plz tell me...
Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 19th Jul 2012 18:56
First issue is this line of code:
.
It should be something like '#include "area.h"'.

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 19th Jul 2012 19:28
Yea, what is that?
Quote: " #include area"

You do need to
Quote: "#include <vector>"


The fastest code is the code never written.
Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 19th Jul 2012 19:31
Sorry my mistake, typing from mobile... its nothing... i forgot to type // before it i m mentioning that this is include area where some .h files loaded...
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 21st Jul 2012 00:57
It's been over 24hrs. How is your game going?

The fastest code is the code never written.
Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 21st Jul 2012 01:34
waypoint method giving lots of errors... currently working on game's trailer...
I posted above how I implemented the waypoint code...but its giving many errors... where am I wrong? ? ?
Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 21st Jul 2012 01:53
Quote: "I posted above how I implemented the waypoint code...but its giving many errors... where am I wrong? ? ?"

We need to see the errors you are getting, otherwise we can't help you.

Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 21st Jul 2012 02:16
ok its late nights here....i will post errors in the morning....
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 21st Jul 2012 02:37
@Dar13
Have you run my code? I can think of only 2 #includes that he may not have <vector> and <D3dx9math.h>. Is there anything else?

The fastest code is the code never written.
Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 21st Jul 2012 02:56
@Hawkblood
No I haven't run the code, haven't had time to do it. But I looked through it and it seems to only need <vector> and <d3dx9math.h> as you said.

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 21st Jul 2012 03:21
Good. I ran the code extensively and I couldn't find any problems.

The fastest code is the code never written.
Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 21st Jul 2012 11:37
here are all the errors....
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 21st Jul 2012 16:12
WOW, that's a lot of errors! This first error is a telltale sign you didn't do what I told you:
Quote: "1>c:\users\home\desktop\mw2 - copy\mw2\main.cpp(104) : error C2143: syntax error : missing ';' before '<'"

That line in your code is
Quote: "vector <float> DistanceToWaypoint;"
. This error is telling you that you don't have anything telling the compiller what a "vector" is. To fix this, you need to
Quote: "#include <vector>"
BEFORE any code that reference it. It looks like you have <d3dx9math.h> included because you're not getting errors about D3DXVECTOR3 being unidentified.

The fastest code is the code never written.
Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 21st Jul 2012 17:02
And add a line right below where you '#include <vector>' that says 'using namespace std;'

Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 21st Jul 2012 18:22 Edited at: 21st Jul 2012 18:31
i included
Quote: "#include <vector>"
but after writing
Quote: "using namespace std;"
all errors gone just few errors left those r bellow...



i think its dbMakeObjectCube ....
but how to cover FindFreeObject() error...
i tried to write FindFreeObject function like this
Quote: "int FindFreeObject( )
{
int id=1;
while(dbObjectExist(id))
{
id++;
}
return id;
}"

but it gives some new errors
Quote: "1>------ Build started: Project: mw2, Configuration: Debug Win32 ------
1>Compiling...
1>Main.cpp
1>c:\users\home\desktop\mw2 - copy\mw2\main.cpp(322) : error C2440: '=' : cannot convert from 'void' to 'int'
1> Expressions of type void cannot be converted to other types
1>c:\users\home\desktop\mw2 - copy\mw2\main.cpp(325) : error C2440: '=' : cannot convert from 'void' to 'int'
1> Expressions of type void cannot be converted to other types
1>c:\users\home\desktop\mw2 - copy\mw2\main.cpp(338) : error C2440: '=' : cannot convert from 'void' to 'int'
1> Expressions of type void cannot be converted to other types
1>c:\users\home\desktop\mw2 - copy\mw2\main.cpp(341) : error C2440: '=' : cannot convert from 'void' to 'int'
1> Expressions of type void cannot be converted to other types
1>Build log was saved at "file://c:\Users\Home\Desktop\mw2 - Copy\mw2\Debug\BuildLog.htm"
1>mw2 - 4 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped =========="
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 21st Jul 2012 18:51
Your FindFreeObject needs to have (void) in the declaration.


When it gives you an error like this
Quote: "1>c:\users\home\desktop\mw2 - copy\mw2\main.cpp(322) : error C2440: '=' : cannot convert from 'void' to 'int'"
double-click on it and it will show you the line where the error occured. Show me that line.

The fastest code is the code never written.
Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 21st Jul 2012 18:55
here it is
Quote: "WPBox[i]= dbMakeObjectCube(1,FindFreeObject());"

and
Quote: "else WPBox[i]=dbInstanceObject(WPBox[0],FindFreeObject());"


Quote: "ConnectionLine[i]=dbMakeObjectCube(1,FindFreeObject());"


Quote: "else ConnectionLine[i]=dbInstanceObject(ConnectionLine[0],FindFreeObject());"


These 4 lines
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 21st Jul 2012 19:02
You are using 1.0.... You will have to make some changes to my code. 2.0 has returns in the "creation" commands. You will have to do something like this for each of the creation commands:

I have completely converted my code to 2.0, so I don't even have the help files anymore.

The fastest code is the code never written.
Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 21st Jul 2012 19:11 Edited at: 21st Jul 2012 19:16
ok trying it...
first parameter is id and 2nd is size
like
Quote: "dbMakeObjectCube(int iD, float iSize);"


EDIT: i tried it...it loads my game, no GUI of creating WP appeared...
Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 23rd Jul 2012 15:34
what is next step? how to use this? any guide?
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 23rd Jul 2012 21:51
Quote: "i tried it...it loads my game, no GUI of creating WP appeared"

I haven't given you a GUI. One needs to be made-- or at least a method of placing them around your map. Do you have a mouse interface or is it only able to move like a FPS?
Do you have a menu system, such as "load", "save", "options", "quit"?
Did you make an editor program seperate from your game? Are you able to save info from the editor and load it into your game program?

The fastest code is the code never written.
Wana7262
12
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 24th Jul 2012 07:08
sorry i have only FPS and TPS interface... no mouse interface... no menus system... no "Save", "Load", "Quit" yet... i m not able to save or load info from the editor...
i just copied my game project and added the WP structures in it...

Login to post a reply

Server time is: 2024-03-29 11:44:13
Your offset time is: 2024-03-29 11:44:13