Making an enemy AI that follows a set path
So I'm making a game for a CS project at school that is based on the game alien isolation (but top down 2D) and I am not sure where to start with the alien's methods of hunting the player. I would quite like to make a neural network however I'm not sure how to make one specific to my problem (e.g. the data given to the network, etc).
I would like the alien to follow a set path that is drawn on the map and essentially be able to intelligently follow/hunt the player without getting stuck at a dead end on the path for example.
I've already tried messing around with a simple algorithm which based the desired direction on x and y positions of the last known position of the player. But this lead to the alien getting stuck and being generally unintelligent. There's not any code to look at really because I need to completely rethink this, but it might be useful seeing t=how the alien checks whats paths are available, just for context.
def navigate(self, player, window):
available =
nodes = [node_pos1, node_pos2, node_pos3, node_pos4]
//nodes are the points just around the center of the alien which..
//..detect the colour to check for available paths
for node_no in range(len(nodes)):
// checks the colour at each node
if Graphics.get_at(background, nodes[node_no]) == (0, 255, 0, 255):
available.append(self.direction_index[node_no])
if not available: // if no paths, it will find the nearest path
self.find_path()
self.sight(player, window) // looks for player
speed = self.speeds[self.status] // sets the speed
self.status(available, speed) // runs the move type
I understand this is quite a big ask but I'm looking for some pointers of how to start a neural network for this problem at the very least.
python-3.x artificial-intelligence
add a comment |
So I'm making a game for a CS project at school that is based on the game alien isolation (but top down 2D) and I am not sure where to start with the alien's methods of hunting the player. I would quite like to make a neural network however I'm not sure how to make one specific to my problem (e.g. the data given to the network, etc).
I would like the alien to follow a set path that is drawn on the map and essentially be able to intelligently follow/hunt the player without getting stuck at a dead end on the path for example.
I've already tried messing around with a simple algorithm which based the desired direction on x and y positions of the last known position of the player. But this lead to the alien getting stuck and being generally unintelligent. There's not any code to look at really because I need to completely rethink this, but it might be useful seeing t=how the alien checks whats paths are available, just for context.
def navigate(self, player, window):
available =
nodes = [node_pos1, node_pos2, node_pos3, node_pos4]
//nodes are the points just around the center of the alien which..
//..detect the colour to check for available paths
for node_no in range(len(nodes)):
// checks the colour at each node
if Graphics.get_at(background, nodes[node_no]) == (0, 255, 0, 255):
available.append(self.direction_index[node_no])
if not available: // if no paths, it will find the nearest path
self.find_path()
self.sight(player, window) // looks for player
speed = self.speeds[self.status] // sets the speed
self.status(available, speed) // runs the move type
I understand this is quite a big ask but I'm looking for some pointers of how to start a neural network for this problem at the very least.
python-3.x artificial-intelligence
2
I don't think neural networks are necessary here, just a BFS or giving your aliens some random movement once in a while to "unstuck" them. If you do want to go down the rabbit hole of neural networks here's part 0 of a 10 part series on reinforcement learning in tensorflow - medium.com/emergent-future/…
– Primusa
Jan 1 at 17:35
I agree with @Primusa . But if you still want to use machine learning you might want to consider reading up on NEAT nn.cs.utexas.edu/downloads/papers/stanley.ec02.pdf (Its a different technique to train a network (better 'to create a network that can solve your task') based on evolution, which should suit the problem quite nicely)
– Kanjiu
Jan 1 at 17:50
Okay thank you I'll look into both. It is important that the alien is intelligent as it is the only enemy in the game and it needs to be feared which is why I'm still not sure because making a complex algorithm that seems intelligent enough might be more time consuming in the long run.
– Ben Clothier
Jan 1 at 18:07
You don't really need "artificial intelligence" here, it just needs to look like it. Videogames where the bad guy hunted the good guy have existed long time before neural network could possibly be applied in a reasonable time. You could probably search for the Pacman "scent" antiobject pattern and see if that works in your case.
– ChatterOne
Jan 1 at 21:18
That does sound promising actually thanks. If the alien sees the player it will store the players coordinate at that point to a variable called 'last_detect' so that it knows the position where the player was last seen. My issue is creating something that knows how to use the paths I've marked out and then using that information.
– Ben Clothier
Jan 2 at 19:25
add a comment |
So I'm making a game for a CS project at school that is based on the game alien isolation (but top down 2D) and I am not sure where to start with the alien's methods of hunting the player. I would quite like to make a neural network however I'm not sure how to make one specific to my problem (e.g. the data given to the network, etc).
I would like the alien to follow a set path that is drawn on the map and essentially be able to intelligently follow/hunt the player without getting stuck at a dead end on the path for example.
I've already tried messing around with a simple algorithm which based the desired direction on x and y positions of the last known position of the player. But this lead to the alien getting stuck and being generally unintelligent. There's not any code to look at really because I need to completely rethink this, but it might be useful seeing t=how the alien checks whats paths are available, just for context.
def navigate(self, player, window):
available =
nodes = [node_pos1, node_pos2, node_pos3, node_pos4]
//nodes are the points just around the center of the alien which..
//..detect the colour to check for available paths
for node_no in range(len(nodes)):
// checks the colour at each node
if Graphics.get_at(background, nodes[node_no]) == (0, 255, 0, 255):
available.append(self.direction_index[node_no])
if not available: // if no paths, it will find the nearest path
self.find_path()
self.sight(player, window) // looks for player
speed = self.speeds[self.status] // sets the speed
self.status(available, speed) // runs the move type
I understand this is quite a big ask but I'm looking for some pointers of how to start a neural network for this problem at the very least.
python-3.x artificial-intelligence
So I'm making a game for a CS project at school that is based on the game alien isolation (but top down 2D) and I am not sure where to start with the alien's methods of hunting the player. I would quite like to make a neural network however I'm not sure how to make one specific to my problem (e.g. the data given to the network, etc).
I would like the alien to follow a set path that is drawn on the map and essentially be able to intelligently follow/hunt the player without getting stuck at a dead end on the path for example.
I've already tried messing around with a simple algorithm which based the desired direction on x and y positions of the last known position of the player. But this lead to the alien getting stuck and being generally unintelligent. There's not any code to look at really because I need to completely rethink this, but it might be useful seeing t=how the alien checks whats paths are available, just for context.
def navigate(self, player, window):
available =
nodes = [node_pos1, node_pos2, node_pos3, node_pos4]
//nodes are the points just around the center of the alien which..
//..detect the colour to check for available paths
for node_no in range(len(nodes)):
// checks the colour at each node
if Graphics.get_at(background, nodes[node_no]) == (0, 255, 0, 255):
available.append(self.direction_index[node_no])
if not available: // if no paths, it will find the nearest path
self.find_path()
self.sight(player, window) // looks for player
speed = self.speeds[self.status] // sets the speed
self.status(available, speed) // runs the move type
I understand this is quite a big ask but I'm looking for some pointers of how to start a neural network for this problem at the very least.
python-3.x artificial-intelligence
python-3.x artificial-intelligence
edited Jan 2 at 8:18


sloth
74.6k14128172
74.6k14128172
asked Jan 1 at 17:30


Ben ClothierBen Clothier
1
1
2
I don't think neural networks are necessary here, just a BFS or giving your aliens some random movement once in a while to "unstuck" them. If you do want to go down the rabbit hole of neural networks here's part 0 of a 10 part series on reinforcement learning in tensorflow - medium.com/emergent-future/…
– Primusa
Jan 1 at 17:35
I agree with @Primusa . But if you still want to use machine learning you might want to consider reading up on NEAT nn.cs.utexas.edu/downloads/papers/stanley.ec02.pdf (Its a different technique to train a network (better 'to create a network that can solve your task') based on evolution, which should suit the problem quite nicely)
– Kanjiu
Jan 1 at 17:50
Okay thank you I'll look into both. It is important that the alien is intelligent as it is the only enemy in the game and it needs to be feared which is why I'm still not sure because making a complex algorithm that seems intelligent enough might be more time consuming in the long run.
– Ben Clothier
Jan 1 at 18:07
You don't really need "artificial intelligence" here, it just needs to look like it. Videogames where the bad guy hunted the good guy have existed long time before neural network could possibly be applied in a reasonable time. You could probably search for the Pacman "scent" antiobject pattern and see if that works in your case.
– ChatterOne
Jan 1 at 21:18
That does sound promising actually thanks. If the alien sees the player it will store the players coordinate at that point to a variable called 'last_detect' so that it knows the position where the player was last seen. My issue is creating something that knows how to use the paths I've marked out and then using that information.
– Ben Clothier
Jan 2 at 19:25
add a comment |
2
I don't think neural networks are necessary here, just a BFS or giving your aliens some random movement once in a while to "unstuck" them. If you do want to go down the rabbit hole of neural networks here's part 0 of a 10 part series on reinforcement learning in tensorflow - medium.com/emergent-future/…
– Primusa
Jan 1 at 17:35
I agree with @Primusa . But if you still want to use machine learning you might want to consider reading up on NEAT nn.cs.utexas.edu/downloads/papers/stanley.ec02.pdf (Its a different technique to train a network (better 'to create a network that can solve your task') based on evolution, which should suit the problem quite nicely)
– Kanjiu
Jan 1 at 17:50
Okay thank you I'll look into both. It is important that the alien is intelligent as it is the only enemy in the game and it needs to be feared which is why I'm still not sure because making a complex algorithm that seems intelligent enough might be more time consuming in the long run.
– Ben Clothier
Jan 1 at 18:07
You don't really need "artificial intelligence" here, it just needs to look like it. Videogames where the bad guy hunted the good guy have existed long time before neural network could possibly be applied in a reasonable time. You could probably search for the Pacman "scent" antiobject pattern and see if that works in your case.
– ChatterOne
Jan 1 at 21:18
That does sound promising actually thanks. If the alien sees the player it will store the players coordinate at that point to a variable called 'last_detect' so that it knows the position where the player was last seen. My issue is creating something that knows how to use the paths I've marked out and then using that information.
– Ben Clothier
Jan 2 at 19:25
2
2
I don't think neural networks are necessary here, just a BFS or giving your aliens some random movement once in a while to "unstuck" them. If you do want to go down the rabbit hole of neural networks here's part 0 of a 10 part series on reinforcement learning in tensorflow - medium.com/emergent-future/…
– Primusa
Jan 1 at 17:35
I don't think neural networks are necessary here, just a BFS or giving your aliens some random movement once in a while to "unstuck" them. If you do want to go down the rabbit hole of neural networks here's part 0 of a 10 part series on reinforcement learning in tensorflow - medium.com/emergent-future/…
– Primusa
Jan 1 at 17:35
I agree with @Primusa . But if you still want to use machine learning you might want to consider reading up on NEAT nn.cs.utexas.edu/downloads/papers/stanley.ec02.pdf (Its a different technique to train a network (better 'to create a network that can solve your task') based on evolution, which should suit the problem quite nicely)
– Kanjiu
Jan 1 at 17:50
I agree with @Primusa . But if you still want to use machine learning you might want to consider reading up on NEAT nn.cs.utexas.edu/downloads/papers/stanley.ec02.pdf (Its a different technique to train a network (better 'to create a network that can solve your task') based on evolution, which should suit the problem quite nicely)
– Kanjiu
Jan 1 at 17:50
Okay thank you I'll look into both. It is important that the alien is intelligent as it is the only enemy in the game and it needs to be feared which is why I'm still not sure because making a complex algorithm that seems intelligent enough might be more time consuming in the long run.
– Ben Clothier
Jan 1 at 18:07
Okay thank you I'll look into both. It is important that the alien is intelligent as it is the only enemy in the game and it needs to be feared which is why I'm still not sure because making a complex algorithm that seems intelligent enough might be more time consuming in the long run.
– Ben Clothier
Jan 1 at 18:07
You don't really need "artificial intelligence" here, it just needs to look like it. Videogames where the bad guy hunted the good guy have existed long time before neural network could possibly be applied in a reasonable time. You could probably search for the Pacman "scent" antiobject pattern and see if that works in your case.
– ChatterOne
Jan 1 at 21:18
You don't really need "artificial intelligence" here, it just needs to look like it. Videogames where the bad guy hunted the good guy have existed long time before neural network could possibly be applied in a reasonable time. You could probably search for the Pacman "scent" antiobject pattern and see if that works in your case.
– ChatterOne
Jan 1 at 21:18
That does sound promising actually thanks. If the alien sees the player it will store the players coordinate at that point to a variable called 'last_detect' so that it knows the position where the player was last seen. My issue is creating something that knows how to use the paths I've marked out and then using that information.
– Ben Clothier
Jan 2 at 19:25
That does sound promising actually thanks. If the alien sees the player it will store the players coordinate at that point to a variable called 'last_detect' so that it knows the position where the player was last seen. My issue is creating something that knows how to use the paths I've marked out and then using that information.
– Ben Clothier
Jan 2 at 19:25
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53997500%2fmaking-an-enemy-ai-that-follows-a-set-path%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53997500%2fmaking-an-enemy-ai-that-follows-a-set-path%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
I don't think neural networks are necessary here, just a BFS or giving your aliens some random movement once in a while to "unstuck" them. If you do want to go down the rabbit hole of neural networks here's part 0 of a 10 part series on reinforcement learning in tensorflow - medium.com/emergent-future/…
– Primusa
Jan 1 at 17:35
I agree with @Primusa . But if you still want to use machine learning you might want to consider reading up on NEAT nn.cs.utexas.edu/downloads/papers/stanley.ec02.pdf (Its a different technique to train a network (better 'to create a network that can solve your task') based on evolution, which should suit the problem quite nicely)
– Kanjiu
Jan 1 at 17:50
Okay thank you I'll look into both. It is important that the alien is intelligent as it is the only enemy in the game and it needs to be feared which is why I'm still not sure because making a complex algorithm that seems intelligent enough might be more time consuming in the long run.
– Ben Clothier
Jan 1 at 18:07
You don't really need "artificial intelligence" here, it just needs to look like it. Videogames where the bad guy hunted the good guy have existed long time before neural network could possibly be applied in a reasonable time. You could probably search for the Pacman "scent" antiobject pattern and see if that works in your case.
– ChatterOne
Jan 1 at 21:18
That does sound promising actually thanks. If the alien sees the player it will store the players coordinate at that point to a variable called 'last_detect' so that it knows the position where the player was last seen. My issue is creating something that knows how to use the paths I've marked out and then using that information.
– Ben Clothier
Jan 2 at 19:25