User Tag List

Results 1 to 10 of 10

Thread: AI examples of the like of Nuclear Throne?

  1. #1
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)

    Question AI examples of the like of Nuclear Throne?

    I have been playing some Nuclear Throne recently, and while the game is fairly basic in most areas and I can more or less think how they would have done things and how I could do it myself in Fusion one thing that I have really no idea how to do is the AI. I mean, the AI is not super smart or anything, but it still behaves somewhat "intelligent" by not just charging at the player, but keeping its distance and often even standing behind a wall and not directly in line of sight, backing up sometimes etc. And it seems a bit different with different enemy types etc.
    The game is also random generated so there is no strict "scripting" of how they behave as they need to be able to behave in any kind of map.
    Here are some gameplay: https://www.youtube.com/watch?v=3fJiVmb-vQs

    Now, do anyone know how to do AI like this or know any examples?

  2. #2
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Shouldnt be a problem.

    My guess is such behaviour is based on 2 points of intelligence/ data on the Enemy Agent side.

    #1
    A Direct Line Of Sight to the Player ( adressing the question of 'Is there an Obstacle in the way?' )

    #2
    Distance to Player

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export Module

    Join Date
    Dec 2013
    Posts
    156
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The AI is incredible simple in this game.

    Approach to line of sight:
    You can simply do a one time check per enemy every X milliseconds and look if the distance to the player (use formula) is within range. If that is true let the player create an invisible "beacon" object right on his position. Now let all enemies within range move to that beacon. Have the opponents fire at the real player icon all the time (can be combined with a line of sight check [use extension or formula]). Once the beacon is reached let enemies check again for line of sight. If the player is still in range, repeat everything again. If not then let them return to their spawn point or leave them there (easiest).

  4. #4
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I havent studdies the AI of the game in question in detail, but i made a quick basic top-down Ai example.

    It uses Float X_ and Y_ coordinates for smoother movement.
    It uses Sin() Cos() to move the Enemy Agents forward.

    The Enemies/ Objects in this example are intended as 'Collision Masks' only, but i have applied visual Angles and such to them for better visual understading of whats going on/ what direction they are facing ( this clutters up the code a wee little ).
    Idealy Enemy 'Sprites' aught be positioned ontop of the examples Objects ( if one does not plan on creating manual Animation settings through AltValues, havent done this before but is relatively advanced but doable )

    ...
    AI COMPONENTS

    #1
    Enemy Agents gater 3 pieces og intelligence through calculations: Absolute AngleDifferance between ( A ) Enemys current Angle and ( B ) the Angle from Enemy to Player , Distance from Enemies and Player.

    #2
    Durring certain situations Enemies change to the 'Line Of Sight' animation, which draws a Line between 2 Points by setting ( A ) an Angle and ( B ) the Xscale, Xscale direcltly relating to the Lines length.
    This is done to determine if an Obstacle is blocking the direct Line OF SIght between Enemy and Player.
    So each Enemy Objects successfully acts as both a 'Collision Masks', and a 'Straight Line Of Sight' ( instead of having seperate Objects for each of theese ).

    #3
    Enemies have parameters in AltValues ( SightRadius_ and SightAngle_ ) that determines their "ViewCone".

    ...
    SHORT DESCRIPTION
    Frame1 has just the basic 'follow if within sight' AI applied.
    In Frame2 i have applied a silly very simple AI based on 2 States. Enemies 'catch your scent' first time they detect you, and will stop and wait untill you popp into range if they loose sight after this. This is just to demonstrate how one can use this intelligence to make the Enemy Agens act in different ways.

    ...
    NOTE:
    Ai might b acting abit strange if Agents are located near the Edge of the Frame, this is due to tha fact i made a quite silly method for Frame Edge bouncing for the Enemy Agents ( didnt want to spand time with this ).
    Attached files Attached files

  5. #5
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Vaxx View Post
    The AI is incredible simple in this game.

    Approach to line of sight:
    You can simply do a one time check per enemy every X milliseconds and look if the distance to the player (use formula) is within range. If that is true let the player create an invisible "beacon" object right on his position. Now let all enemies within range move to that beacon. Have the opponents fire at the real player icon all the time (can be combined with a line of sight check [use extension or formula]). Once the beacon is reached let enemies check again for line of sight. If the player is still in range, repeat everything again. If not then let them return to their spawn point or leave them there (easiest).
    I would disagree that it is "incredible simple" until I have seen an example that is even close to this :p

    Thank you King_Cool for making that example, it still seems that the enemies are really not acting in a way that feels like they actually have an intelligence? They just chase the player if they you and then stop if not so it feels very artificial. It might work well if doing a zombie game, even though the enemies should continue to search a bit for the player I think. One thing that really stood out to me in Nuclear Throne was that enemies seem to actually take cover behind walls. They often place themself to have some cover and are not always just standing waiting in open space waiting to be shoot.

  6. #6
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well the point about 'Artificial Intelligence' lies in its word.

    In this case Enemies, have Intelligence ( or lets call it Information from this point ) about the environment or its surroundings.
    The thing that makes an Enemy appear Intelligent is the ability to 'act' based on this 'Information' that it has, and when it does act based on this Information of the environment this it is an act of Artificial Intelligence ( however un-intelligent it may appear ).

    I understand the example i provided does not directly represent the AI of the game in question, and this was not my intention, but the example is rather a springboard for creating designing an AI of your choice.
    The Enemies in the example should have adequate Information about the environment ( DistanceToPlayer, IsPlayerWithinSight, IsThereAnObstacleInTheWay ) to simulate quite advanced AI.
    One can add more Information for the Enemies to act uppon of cource.

    Ill have a quick look at the AI in the video and see if i cant reproduce this behaviour ( maybe it uses pathfindong or somethig also ).

  7. #7
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Thanks King_Cool There always seems to be some random movement of the enemies also that makes them appear less "robotic". I wonder how much random movement is going on though. They don't seem to move completely at random to me at least but having some form of awareness of you as the player and backing up sometimes etc.

  8. #8
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export Module

    Join Date
    Dec 2013
    Posts
    156
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What you see as intelligent in this game is the random pattern the enemies move around, which makes them look like they are smart.

    Of course something like enemy sees player -> chase -> player escapes -> stop looks very crappy and unprofessional. But it is a start from where you can continue. Take my beacon method and let each unit record the way it took so it has a chance to return to is initial position without hugging walls etc. If there is fog of war and the player is way out of range you could simple hae a cheap teleport back routine. Now if the enemy lost you it could randomly check around scouting for you, then return slowly back. They could even set an ambush. If multiple units followed you and then all of the sudden you could hide, make the lightest and fastest enemy sit there as a bait. Now you come back and the enemy notice you and run off so you head afterwards and then when you reach a room with a previous beacon you have the enemies swarm on onto this location. All these behaviors are up to you to program and test and they work for random levels as well. You just need to make sure that when generating your levels you come up with some general room ro room web concept that help units to navigate from one room to another.

    If there is really need for something like this I can put something together and put it into the clickstore.

  9. #9
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually adding randomness to AI makes it appear 'more intelligent' ( like Vaxx said ) when it in fact is being random rather than making any decisions at all.
    For example if you add some random straifing or backstepping to the AI example i made youl probably conclude the Enemy AI is more cunning than it actually is by "dodging" or trying to outmanouver you.
    Im sure you can find articles on Game AI stating more or less the same.

  10. #10
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Vaxx View Post
    What you see as intelligent in this game is the random pattern the enemies move around, which makes them look like they are smart.

    Of course something like enemy sees player -> chase -> player escapes -> stop looks very crappy and unprofessional. But it is a start from where you can continue. Take my beacon method and let each unit record the way it took so it has a chance to return to is initial position without hugging walls etc. If there is fog of war and the player is way out of range you could simple hae a cheap teleport back routine. Now if the enemy lost you it could randomly check around scouting for you, then return slowly back. They could even set an ambush. If multiple units followed you and then all of the sudden you could hide, make the lightest and fastest enemy sit there as a bait. Now you come back and the enemy notice you and run off so you head afterwards and then when you reach a room with a previous beacon you have the enemies swarm on onto this location. All these behaviors are up to you to program and test and they work for random levels as well. You just need to make sure that when generating your levels you come up with some general room ro room web concept that help units to navigate from one room to another.

    If there is really need for something like this I can put something together and put it into the clickstore.
    If you think you can make an example that mimics the AI here I would definitely be interested. Personally I think it is harder then what you say, but I would be very happy to be proven wrong There seems to be different AI behaviours of different enemies though. For example the big "insects" that spout a lot of bullets at the player seem to always back up to be at a safe distance etc.

Similar Threads

  1. Examples
    By gamefreak202 in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 21st May 2016, 09:14 PM
  2. Examples for TGF MMF
    By SpringUp in forum File Archive
    Replies: 8
    Last Post: 12th November 2012, 02:14 PM
  3. Any 3D POV examples?
    By ardo in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 12th February 2012, 07:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •