Volume: 2 Issue: 2 April 2017
1
Run N Defend – A Game Developed
Using Artificial Intelligence Which Works On
Path Finding Algorithm
Vikas Prasad, Amit Rawat, Raghita Surve, Anshu Kumar, Prof. Sumit Harale
[email protected], [email protected], [email protected], Computer Department,
Indira College of Engineering and Management,Pune, India
Abstract: Artificial Intelligence is the central part of game development. Artificial Intelligence states to the technique used in computer and games to generate the magic of intelligence in the performance of NPC (non-player character). Playing games is a part of entertainment. They provide forward-thinking, current test-beds for developing numerous ideas and systems that are beneficial elsewhere. Advanced skills enable the awareness of game ideas that previously only could be applied through significant effort. We have implemented A Star Algorithm is a way to find the shortest path for the enemy player (Heliboy) in order to target the user (Robot). Opponents would be stopping the User Player to complete the Game. AI is even used to simulate the real-world properties in the game.
Keywords: artificial intelligence, games, NPC, pathfinding, A star algorithm
1. INTRODUCTION
Gaming industry has perceived a tremendous growth in the marketplace. Commencement with simple games like Pong and Pac-Man, which offered players a undersized escape from actuality, and increasing into such involved games like WOW and COD, which are serious relaxations to those that play them. Artificial Intelligence in computer has evolved in many forms to meet the test and also making an adaptive foil for the actor that can match their moves and boost robot progress is no guileless task.
What Is AI for Games?
Artificial Intelligence, at its most straightforward level, consists of matching the actions of other players or the entities (that is, all the modules of the game that can react or be reacted upon-from actors to
missiles to health pickups) they represent. The main thing here is that the real life behavior is replicated. In other words, Artificial Intelligence in gaming is making the game more realistic.
The Purpose of AI in Games
AI can have multiple forms in gaming. AI can be an all-purpose set of instructions used to administrate the performance of entities in the game domain. We can also have pre-scripted events that entities follow a type of AI. The complexities of the system increases the level of Artificial intelligence.
We have used pathfinding is a multifaceted problem, which requires study and modification. Another issue that we face in Ai is performance. Non-Player Character (NPC) had restricted predefined path therefore restrictive functionality of the game. AI offers the ability to copycat the real-world understanding in gaming.
2. Literature Survey
In the paper that we have referred, the authors have provided a survey of the existing architectures for general-purpose agents in games. The present work offers an extended analysis based on the performance comparison, stressing the importance of developing general game agents and the innovative component of deep strengthening learning. The authors impound that development of general game agents is a difficult task. However, it contributes directly to the implementation of general-purpose agents capable of accomplishing complex tasks with a high level of abstraction. [1]
Volume: 2 Issue: 2 April 2017
2
such as Artificial Neural Networks and Genetic Algorithms can be used to enhance an agent’s ability to handle pathfinding in real-time. [2]
The paper combines the use of the A* Algorithm with the occupancy grid technique to allow Non-Playable Characters to build their own representation of the environment and plan paths based on this information. The paper demonstrates the application of the approach and shows a range of testing and its limitations. In terms of computational requirements, the system was able to efficiently navigate the environment the author concluded that the system performs to a good standard in terms of computational processing. [3]
The paper suggests a method to the problem of planning the AI procedures for brainy computer wargame enemies. It is hoped that the scheme will allow the efficient, or at least feasible, execution of opponents, which are capable of communicating strategy, rather than behaving predictably according to fixed sets of simple rules. [4]
The author in their research proposes two principles. It proposes comparison quickness, intelligence and effectiveness of about seven path-finding algorithms, which is principle algorithm, are familiar. These algorithms used in computer Gaming extensively as follows DFS, Iterative Deepening, BFS , Dijkstra’s Algorithm, Best First Search, A-Star Algorithm (A*), Iterative Deepening A*. Its author has described A* Algorithm as a smooth pathway than Depth Direction A* algorithm. A* can calculate obstruction before processed and promises expend node less than Depth Direction A* algorithm. [5]
Two adaptive algorithms use reinforcement learning and evolutionary computation to improve player satisfaction by scaling the difficulty of the game AI while the game is being played. Those two adaptive algorithms are, AUC and ADC It has also been observed that while the AUC had a smaller memory footprint, the ADC is able to maintain a lower
number of drawn games which may help to reduce player efforts. Both proposed adaptive algorithms are able to automatically learn suitable sets of behavior components to match the different opponents in terms of mean score and winning percentage. Also, both proposed adaptive algorithms are able to generalize well to a variety of opponents. [6]
The authors describe an approach to player-centered game design through adaptive game technologies. In particular, they have focused on three areas of related research: understanding players, modelling players, and adaptive game technology. The paper proposes an approach through which a game developer can make a more conscious effort to model players in a games design and development. By adopting a framework similar to the one that authors have suggested, a game may be designed to be more responsive to a wider range of players by incorporating dynamic models of different players into the game technology. [7]
New data structures, heuristics and algorithms for fast path finding have been described and tested. The author has showed that maintaining an array of stacks enables A* to be faster than usual implementations of A* that use a priority queue. The paper presents some optimizations of IDA* and A* in maps for pathfinding. The paper uncovers a problem related to the non-expansion of dead-ends for sub-optimal IDA*, and have provided a way to repair it. [8] The paper presents the deficiency of standard A * algorithm, because standard A* algorithm may detour in the search process, an improved A* algorithm is proposed which increases a father pointer for each node. It can effectively solve the problem by keep back according to each father node after searching, that ensures the resulting is optimal path. [9]
3. System Architecture
Below figure shows the system architecture:
Module Details:
Volume: 2 Issue: 2 April 2017
3
Here, we will monitor the key pressed and released by the user. Keys for the movement of sprites. Like UP, DOWN, LEFT, RIGHT. According to that we will perform the action to the sprite.
3.2. Enter the Robot
This is the main player in the game. Firing the bullets, Movements, jump all these functionalities would be considered while making the robot. Adding the score, killing the enemy and gravity would be considered.
3.3. Background and Sprites
Background would be added. Sprites would be loaded and Enemy Movements towards the Player will be done in this module.
3.4. Adding Enemies
Enemy will be added as per the movement of the player in the game. Enemy will have the power of firing the bullets towards the player. In this module A* Algorithm will be implemented. Here we will find the shortest path to reach the Player.
3.5. Shooting Bullets
This module deals with firing the bullets from the NPC and the player.
3.6. Animation
To provide reality to the sprite we would be using this module. Where movements would be made realistic.
3.7. Panting the Tile Map
Automatic creation of the background with respect to player’s movement. Tiles would be added as per the requirement.
4. Mathematical Model
Let S be the Whole system, which consists: S= {ST, IP, OP, SC, SF}
Start:
ST → Load the Menu ST = {START}
Input:
IP → is the input to the system. IP = {u, ◄, ►, ▲, ▼, Spacebar} Where,
u → User
Volume: 2 Issue: 2 April 2017
4
Output:
OP → is the output of the system. OP = {◄’, ►’, ▲’, ▼’, Spacebar’} Where,
◄’ → Sprite Left Movement ►’ → Sprite Right Movement ▲’ → Sprite Up Movement ▼’ → Sprite Down Movement Spacebar’ → Sprite Jump
Success:
Displaying of the result of player’s performance. Successful updating of difficulty.
Failure:
Crashes with the crowding of enemies. Multiple functional operations at instance.
5. Algorithms Used
1. Setup environment and Initiate starting point.
2. Take input from the user 3. Execute run-up module. 4. Generate enemies over-time.
5. If the player survives the level then, increase level
6. And Goto 1, else 7. Game over.
A* Algorithm
OPEN //nodes to be calculated,
CLOSED //nodes that have already been calculated, add the start node to OPEN
loop
current = node in OPEN with the lowest f_cost remove current from OPEN
add current to CLOSED
if current is the target node //path has been found return
For each neighbor of the current node
if neighbor is not traversable or neighbor is in CLOSED
skip to the next neighbor
if new path to neighbor is shorter OR neighbor is not in OPEN
set f_cost of neighbor
set parent of neighbor to current if neighbor is not in OPEN add neighbor to OPEN
6. Conclusion
AI can be incredible tool for enhancing gaming experience. AI is going to be the major force behind game innovation in future. The field of AI is a complex area of research. AI for games takes on divergent forms subject on the needs of the game planned, oscillating from simple sets of rules for computer-controlled entities to more innovative adaptive systems. However, it is not an impossible challenge. A* accounts for 90% of the games for AI. Games are benefit to making strong AI, which includes controlled environment to test theories
7. References
[1] Ionel-Alexandru.H, Andrea Urzica,” Comparative Analysis of Existing Architectures for General Game Agents”, 17th International Symposium for Scientific Computing, 2016.
[2] Ross Graham, Hugh McCabe, Stephen Sheridan,” Pathfinding in Computer Games,” The ITB Journal, Vol. 4: Iss. 2, 2003.
[3] John Stamford, A.S.Khuman, Jenny Carter & Samad Ahmadi, “Pathfinding in partially explored games environments,” De Montfort University Leicester, United Kingdom, 2014. [4] http://www-cs-students.stanford.edu/
amitp/Articles/HierarchalAI.html
[5] Krisana Chinnasarn and Khammapun Khantanapoka, “Pathfinding of 2D & 3DGame Real-Time Strategy with help of Depth Direction A*Algorithm for Multi-Layer,” 8th International NLP Symposium, 2009.
Volume: 2 Issue: 2 April 2017
5
transactions on Computational Intelligence and AI in games, 2011.
[7] Darryl Charles, Michaela Black, Adrian Moore, Karl Stringer, Michael McNeill, Moira McAlister, Julian Kcklich, Aphra Kerr, “Player-Centered Game Design: Player Modelling and Adaptive Digital Games,” Computing and Information Engineering, University of Ulster, Northern Ireland, 2005. [8] Tristan Cazenave, “Optimizations of data
structures, heuristics and algorithms for path-finding on maps”: Calibration-free localization using relative distance estimations,” Toronto University.
[9] Xuefang Wu, Shogun Zhang, “The Study and Application of Artificial Intelligence Pathfinding Algorithm in Game Domain,” Beijing Jiao tong University Beijing, China, 2011.
[10]R. S. Pressman, Software Engineering (Third Edition.): A Practitioner’s Approach. New York, NY, USA: McGraw-Hill, Inc., 1992. [11]P. Kulkarni, Knowledge Innovation Strategy.