 |
 |

07-16-2010, 06:12 PM
|
 |
Freshman
|
|
Join Date: Dec 2009
Posts: 33
|
|
Artificial Intelligence...
|
I have been working on an Artifficial Intelligence project and have incountered a bug... which I not sure how to fix.
First off a little backstory (if you will).------------------------------
The program has multiple types of AI with different characteristics...
One of which is just a plain ol' averge being.
Now, this AI during it's main loop will "search for danger" just to make sure that there is not any kind of hazard that it will need to avoid, or something it needs to investigate.
One thing it searches for are dead bodys.
And, if it finds one it will procede to investigate said body...
after investigating the body and looping through some random things (check cause of death, alert nearby peeps, call athoritys) it will procede to move away from the corpse..
at which point it will *again* recognise the body and go through the same loop over and over again as though it had never seen the body before.
----------------------------------------------------
Sorry for the long intro...
Anyway, My question is : is there some way I can make it so that the next time the AI encounters it it will know that it has seen it before and will leave it alone?
Thanks in advance...
|
__________________
Je reste fidèle à la cause... Des langue programmation de VB6!
|

07-16-2010, 10:32 PM
|
|
Senior Contributor
* Expert *
|
|
Join Date: Mar 2009
Posts: 1,087
|
|
|
Well that really depends upon what and how you keep track of the environment. Do you have fog of war tracking AKA terrain discovery? How do you track the placement and movement of other obsticals/characters within the environment? Do you have some sort of bitmap or indicator array? If so, could you not flip a bit somewhere to indicate discovered and searched?
Good Luck
|
__________________
Just because I'm an expert does not mean I know it all and just because I know it all does not mean I'm an expert
|

07-17-2010, 10:29 AM
|
 |
Freshman
|
|
Join Date: Dec 2009
Posts: 33
|
|
|
Well, right now there actually is no method of keeping up with the envirorment...
I do not have the envirorment gridded, so every thing is free-roam... How would one go about setting up an indicator array or something with a free-roam envirorment??
|
__________________
Je reste fidèle à la cause... Des langue programmation de VB6!
|

07-17-2010, 09:28 PM
|
|
Senior Contributor
* Expert *
|
|
Join Date: Mar 2009
Posts: 1,087
|
|
In any way that works for you... However, I have seen bit maps (*.bmp) like fiiles in several formats. A monochrome, greyscale, true color, and with an alpha value (ARGB or is that ABGR), meaning...
Code:
11111111
10000001
10011001
10011001
10011001
10011001
10000001
11111111
in a monochrome bitmap style, each bit, either a zero or a one, denotes where a player can walk/move, or it could mean something else...
Same can be said for a 256 greyscale image where each byte, pixel, contains some sort of meaning as each byte can be a value from 0 to 255. So this could be a height map or a movement cost map, or... well let your imagination run wild with that...
Then of course, the bitmap type of file we may be more used to where each pixel has an RGB value and each byte (r,g,b) for each pixel can mean something.
Of course after that, there is the alpha channel with each pixel.
Now, these don't actually have to be *.bmp files (or *.jpg, *.png), but if you are going to let your users define game envionments, terrain, obstacles, etc. it is one way to do so. Another way, like the game of Decent, an older game, which was in 3d. They used a common 3d environment formated file that I believe most users used Autocad to design levels with.
Now, these file formats can be of your own design, or you can use an established file format and just used it for your own purposes...
Good Luck
|
__________________
Just because I'm an expert does not mean I know it all and just because I know it all does not mean I'm an expert
|

07-17-2010, 11:41 PM
|
 |
Freshman
|
|
Join Date: Dec 2009
Posts: 33
|
|
|
Woah... I'm sorry but I've gotten a bit confused....
The example made me think Multi-demisional Array... but your talking about bitmaps... how would I incorperate a bitmap into this?
|
__________________
Je reste fidèle à la cause... Des langue programmation de VB6!
|

07-18-2010, 06:04 AM
|
|
Senior Contributor
* Expert *
|
|
Join Date: Mar 2009
Posts: 1,087
|
|
Well think about the example I gave you and an image. Each have a width and a height, and cannot these be tracked by a multidimensional array? Via X and Y values? It is pretty much the same to say...
Code:
MyLongValue = MyLongArray(x, y)
'or
MyLongValue = GetPixel(PicBox.hdc, x, y) 'GetPixel is an API BTW
The only difference is, if you are somewhere on this terrain and you want to know what is around you, based on vision, fog of war, etc. With an array, you have to figure it out, but with a bitmap, they make API's for such things...
http://www.tek-tips.com/viewthread.cfm?qid=849985
http://www.tek-tips.com/viewthread.cfm?qid=626738
http://www.tek-tips.com/viewthread.cfm?qid=334861
http://www.tek-tips.com/viewthread.cfm?qid=270540
Good Luck
|
__________________
Just because I'm an expert does not mean I know it all and just because I know it all does not mean I'm an expert
|

07-18-2010, 11:57 AM
|
 |
Freshman
|
|
Join Date: Dec 2009
Posts: 33
|
|
|
Wow, that was much simpler than I thought it would be. lol
But I finnally understand... lol...
Anyway, thanks a mill' for the assistance... much appreiciated.
|
__________________
Je reste fidèle à la cause... Des langue programmation de VB6!
|

11-22-2010, 11:04 AM
|
 |
Hell's Angel
Retired Moderator * Guru *
|
|
Join Date: Jul 2001
Location: Yorkshire, UK
Posts: 10,394
|
|
|
How is your AI realising that there is something there to search? I'm assuming you have a set of "objects", each of which has various properties such as position, vector, sprite and so on. I would have thought you'd just want to add a new property called for "searched".
|
__________________
A wise one man once said "what you talking about dog breath"
|

12-05-2010, 07:42 PM
|
|
Contributor
|
|
Join Date: Oct 2009
Posts: 719
|
|
In search of a path (to pathfinding)
Last edited by surfR2911; 12-05-2010 at 09:25 PM.
|

12-29-2010, 05:21 AM
|
 |
Junior Contributor
|
|
Join Date: Jul 2005
Location: Wherever i fall over
Posts: 222
|
|
|
1] A little cheat you can do if you have only a few bodies on screen each time is create a hidden list of bodies it will work down and till it is complete, this is a good idea if you have a small amount but can slow system down the larger the list, it also means if new bodies appear, which they inevitable will, these won't be added/scanned till the list is completed. You also stand the chance of confusing the newly added bodies to the already scanned bodies and be right back where you started.
2] A simpler way of doing it is to create a single byte flag which is either 1 when scanned or 0 when not, that way if the computer should stumble over it again it should see its already scanned it and should move on.
3] Another thing you could do is if the computer scans the bodies and is finished why not just delete the body and free up resources or if you programming skills is advanced enough merge the body mesh to the scenery mesh (it is possible, and quite easy to do... well for me anyway)
You'll still see the object but won't be able to interact with it again. I should also point out that once meshes are merged its quite difficult to separate them again, and believe me i've tried.
In your case i'd go with number two it would suit your program and would be very easy to utilise.
|
__________________
Fact: The best ideas come when your smashed of your face. So drink beer and be merry!!!
|

01-08-2011, 04:41 PM
|
 |
Freshman
|
|
Join Date: Dec 2009
Posts: 33
|
|
Whoops, haven't logged-in in a few months so I've only just now seen the other posts.
@Banjo Quite simple, though maybe unoptimized. Every AI in the world is contained within an Array. When any particular AI is searching for something it'll loop through said Array and check for certain red-flags as to where danger is. I.E.
Code:
For i = 0 to ubound(AI)
If AI(i).Alive = false then
Investigate
'Yadda Yadda... FooBar
End if
Next i
@VB6Oldguy Thank you so much. This are sure to help... a LOT. lol.
@Leade I think vb5prgrmr already suggested #2, but thanks for the other ideas.
|
__________________
Je reste fidèle à la cause... Des langue programmation de VB6!
|

01-09-2011, 07:05 AM
|
 |
Hell's Angel
Retired Moderator * Guru *
|
|
Join Date: Jul 2001
Location: Yorkshire, UK
Posts: 10,394
|
|
Then surely you just need another flag which Investigate sets to true:
Code:
For i = 0 to ubound(AI)
If AI(i).Alive = false and AI(i).Searched = False then
Investigate
'Yadda Yadda... FooBar
End if
Next i
|
__________________
A wise one man once said "what you talking about dog breath"
|

01-09-2011, 05:43 PM
|
 |
Freshman
|
|
Join Date: Dec 2009
Posts: 33
|
|
|
Ah, I see what you mean. o.O Hasn't vb5prgrmr already suggested that though?
|
__________________
Je reste fidèle à la cause... Des langue programmation de VB6!
|

01-10-2011, 12:15 PM
|
 |
Junior Contributor
|
|
Join Date: Jul 2005
Location: Wherever i fall over
Posts: 222
|
|
|
just use my numer three its better forget everyone else 3 3 3 3 3 3 3 3 3 3............ you know what never mind see if i care, but remember this a dog is not just for christmas, it also makes a very impressive meal.
|
__________________
Fact: The best ideas come when your smashed of your face. So drink beer and be merry!!!
|

01-10-2011, 07:00 PM
|
 |
Hell's Angel
Retired Moderator * Guru *
|
|
Join Date: Jul 2001
Location: Yorkshire, UK
Posts: 10,394
|
|
Quote:
Originally Posted by VbNerd96
Ah, I see what you mean. o.O Hasn't vb5prgrmr already suggested that though?
|
He did, but your reply to him seemed to indicate that you were confused by the concept.
|
__________________
A wise one man once said "what you talking about dog breath"
|

01-11-2011, 06:02 PM
|
 |
Freshman
|
|
Join Date: Dec 2009
Posts: 33
|
|
|
Gotcha'. Cool, thanks anyway.
|
__________________
Je reste fidèle à la cause... Des langue programmation de VB6!
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|