Artificial Intelligence...
Artificial Intelligence...
Artificial Intelligence...
Artificial Intelligence...
Artificial Intelligence...
Artificial Intelligence... Artificial Intelligence... Artificial Intelligence... Artificial Intelligence... Artificial Intelligence... Artificial Intelligence... Artificial Intelligence... Artificial Intelligence...
Artificial Intelligence... Artificial Intelligence...
Artificial Intelligence...
Go Back  Xtreme Visual Basic Talk > > > Artificial Intelligence...


Reply
 
Thread Tools Display Modes
  #1  
Old 07-16-2010, 07:12 PM
VbNerd96's Avatar
VbNerd96 VbNerd96 is offline
Freshman
 
Join Date: Dec 2009
Posts: 33
Question 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!
Reply With Quote
  #2  
Old 07-16-2010, 11:32 PM
vb5prgrmrArtificial Intelligence... vb5prgrmr is offline
Senior Contributor

* Expert *
 
Join Date: Mar 2009
Posts: 1,087
Default

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
Reply With Quote
  #3  
Old 07-17-2010, 11:29 AM
VbNerd96's Avatar
VbNerd96 VbNerd96 is offline
Freshman
 
Join Date: Dec 2009
Posts: 33
Default

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!
Reply With Quote
  #4  
Old 07-17-2010, 10:28 PM
vb5prgrmrArtificial Intelligence... vb5prgrmr is offline
Senior Contributor

* Expert *
 
Join Date: Mar 2009
Posts: 1,087
Default

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
Reply With Quote
  #5  
Old 07-18-2010, 12:41 AM
VbNerd96's Avatar
VbNerd96 VbNerd96 is offline
Freshman
 
Join Date: Dec 2009
Posts: 33
Default

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!
Reply With Quote
  #6  
Old 07-18-2010, 07:04 AM
vb5prgrmrArtificial Intelligence... vb5prgrmr is offline
Senior Contributor

* Expert *
 
Join Date: Mar 2009
Posts: 1,087
Default

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
Reply With Quote
  #7  
Old 07-18-2010, 12:57 PM
VbNerd96's Avatar
VbNerd96 VbNerd96 is offline
Freshman
 
Join Date: Dec 2009
Posts: 33
Default

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!
Reply With Quote
  #8  
Old 11-22-2010, 12:04 PM
Banjo's Avatar
BanjoArtificial Intelligence... Banjo is offline
Hell's Angel

Retired Moderator
* Guru *
 
Join Date: Jul 2001
Location: Yorkshire, UK
Posts: 10,394
Default

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"
Reply With Quote
  #9  
Old 12-05-2010, 08:42 PM
surfR2911 surfR2911 is offline
Contributor
 
Join Date: Oct 2009
Posts: 719
Default In search of a path (to pathfinding)

Reading through your first post that talks about: "searching", "investigating", "encountering", and "moving away from", I have a feeling you are eventually going to want to investigate some computer algorithms involved in pathfinding:
http://en.wikipedia.org/wiki/Pathfinding

Some good pathfinding algorithm search terms are:
A* (or just in case the forum's stupid search engine still can't deal with two letter search terms - "A-star" or "Astar")
Dijkstra
Best First
Floyd-Warshall

Here's some links to get your started..

Good starting tutorial:
http://www.policyalmanac.org/games/aStarTutorial.htm
Amit's Game Programming, Shortest Path links:
http://www-cs-students.stanford.edu/...rog.html#paths
Tek Tips page with a bunch of links (scroll down a bit):
http://www.tek-tips.com/viewthread.c...1517633&page=1

A* Pathfinder in Visual Basic (pdf)

XVBT forum thread links:
a* pathfinding
http://www.xtremevbtalk.com/839768-post2.html
http://www.xtremevbtalk.com/412620-post2.html
http://www.xtremevbtalk.com/951057-post2.html

Links to off site VB examples:
LaVolpe Non-Tiled Pathfindng
http://www.amanitamuscaria.net/page/...vb-pathfinding
Various Pathfinding Implementations (A*, Dijkstra & BFS)
http://members.shaw.ca/optikal/MazeT...MazeTracer.zip
http://www.rookscape.com/vbgaming/tutAO.php
http://directx4vb.vbgamer.com/Direct...M_Dijkstra.asp

In interesting article on "Motion Planning using Potential Fields" (which unfortunately has no VB source code):
http://www.gamedev.net/reference/pro...otionplanning/

One of the above forum links refers to a some old VB Dijkstra-related code on a Geocities site.
Of course this site no longer exists, but to save it from oblivion on this, the longest lasting of LegacyVB forums, (and because it looks like the original author Alex Popov did a bit of work on it) I'll attach it.
Attached Files
File Type: zip Dijkstra-Popov_Code.zip (35.7 KB, 31 views)

Last edited by surfR2911; 12-05-2010 at 10:25 PM.
Reply With Quote
  #10  
Old 12-29-2010, 06:21 AM
Leade's Avatar
Leade Leade is offline
Junior Contributor
 
Join Date: Jul 2005
Location: Wherever i fall over
Posts: 222
Default

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!!!
Reply With Quote
  #11  
Old 01-08-2011, 05:41 PM
VbNerd96's Avatar
VbNerd96 VbNerd96 is offline
Freshman
 
Join Date: Dec 2009
Posts: 33
Default

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!
Reply With Quote
  #12  
Old 01-09-2011, 08:05 AM
Banjo's Avatar
BanjoArtificial Intelligence... Banjo is offline
Hell's Angel

Retired Moderator
* Guru *
 
Join Date: Jul 2001
Location: Yorkshire, UK
Posts: 10,394
Default

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"
Reply With Quote
  #13  
Old 01-09-2011, 06:43 PM
VbNerd96's Avatar
VbNerd96 VbNerd96 is offline
Freshman
 
Join Date: Dec 2009
Posts: 33
Default

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!
Reply With Quote
  #14  
Old 01-10-2011, 01:15 PM
Leade's Avatar
Leade Leade is offline
Junior Contributor
 
Join Date: Jul 2005
Location: Wherever i fall over
Posts: 222
Default

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!!!
Reply With Quote
  #15  
Old 01-10-2011, 08:00 PM
Banjo's Avatar
BanjoArtificial Intelligence... Banjo is offline
Hell's Angel

Retired Moderator
* Guru *
 
Join Date: Jul 2001
Location: Yorkshire, UK
Posts: 10,394
Default

Quote:
Originally Posted by VbNerd96 View Post
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"
Reply With Quote
  #16  
Old 01-11-2011, 07:02 PM
VbNerd96's Avatar
VbNerd96 VbNerd96 is offline
Freshman
 
Join Date: Dec 2009
Posts: 33
Default

Gotcha'. Cool, thanks anyway.
__________________
Je reste fidèle à la cause... Des langue programmation de VB6!
Reply With Quote
Reply

Tags
artifficial, glitch, intelligence, problem


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Artificial Intelligence...
Artificial Intelligence...
Artificial Intelligence... Artificial Intelligence...
Artificial Intelligence...
Artificial Intelligence...
Artificial Intelligence... Artificial Intelligence... Artificial Intelligence... Artificial Intelligence... Artificial Intelligence... Artificial Intelligence... Artificial Intelligence...
Artificial Intelligence...
Artificial Intelligence...
 
Artificial Intelligence...
Artificial Intelligence...
 
-->