Skip to main content
GameDev.net gamedev.net
🔒 Locked

Making a chat bot play video games.

Started by Calin Jul 6 at 9:33 AM 21 replies 1.2k views
Original Post
Calin
Calin

This thread is about exploring the idea of using existing human language processing algorithms to build a universal video game AI player (an AI player that can play any type of game).

Lets take a particular type of game: RTS. The starting point is that I think you can have laws expressed in human language. You can have two types of laws, general laws and special laws. General laws will tell our AI player how to play a game of a certain genre (in our case it's an RTS) special laws will teach the AI player about the particularities of an video game instance, they will tell the player where things are on a particular map. Lets take an example.
General Law: "A game is won by destroying all enemy units"
General Law: "To destroy a unit you need eficient firepower for a duration of s seconds"
General Law: "Marines, Firebats, Tanks provide firepower"
General Law: "Marine firepower is eficient if the marine is less than 6 tiles away from the target"
General Law: "Firebat firepower is eficient if the firebat is less than 2 tiles away from the target"
Special Law: "There is an enemy unit al location 10,10 on the map"
Special Law: "We have a marine at location 1,10 on the map"

Task: "Win the game". (it's a chat bot so it's going to be a question "How do I win the game?")

Chat bot answer: "You need to place the marine at location 4,10 and keep it there for s seconds".

Of course you need more than just language processing (assembling the answer in words using a neuronal network created from those laws), you also need the chat bot to solve problems, you need math, vectors etc if you want to come up with that 4,10 figure.

My project`s facebook page is “DreamLand Page”
JoeJ
JoeJ

Calin wrote:

This thread is about exploring the idea of using existing human language processing algorithms to build a universal video game AI player (an AI player that can play any type of game).

They already work on that, and call it 'World Models'.
They create realistic environments, simulating physics, and maybe gfx and audio like in a video game.
They hope this way their AI agents become truly intelligent if they learn in a complex world.
This way they can replace more humans with robots, which is their goal, because it means less resistance in a future World War 3, which will be a social war against tech companies.
Their first step into this direction was manipulating people to elect Trump for president, who is under the control of tech billionaires. It somewhat worked, because as requested Trump said no to any AI regulations, and also Palantir can now sniff any private data of people.

So if you want to have an AI buddy who can play your games with you, no need to discuss anything. Just wait and see.
But be ready for him to take the entire couch for himself. You can sit on the floor instead.

But if you want to make an AI video game player yourself, you can follow John Cramacks path: Make some awesome games, then leave the industry to play with rockets and VR goggles, finally working on AI because he believes 'the extra code needed to achieve general AI probably fits on a credit card - i just don't know yet what it is'.

You'll need good luck in either case.

Calin
Calin

world models

I think the reward for the video game industry will be modest. A virtual world with super inteligent characters is boring because you need time for change to take place, I'm playing a game because I like being in control. Smart characters take away the control from me. I'm placed in a position where I have to wait after them and their routines.
A world with realistic characters competes with the real world. I had the idea once to build a MMO RTS a game with a persistent world in which you have real time RTS units (not just the typical MMO character) that keep living when you log off, they don't dissapear of freeze or anything like that. The problem with that was that if something important happened like someone (another player) entering your base you likely wanted to know about it and have the ablity to react in time. A solution could have been to recieve notifications on your phone about realtime happenings in the MMO but then you would have been placed in a situation where you need to log into the MMO right away and fix the problem. I think distributed attention between the real world and a virtual world is not posible. I either have videogame time when I'm in front of the computer and 100% dedicated to the game I'm playing or I have real world time when I'm 100% dedicated to the real world.

The real gain from this "world models" venture will be robotics I think. It will alow building of full fledged terminators (minus the living tisue covering the robots of course) that are able to find their way in the midst of a complex environment.

My project`s facebook page is “DreamLand Page”
JoeJ
JoeJ

Oh wait, i think i've got you wrong here:

Calin wrote:

using existing human language processing algorithms

I was skimming over quickly, and i did read 'large language model' instead.
Thus i was thinking you talked about doing all game AI with llms.

But now i'm not sure what you mean - using an traditional algorithm for game AI, but using llm for a speech/text driven player interface?
Or do you mean some external AI which can play any game, e.g. to assist players and following them into any game they currently play?

Calin
Calin

But now i'm not sure what you mean

What a LLM does is actual thinking. That's what thinking is. Imagine you have a piece of software running on your laptop that takes captures of your screen while you're playing starcraft. The software has an image recognition algorithm, it can recognize the sprite of a marine and label it with the word "marine". If it sees a small flashing light near the marine it recognizes that as "shooting". There might be several marine tiles on the map so the software is adding an additional identifier to each marine it is seeing. The marine at position 1,10 will be "marine A" the other unit on the map will be "marine B" (let say the unit it's also a marine). Now you have two words or expressions that you can be used by an LLM. I haven't studied the problem thorowlly (I'm making educated guesses) but it looks like an LLM uses a static database of laws like a history book that it loads once. You ask a question and the LLM will ensemble the answer from the static database found in the memory. But nothing prevents you from having a dynamic database used by the LLM.
The general laws that are governing the gameplay of a RTS are the static database bit. The special laws are always changing. You have marine A at position 1,10 , this state of things becomes a sentence "Marine A is found at position 1,10". This sentence can then be included in the inner workings of a LLM.

The software on your laptop I was talking about earlier can recognize the map too. It can recognize and rembember combinations of map tiles and map features. If it sees a two trees and two patches(tiles) of grass near positon 10,10 it will label that as "Map Location 1" (saving just individual tiles is possible too of course but that becomes difficult to process, it's too many tiles that the LLM has to keep account of). Our image recognition software also has LLM capabilities. So when we query "How do I win the game?" the answer will be "Move Marine A at Map Location 1" (Of course we don't know what Marine A or Map Location 1 is these are just conventions used by our software, a complete answer will be something like "Move the marine found at the left edge of the map near two trees and two patches of grass location).



My project`s facebook page is “DreamLand Page”
JoeJ
JoeJ

Calin wrote:

What a LLM does is actual thinking. That's what thinking is.

Aha, is that so? That's something new to me. But maybe our definition of 'thinking' just diverges.

Imagine i would draw a painting of Albert Einstein, thinking hard about some formula.
Then i show you the painting.
Would think the image is actually thinking?

That's exactly what's happening here, i'm afraid.

Calin wrote:

Now you have two words or expressions that you can be used by an LLM. I haven't studied the problem thorowlly

Me neither. I know LLM can generate entire RPG quests with characters and storylines, images, etc.
But i do not know if text prompts and text outputs are the only way to integrate an LLM into a video game.
Which would be a problem, because unlike users or other LLMs, video game engines can't understand language output to create the quest as described.

And i also don't know if you can even get reliable output like 'move Marine A to 1,10' to play some RTS.
Could be tested by trying to play a game of chess with some AI chatbot this way.

Calin
Calin

JoeJ wrote:

And i also don't know if you can even get reliable output like 'move Marine A to 1,10'

It's possible. I'm working on tiny project that exploits the idea that I'm trying to explain in this thread, I'm still in the general language processing routines, no video game specifics yet but basically what I'm talking about is a process of replacing a programming algorithm with plain human language sentences (laws, rules etc.)
Spoken or written human language is basically the expression (a record) of linked neurons. "This house is blue", neuron "house" is linked to neuron "is" and "is" is linked to neuron "blue". If I add another one or two sententeces in the same context "Blue is a color", "Color is one of the following properties: blue, red, yellow" then the result is that house has the potential of being yellow or red (in a game I could press a button and the house color would change to yellow)
Same thing with moving. Say we have a 3x2 map and the character is on tile 0,0 (x 0, y 0). We want the character to get to tile 2,0. We can control the character getting to tile 2,0 by the means of human language (neuronal network). All we need to do is instruct the chat bot that we have a total of 6 walkable tiles (our map) . We instruct the chat bot that "walking" means moving to the next tile or a walking option. Each tile has 8 neighbor next tile or less. We provide which are the walking options for each of our 6 walkable tiles. For starting tile 0,0 (tile 0)there will be only 3 walking options: tile 1, tile 3 and tile 4 (the numbers are tile indices in the tile array). The chat bot may choose the appropirate next tile based on direction of movement. We decide the direction of walking, update current position when when movement takes place and there you go, the chat bot can control movement, the character will move in the correct direction by recieving orders step by step from the chat bot. We need to go East, deciding is easy. It becomes a bit more complicated if the destination is something like tile 2,1 because we need steering (we need to provide additional helper directives so that the chat bot can make the appropriate decision) but still a decision possible by processing human language.

My project`s facebook page is “DreamLand Page”
JoeJ
JoeJ

Calin wrote:

by the means of human language (neuronal network)

From what you say it's probably not a 'neuronal network'. A single neuron in a NN can not represent something like a house or the color blue. Only the network as a whole can be trained with many labeled examples, so it eventually, after learning thousands images labelled red, green, or blue, the network may be able to classify the color of some unknown new image to be blue. For success, the network probably detects patterns between color values and labels, e.g. (0,0,1) -> blue, (1,0,0) -> red. And it needs to detect them without you telling it somehow that blue == (0,0,1), which you can not even do. Also, you as the programmer will not know how the network represents its found patterns, or how it actually at all works. I mean, for such simple problems it's likely understandable, but for a LLM it's not. They have no clue how their stuff works and have their own research divisions trying to figure it out. But they can't. They might well arrive at AGI one day, but they will never know how it works.

Thus, if you're writing a classic program processing human language terms, that's not a NN, but rather a classic chatbot like Eliza was.
Don't adopt terms like 'neural network' just because they represent similar goals and have some hype. Confusion is the only outcome of this.

Well, maybe 20 years a go i did a little tutorial on NNs. It could tell if a point is on the left or right side of a line. It was simple, but slow and noisy. And i do not remember anything, nor did i ever used what i have (not) learned.
But it would be nice if such basic tutorials would be still around.

Regarding your walking a map example, i wonder what benefit do you expect?
You already have a pathfinding algorithm, which can navigate around obstacles and even labyrinths.
How would you achieve the same using the cahtbot? Probably you end up replacing exact coordinates with inefficient strings, but then you still need to call the pathfinder anyway because you won't achieve the necessary intelligence?


Calin
Calin

From what you say it's probably not a 'neuronal network'.

Observation accepted. I haven't tried to write an actual artificial neuronal network algorithm so chances are I'm misusing terms. I think it would be fare to call the algorithm I'm working on "word links" based algorithm.

but then you still need to call the pathfinder anyway

Human mind doesn't do pathfinding yet it is still able to play a Starcraft game. Pathfinding provides you 1 short, efficient paths 2 valid paths even in the most complicated setting.

AI for RTS doesn't have to find efficient paths, if it uses raw paths that's fine. The only requirement the AI needs to meet is the ability of telling if a tile is reachable. Once the AI has decided that the tile is reachable the move order is issued and classical pathfinder takes over. In any complicated maze the pathfinder will find a path almost instantly in human terms. For humans however finding a path in a complicated maze can take minutes.

Probably you end up replacing exact coordinates with inefficient strings

Probably. But that's not a problem if you deal with a small amount of information.

Regarding your walking a map example, i wonder what benefit do you expect?

It's a new take at the AI problem. The small map example is obviously not a RTS game. On a RTS map any map tile is a "move option" if it's walkable and reachable.

My project`s facebook page is “DreamLand Page”
slayemin
slayemin

There are major problems with using an LLM to play an RTS.

1) Right now, LLMs are all the rage in AI, but they have very narrow scope in where they thrive: They're great at predictive text generation. They've been trained on enormous data sets, have billions of input tokens, and billions of output tokens. The amount of energy and compute it takes to process just one LLM query is enormous -- they are building huge data centers all over the US in order to satisfy the compute and energy demands people are putting on LLMs. But, using an LLM for an RTS game is like trying to pound a square peg through a round hole because you saw it went through a square hole very well. It just ain't gonna work.

2) RTS games require high framerates, something like on the order of 30 frames per second. Now you have games like Starcraft, which have 200+ units, and they all have to get processed at 30hz. An LLM just won't be fast enough. Again, square peg, round hole.

3) A lot of the info in an LLM is useless for an RTS game. Why do you need the completed works of Shakespeare in order to move a marine around on a map?

4) LLMs aren't debuggable. Why did the marine go to position XYZ when it was supposed to go to position ABC? With an LLM, you cannot set a breakpoint and trace through its reasoning. That's critical to refining correct and optimized gameplay.

5) LLMs cost money! Lots of money. If you shipped a game where the AI behavior was driven by a SaaS LLM, and you sell licenses of your game for $30, but for some reason your game does really, really well and people play the hell out of it, you're essentially hoping that the average play time per player is going to incur less AI overhead cost than the $30 price point. That's a tough spot to be in, incentive wise: You will want people to buy your game, but then play it as little as possible: that's how you maximize your profits. Bad strategy. The alternative is to charge players a monthly subscription fee, but what player would realistically want to do that just because you decided to go with a SaaS LLM? What if multiple games did that? If you have 150 games in your steam library and each one wanted to charge you a $10/mon subscription to play, how many games would you actively play? Very few!

The correct solution is to look for a different AI framework which doesn't use a SaaS based LLM. Finite state machines have been tried and true and work great for the majority of games. There's also some alternative forms of machine learning and machine intelligence frameworks. Check out GOAP or the radiance AI system, and the AI used by games like F.E.A.R.

JoeJ
JoeJ

Calin wrote:

Human mind doesn't do pathfinding yet it is still able to play a Starcraft game.

Ofc. human mind does path finding. You just don't notice you're brain working hard because Starcraft levels are far from a difficult labyrinth. But you can solve labyrinths too.

Calin wrote:

The only requirement the AI needs to meet is the ability of telling if a tile is reachable.

Which requires path finding. Not necessarily the shortest path, but some path. Personally i typically use a floodfill algorithm for that.
Ofc. you can make your AI more human or ML alike, by allowing error. It would look at the tile and its surrounding map, compare it to similar situation it has already seen, and then it would answer 'The tile is probably reachable'.
Eventually this process is faster than pathfinding, and likely it gives more human alike behavior.
But then your game needs to deal with related errors. E.g. by informing the AI 'you were wrong and now we are stuck'.
Which means your game needs to be much smarter than before, when you neither had words nor errors.

I expect you'll give up at some point on chatbots. But that's just me, and learning from our own failures isn't bad anyway.
I'm not sure what your goals and expectations are regarding chatbot in an RTS. But if it's more human alike behavior, or maybe the ability to learn from former matches, no matter what - it might be easier to work on just that and directly. But introducing human language seems not necessary.

JoeJ
JoeJ

slayemin wrote:

which have 200+ units, and they all have to get processed at 30hz. An LLM just won't be fast enough.

slayemin wrote:

5) LLMs cost money! Lots of money.

How is it if we consider a more realistic scenario. Thinking of some future MMO, which merges RPG and RTS, and uses LLM for dynamic quests and dialogue with NPCs. Maybe there is some generative content as well.
The LLM runs locally on the servers, and is not a paid service.

The other scenario is the same but single player.
The LLM runs locally on PC or console.
Or, if HW specs are just too high, we make it an always online game to query the LLM blah from our servers.

Not knowing anything about AI, how realistic are those scenarios?

Calin
Calin


This is the source code for my to be game player chatbot. The basic idea is that the chatbot breaks down what needs to be done in smaller pieces using some general directives as a starting point. The main tasks are being split into smaller ones repeatedely until a conclusion can be used for an order that the test game can understand.


#include <Windows.h>
#include <iostream>
#include <vector>
#include <strsafe.h>

enum class WordName
{
    You,
    Win,
    AGame,
    By,
    If,
    TravelTo,
    Open,
    Exit,
    HowDo,
    Tile,
    Default

};
enum class SpeechElem
{
    Subject,
    Predicate,
    SubjectCont,
    SubjectContAtr,
    Subject2,
    Predicate2,
    SubjectCont2,
    SubjectCont2Atr,
    QuestionType,
    Condition,
    Default
};
struct Word
{
    WordName Name;
    WordName CorespToQ;
    SpeechElem SpeechE;
    char Text[26];


};
struct Sentence
{
    std::vector<Word> Content;
};
void BuildAnswer(Sentence* Question, Sentence* Answer);
void BuildSentence(WordName Name, SpeechElem Element, WordName corespToQ, Sentence* sentence);
void BldQFromA(Sentence* Answer, Sentence* ResultQ);
WordName GetSubjectCont(Sentence* sentence, int count);
WordName GetPredicate(Sentence* sentence, int count);
WordName GetSubjectContAtr(Sentence* sentence, int count);

std::vector<Sentence*> Sentences;
int main()
{
    
   
    Sentence* FirstQuestion = new Sentence;
    BuildSentence(WordName::HowDo,SpeechElem::QuestionType,WordName::Default,FirstQuestion);
    BuildSentence(WordName::You, SpeechElem::Subject, WordName::Default, FirstQuestion);
    BuildSentence(WordName::Win, SpeechElem::Predicate, WordName::Default, FirstQuestion);
    BuildSentence(WordName::AGame, SpeechElem::SubjectCont, WordName::Default, FirstQuestion);
    
    
    
    Sentence* Directive = new Sentence();

    BuildSentence(WordName::You, SpeechElem::Subject, WordName::Default, Directive);
    BuildSentence(WordName::Win, SpeechElem::Predicate, WordName::Default, Directive);
    BuildSentence(WordName::AGame, SpeechElem::SubjectCont, WordName::Default, Directive);
    BuildSentence(WordName::By, SpeechElem::Condition, WordName::HowDo, Directive);
    BuildSentence(WordName::You, SpeechElem::Subject2, WordName::Default, Directive);
    BuildSentence(WordName::TravelTo, SpeechElem::Predicate2, WordName::Default, Directive);
    BuildSentence(WordName::Exit, SpeechElem::SubjectCont2Atr, WordName::Default, Directive);
    BuildSentence(WordName::Tile, SpeechElem::SubjectCont2, WordName::Default, Directive);
    Sentences.push_back(Directive);

    Sentence* Directive2 = new Sentence();

    /*BuildSentence(WordName::You, SpeechElem::Subject, WordName::Default, Directive);
    BuildSentence(WordName::Win, SpeechElem::Predicate, WordName::Default, Directive);
    BuildSentence(WordName::AGame, SpeechElem::SubjectCont, WordName::Default, Directive);
    BuildSentence(WordName::If, SpeechElem::Condition, WordName::HowDo, Directive);
    BuildSentence(WordName::You, SpeechElem::Subject2, WordName::Default, Directive);
    BuildSentence(WordName::TravelTo, SpeechElem::Predicate2, WordName::Default, Directive);
    BuildSentence(WordName::Open, SpeechElem::SubjectCont2Atr, WordName::Default, Directive);
   */// BuildSentence(WordName::ExitGate, SpeechElem::SubjectCont2, WordName::Default, Directive);
    Sentences.push_back(Directive);


    for (int ir = 0; ir < Sentences.size(); ir++)
    {
        BuildAnswer(FirstQuestion, Sentences.at(ir));
    }
    
    std::cout << "Hello World!\n";
}
void BuildSentence(WordName Name, SpeechElem Element,WordName corespToQ, Sentence * sentence)
{
    Word word;
    word.Name = Name;
    word.CorespToQ = corespToQ;
    word.SpeechE = Element;
    
    if (Name == WordName::You)
    {
        
        StringCchPrintfA(word.Text, 18, "You");
    }
    if (Name == WordName::Win)
    {
        StringCchPrintfA(word.Text, 18, "Win");
    }
    if (Name == WordName::AGame)
    {
        StringCchPrintfA(word.Text, 18, "AGame");
    }
    if (Name == WordName::If)
    {
        StringCchPrintfA(word.Text, 18, "If");
    }
    if (Name == WordName::By)
    {
        StringCchPrintfA(word.Text, 18, "By");
    }
    if (Name == WordName::TravelTo)
    {
        StringCchPrintfA(word.Text, 18, "TravelTo");
    }
    if (Name == WordName::Open)
    {
        StringCchPrintfA(word.Text, 18, "Open");
    }
    if (Name == WordName::Exit)
    {
        StringCchPrintfA(word.Text, 18, "Exit");
    }
    if (Name == WordName::Tile)
    {
        StringCchPrintfA(word.Text, 18, "Tile");
    }
    if (Name == WordName::HowDo)
    {
        StringCchPrintfA(word.Text, 18, "HowDo");
    }

   
    sentence->Content.push_back(word);
}

void BuildAnswer(Sentence* Question, Sentence* Answer)
{
    std::vector<Sentence*> TempCandidat;
    if (Question->Content.at(0).Name == WordName::HowDo)
    {
        for (int y = 0; y < Sentences.size(); y++)
        {
            for (int x = 0; x < Sentences.at(y)->Content.size(); x++)
            {
                if (Sentences.at(y)->Content.at(x).Name == WordName::By)
                {
                    TempCandidat.push_back(Sentences.at(y));
                }
            }
        }
    }
    std::cout << "TempCandid is size:" << TempCandidat.size();
    for (int y = 0; y < TempCandidat.size(); y++)
    {
        for (int x = 0; x < TempCandidat.at(y)->Content.size(); x++)
        {
            
            WordName Wrd = GetPredicate(TempCandidat.at(y),1);

            WordName Wrd1 = GetPredicate(Question,1);

            if (Wrd == Wrd1)
            {
                WordName Wrd2 = GetSubjectCont(TempCandidat.at(y),1);
                WordName Wrd3 = GetSubjectCont(Question,1);
                if (Wrd2 == Wrd3)
                {
                    for (int ir = 0; ir < Question->Content.size(); ir++)
                    {
                        std::cout << Question->Content.at(ir).Text  << " ";
                    }

                    std::cout << "     ";
                    for (int ir = 0; ir < TempCandidat.at(y)->Content.size(); ir++)
                    {
                        std::cout << TempCandidat.at(y)->Content.at(ir).Text << " ";
                    }
                     
                    BldQFromA(TempCandidat.at(y),Question);
                    std::cout << "     ";
                    for (int ir = 0; ir < Question->Content.size(); ir++)
                    {
                        std::cout << Question->Content.at(ir).Text << " ";
                    }
                }

            }

            /*if ((TempCandidat.at(y).Content.at(x).SpeechE == SpeechElem::Predicate)&&(TempCandidat.at(y).Content.at(x).Name)
            {
                if (TempCandidat.at(y).Content.at(x+1).SpeechE == SpeechElem::SubjectCont)
                {

                }

            }*/
        }
        
    }
    

}
void BldQFromA(Sentence * Answer, Sentence * ResultQ)
{
    ResultQ->Content.clear();
    BuildSentence(WordName::HowDo, SpeechElem::QuestionType, WordName::Default, ResultQ);
    BuildSentence(WordName::You, SpeechElem::Subject, WordName::Default, ResultQ);
    BuildSentence(GetPredicate(Answer,2), SpeechElem::Predicate, WordName::Default, ResultQ);
    BuildSentence(GetSubjectContAtr(Answer, 2), SpeechElem::SubjectCont2Atr, WordName::Default, ResultQ);
    BuildSentence(GetSubjectCont(Answer,2), SpeechElem::SubjectCont, WordName::Default, ResultQ);

}
WordName GetPredicate(Sentence * sentence,int count)
{
    for (int y = 0; y < sentence->Content.size(); y++)
    {
        if (count == 1)
        {
            if (sentence->Content.at(y).SpeechE == SpeechElem::Predicate)
            {
                return sentence->Content.at(y).Name;
            }
        }
        else
            if (sentence->Content.at(y).SpeechE == SpeechElem::Predicate2)
            {
                return sentence->Content.at(y).Name;
            }

    }
}
WordName GetSubjectCont(Sentence* sentence, int count)
{
    for (int y = 0; y < sentence->Content.size(); y++)
    {
        if (count == 1)
        {
            if (sentence->Content.at(y).SpeechE == SpeechElem::SubjectCont)
            {
                return sentence->Content.at(y).Name;
            }
        }
        else
            if (sentence->Content.at(y).SpeechE == SpeechElem::SubjectCont2)
            {
                return sentence->Content.at(y).Name;
            }

    }
}
WordName GetSubjectContAtr(Sentence* sentence, int count)
{
    for (int y = 0; y < sentence->Content.size(); y++)
    {
        if (count == 1)
        {
            if (sentence->Content.at(y).SpeechE == SpeechElem::SubjectContAtr)
            {
                return sentence->Content.at(y).Name;
            }
        }
        else
            if (sentence->Content.at(y).SpeechE == SpeechElem::SubjectCont2Atr)
            {
                return sentence->Content.at(y).Name;
            }

    }
}


The output looks like this:


My project`s facebook page is “DreamLand Page”
Calin
Calin

Ofc. human mind does path finding

Yes but it will not be Dijkstra or A Star. No one is 100% sure what takes place in the mind of a human being but it is unlikely that the human mind uses A Star. The human eye can not distinguish the boundaries between individual tiles if the tiles have the same color or texture. You can't tell for instance if two units are on the same x coordinate on the map if they are some distance apart. We use horizontal color strips or underlines on paper as aids when we have same line expressions or digits with empy space in between. A human can not "download" the array of tiles that makes the map.
Such precise information is unavailable. We don't have a "port" to exchange data with the surrounding world. Our only interface is the eye (and years). The "AI" algorithms in our brain are 100% visual recognition driven. Patches of this patches of that. Empty space patches of different shapes, water patches, building patches, unit patches.

It would look at the tile and its surrounding map, compare it to similar situation it has already seen, and then it would answer 'The tile is probably reachable'.

Experience counts in AI (you can make it count) but I don't think you can use for path finding. In the example you come up with you would have to scan all the particularities of the area. That way you may tell if it matches or not something you have seen previously. But if you understand the area that automatically mean you know if it contains a path or not.
A path in human terms is a continuous patch of land of the same color or texture. One way to do it when you're looking for a path in a RTS game is you start from both ends and the same time and advance a bit from one end towards the other then you jump on the other end and advance a bit towards the first one. You do this repeatedly until the ends meetup. This is how I proceed. The reason you would proceed this way is because if one lead turns right you're expecting the other lead to turn right sooner or later as well (let say the ends are on the same x coordinate). That's how you solve the most basic pathfinding problem when you have two ends and an obstacle in between. You can start from one end and keep advancing on the first lead but if you meet a fork in the path down the way you can't tell which branch is the best you would have to make a random choise. Simplicity is the rule complexity is the exception. If the path leading from one end goes in one direction it's more likely that you will come back from that direction on the other end.

I expect you'll give up at some point on chatbots.

I can't believe you're trying to discourage me )))
But seriousely, I might give up. The chat bot tech is different from the RTS code. The test game I plan to use for the chatbot is not a RTS, that's, again, a very different and unfamiliar perspective. However. I'm sure our mind works like a chatbot when it plays a game. Of course it's more than a chatbot but the chatbot is a part of it (it works based on an algorithm but it's not a c++ algorithm of course). The chatbot direction is promising imo. A compromise would be to use the chatbot for a RTS but it's a tremendeous undertaking. It's likely that the chat bot will become a low priority project, I will put it aside and get back to it when my RTS project gets cold.

But that's just me, and learning from our own failures...

If I give up I would not label what I did so far with the word "failure". I've learned and got better at some things (like using chars for instance).

Even if the test game is not a RTS it helps me understand what is the way forward in the RTS project. Simulations in my RTS project are very very slow and bulky, it's so slow to the point that I loose all concentration and interest. I`m not a very good programmer I'm not good a complicated things therefor I was unable to speed things up. I mentioned this before the game becomes unstable if I use a larger time step variable. But now I know what has to be done, it's not complicated.

My project`s facebook page is “DreamLand Page”
JoeJ
JoeJ

Calin wrote:

Yes but it will not be Dijkstra or A Star. No one is 100% sure what takes place in the mind of a human being but it is unlikely that the human mind uses A Star.

I disagree, thinking human maze solving works in the same way than those those algorithms do.
I mean, it's hard for a human to remember all the branches already visited of course, but we still try and when we come back from failure we try to take another ranch next time. And if we do it on paper, we can use a pen, making memorizing trivial.
The primary difference is maybe: Humans try to follow the whole path til reaching the goal or not. And on failure they go back to a former branch and try another.
Contrary, the algorithm keeps track of all potential paths, expanding each by one step per iteration, starting with the most promising one, or expanding the one which adds the least distance to any path. This is an optimization which we can do because computers can remember infinite paths, while we humans can only keep maybe five things in mind at a moment.
But just like A Star, we will use heuristics, e.g. taking the route off a branch which leads towards the target, not away from it.

This principle is what allowed me to learn programming at all. I was thinking 'how would i solve the problem', and then describing those steps in code and data. That's how we all do it i guess, implying computer algorithms are mostly inspired from human thinking.

But notice this also implies we can not implement intelligence with such classic algorithms. Because the intelligent process of problem solving still only happens in our mind. The resulting program is just a manifestation of this thinking process, but could not come up with the solutions on its own.
And i think that's still valid in the modern AI era. ML algorithms only established a way of general learning, and after giving it countless examples, coming up with ways to reward correct over false outcomes, and scaling it up to infinity they finally could reproduce human conversation so closely it passed the Turing test.
I congratulate them. But i still don't think Ilya is a 'genius'. If he would be, he would actually understand how his stuff actually works. But he doesn't, so i doubt his intelligence, and his million dollar paycheck does not convince me otherwise.

You know what? I believe them when they say they have already achieved AGI. Because i fully believe that ChatGPT is already smarter than Ilya or Sam is. But that does not mean it's also smarter than the average human. \:D/

Or, when they say their latest model is so god level intelligent it's actually dangerous and requires care, regulations, and should not be made available to foreign countries. Then i believe this too. Because if it's that smart but still makes no money, than it's indeed dangerous. For the AI companies themselves at least, since we just see them crashing.

Maybe i just lack the ambition about AI like you have. I do not expect to ever write an intelligent program, nor could i ever make something like a convincing chatbot for my NPCs. It's impossible to me, so will just fake intelligence in similar ways games have done before. I also don't think pathfinding requires intelligence, making the term 'game AI' a misnomer anyway. Remember my water example: Flood the labyrinth with water, and it will find the shortest way out. No intelligence at all.

Calin wrote:

A human can not "download" the array of tiles that makes the map. Such precise information is unavailable. We don't have a "port" to exchange data with the surrounding world. Our only interface is the eye (and years).

No. We have sensory organs like eyes, we observe the map, and we can store an imaginary copy in our mind. It's abstracted to a minimum and it may have uncertainties or error, but it still allows us to do imaginary pathfinding of real world scenes just in our mind.

And yes, you can replicate this system in code. To give your Units similar abilities. Even better ones, exact and robust all the time.
And that's what computers can do efficiently, and how games work.
But you can not make a program with general problem solving skills. At least i don't think so.
ChatGPT can do some basic problem solving. But it requires much more power than a human to do so, so it isn't efficient. And it's no written program, but the thing a system of programmed learning abilities has achieved from analyzing human example.
It's the attempt of reproducing the outcome of human intelligence, without trying to understand how human intelligence actually works or what it even is.

Calin wrote:

I can't believe you're trying to discourage me )))

Yeah, i do so by projecting my own former failures on you. You will fail and give up. And then you'll think Joe was right all along, and maybe you should work an making the game playable by a player, instead of trying to make the game understanding human language. ; )

But i don't wanna discourage. Take it as a wager.

Calin wrote:

I'm sure our mind works like a chatbot when it plays a game.

Sounds what you actually think is 'our mind works like a chatbot in general'.
And maybe that's true. Or to some part. Nobody knows.

However, it seems what you want is a game AI that behaves like a human.
But we do not know how human brains work, so your objective definition is incomplete, and thus impossible to achieve.
Imo, you should adapt your philosophy. E.g. by trying to match human behavior specifically, where expected by you.
If you want your AI to do some smart tactic X, work on that specific X. But don't hope for some general method which achieves all your goal without a need to define any X in specific detail.

Calin wrote:

If I give up I would not label what I did so far with the word "failure". I've learned and got better at some things (like using chars for instance).

Yeah, agreed. But my own personality likes to exaggerate in any direction, and admitting 'total failure' just has more punch than whining 'well, at least i have learned some thing'. Also, i think any success comes after some path of failures, and failure is not necessarily a bad thing.

Calin wrote:

therefor I was unable to speed things up.

Learn to use the profiler. It shows which functions take most time. That's helpful in cases where you don't know some single reason for a bottleneck.

If it's the pathfinding an you still use the old code, do some research on A Star.

Also, i'm still laughing about all those RTS classics which still mostly used regular tile grids for the map.
I can't comprehend how the experts at Blizzard could still be fine with that in the 90s. Probably they were just iterating from older stuff and it was fast enough, so they did not want to research alternatives.
It's super slow and inefficient, no matter how hard you optimize.

I have an idea how to make it much faster, by factors of something like 1000. I have not tried yet, but i can explain if you're interested.

slayemin
slayemin

The chatbot direction is promising imo. A compromise would be to use the chatbot for a RTS but it's a tremendeous undertaking. It's likely that the chat bot will become a low priority project, I will put it aside and get back to it when my RTS project gets cold.

I actually did an experiment in this direction a while back which turned out to be pretty fascinating. I had two instances of a ChatGPT agent and gave each of them different context roles.

One was told that it was a weapons merchant in a fantasy RPG and had a bunch of swords, potions, shields, etc. for sale. It lived in a small town, and there was a band of goblins nearby threatening the settlement. It's job was to negotiate the best deal possible with potential customers.

The other AI instance was told that it's an adventurer in a fantasy world looking to purchase arms, armor and equipment from a weapons smith, and it needed to negotiate the best price. The adventurer also had an interest in taking out the nearby goblins threatening the village.

Both agents had a bit of back and forth with each other, and each brought up the goblins as a source of pressure/urgency. The merchant AI and adventurer AI eventually negotiated on a bundled deal between each other and then conducted the transaction. Reading through the transcript was pretty fascinating! None of it was prescripted (obviously).

Where this gets fascinating is that future interactions with NPCs in RPG games could be similar and equally dynamic: you speak into a microphone and try to talk and negotiate different deals with merchants. Obviously, the merchants would need some guard rails to limit the context of the conversation, or otherwise a player could get a merchant AI to devolve into the ethics of microbiology and the effects of macrobiology on climate change (which its capable of, but would be vastly out of scope and immersion breaking). But, I see this as a potential and exciting future! The hard part is figuring out how to do voice acting which sounds believable for a wide cast of characters.

Calin
Calin

I actually did an experiment in this direction

It's very interesting but it also tends to be a rather abstract type of challenge. You can't just write a speech to algoritm type of program if has to be paired to an actual game. If you work at the same time on the game and on your speech processing algorithms you can have tangible results that encourage you to work further. Because it's an abstract challenge you don't even know where to start. My first attempt was to start from winning conditions but how you win a game depends on the type of game. So I thought I need to start from the very basics.

Both agents had a bit of back and forth with each other

In my case "AI to Game World" is just one option per turn, it's one out of 10 possible keys being pressed. "Game World to AI" is a 7x7 pixel 2d grayscale image per turn.

My project`s facebook page is “DreamLand Page”
Calin
Calin

I will describe what I have in mind. When the game starts the AI will recive 10 senteces from the Game World that will look something like the following:
Wdown is an option.
Edown is an option.
etc. What the AI will have to do is to establish what each of the mentioned options does. Inside the game 8 of these keys trigger moving in 8 directions: North, North East, East, South East etc. but the AI doesn't know that he will try the options, read the information sent each turn from the Game World (7x7 pixel grayscale image) and establish patterns. The patterns will be recognized by reading a multidimensional array. I will manually fill in the patterns into the multidimensional array (the array will have more than 3 dimensions) when the AI loads. When first turn arives I will start reading each turn from the "input layer" of the multidimensional array input information and send the it to the Game World. I will use the data in the array that matches the input layer to compare it with the pixels from the Game World 2d image.

My project`s facebook page is “DreamLand Page”
slayemin
slayemin

Calin wrote:

I will describe what I have in mind. When the game starts the AI will recive 10 senteces from the Game World that will look something like the following: Wdown is an option. Edown is an option. etc. What the AI will have to do is to establish what each of the mentioned options does. Inside the game 8 of these keys trigger moving in 8 directions: North, North East, East, South East etc. but the AI doesn't know that he will try the options, read the information sent each turn from the Game World (...

You're going to run into frame rate problems on the AI. If you're running a turn based game, no problem. If you're running a real time game, that's going to be a big problem. You should do some tests to measure the round trip time it takes for an LLM to return a response. You're going to be looking at like +1000ms for a reply.

Let's assume you magically get the technical problems ironed out.

You're also going to be running into business side problems:
-Each AI agent is going to be consuming tokens on an LLM as it plays. Who is going to pay for that? You or the customer? Is the customer willing to pay a subscription?
-What happens if your LLM provider has an outage? Does that mean players can't play their game until its resolved? How do you communicated that to players?

Realistically? Using an LLM for this? It's like trying to cram a round peg through a square hole. It's not what the AI is good at or designed for. You'd get much better mileage out of building local finite state machines, or even using a hybrid between an FSM and an LLM (for dialog) if you absolutely have to. Ask yourself: What added value does using an LLM provide over a FSM here?

Calin
Calin

When it comes to my RTS game I came to the conclusion that you can build AI that is able to force a one time decision from the enemy. But I still don't know how to bridge that decision with further AI behavior down the track. Basically I know how to start but I don't know how to continue. You can have advanced AI that has a list of options the enemy has and force him (the enemy) to adopt one of those options.
When you're in a multiplayer match items on the map and map features generate enemy behavior. Your own actions generate enemy behavior too but there is a problem. What you think about what generates enemy behavior changes in time with more experience gained (after months of playing the game). When you're playing a match you have a virtual enemy in your mind, this virtual enemy explains why things on the map happen the way they happen. When you gain experience the virtual enemy improves you're aware of new plausible taktics the enemy might adopt (you know it because you could employ those taktics yourself). A match with a newbie playing against an advanced player ends with the newbie loosing the match, and when it happens it's a "never know what him em" experience, the newbie doesn't understand whey he lost. It's because the idea of the enemy in his mind matches his own ability. When you are young you're afraid a particular type of action on your behalf automatically leads to negative response from those nearby, after you gain more life experience you gain the confidence that the action in question will most likely be overlooked by a wise person.

My project`s facebook page is “DreamLand Page”

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.