使敌人的AI遵循既定路径

时间:2019-01-01 17:30:14

标签: python-3.x artificial-intelligence

因此,我正在学校为CS项目制作游戏,该项目基于游戏外星人隔离(但自上而下的2D),而且我不确定从外星人的狩猎玩家的方法着手。我很想创建一个神经网络,但是我不确定如何针对我的问题(例如提供给网络的数据等)创建一个神经网络。 我希望外星人遵循在地图上绘制的固定路径,并且基本上能够智能地跟随/追捕玩家,而不会陷入例如路径的死角。

我已经尝试过使用一种简单的算法,该算法根据玩家最近一次已知位置的x和y位置确定所需方向。但是,这导致外星人陷入困境,并且普遍缺乏智能。确实没有任何代码可以查看,因为我需要完全重新考虑这一点,但是查看t =外星人如何检查仅存在上下文的可用路径可能很有用。

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

我知道这是一个很大的问题,但我正在寻找至少如何针对该问题启动神经网络的一些指示。

0 个答案:

没有答案
相关问题