{"author_link":"\/users\/rodel77","author_name":"rodel77","author_uid":"rodel77","comments":[],"epoch":1512530741,"event":"LD40","format":"md","ldjam_node_id":69206,"likes":0,"metadata":{"p_key":"106205","p_author":"rodel77","p_authorkey":"1034288","p_urlkey":"322015","p_title":"Greedy Robot Fight | Post Mortem | Part 2","p_cat":"LDJam ","p_event":"LD40","p_time":"1512530741","p_likes":"0","p_comments":"0","p_status":"WAYBACK","us_key":"1034288","us_name":"rodel77","us_username":"rodel77","event_start":"1512086400","event_key":"70","event_name":"LD 40"},"node":{"_collation":{"body_sanitizer":"TextUtils::SanitizeHTML via existing importer","event":"LD40","removed_author":false},"_superparent":49883,"_trust":8,"author":34288,"body":"Part 1: https:\/\/ldjam.com\/events\/ludum-dare\/40\/greedy-robot-fight\/greedy-robot-fight-post-mortem\n\n### Day 3\n- GUI\n- Fixed a weird lua class system problem\n- After fixing that i am able to add the bad bot, then i create the sprite!\n\n### Day 3 (AI):\n\nAnd now its the time to create the AI (Bad Bot Movement), i had the idea to create a full features AI, that can be offensive (Shoot to the player), and defensive too (Hide if the player can attack), but for time reasons it just rush the player\n\n#### Basic checking\n\nWhen its the bad bot turn, it first check if can attack you, then send the attack, otherwise it search for a movements\n\n#### Searching for a movement\n\nThe AI has to search a tile where it can use the laser to damage the player, then i make this:\n\n![test2.png](\/\/\/raw\/0f5\/8\/z\/dd02.png)\n\nThis make the same as the laser attack, but instead of attack it calculate the distance between the tile and the bot, as you can see the \"Near Tile\" says 1, and the other tiles are 3-2 tiles far, ok now we know the quick way to attack player, now lest move the bot there!!! ...but how?\n\n#### Path Finding\n\nThere is another life saver lib \"Jumper\" https:\/\/github.com\/Yonaba\/Jumper its a PathFinding library, super easy to setup very fast, and lightweight\n\nThen i simply generate a path from the bot to the nearest tile, make a move check it can attack and otherwise continue moving until can attack\n\nThis is probably one of the coolest things i ever do, i feel done when the bot starts moving in the first turn =D\n\n### Release\n\nI record a video and yay! Its uploaded, now lets review the first bugs\n\n### First Bug\n\nThe first bug was that the levels save the player and bot position, and sometimes that break walls, or other things, very strange but after a lot of research i found a solution\n\n\n#### Solution\n\nI didn't notice that if you set a table in a variable from another table and then you modify the variable, it change the original table too, then i fix it by making a clone of the original table\n\nI am a bit disappointed about lua, i will try to learn more about it before making another game\n\nThanks for playing and rate my game, cya in LD41 :wink:","comments":0,"created":"2017-12-06T03:04:54Z","files":[],"files-timestamp":0,"id":69206,"love":0,"meta":[],"modified":"2017-12-06T03:25:41Z","name":"Greedy Robot Fight | Post Mortem | Part 2","node-timestamp":"2017-12-06T03:25:41Z","parent":50160,"parents":[1,5,9,49883,50160],"path":"\/events\/ludum-dare\/40\/greedy-robot-fight\/greedy-robot-fight-post-mortem-part-2","published":"2017-12-06T03:25:41Z","scope":"public","slug":"greedy-robot-fight-post-mortem-part-2","subsubtype":"","subtype":"","type":"post","version":200318},"node_metadata":{"n_key":"69206","n_urlkey":"322015","n_parent":"50160","n_path":"\/events\/ludum-dare\/40\/greedy-robot-fight\/greedy-robot-fight-post-mortem-part-2","n_slug":"greedy-robot-fight-post-mortem-p","n_type":"post","n_subtype":"","n_subsubtype":"","n_author":"34288","n_created":"1512529494","n_modified":"1512530741","n_version":"200318","n_status":"WAYBACK"},"source_url":"https:\/\/ldjam.com\/events\/ludum-dare\/40\/greedy-robot-fight\/greedy-robot-fight-post-mortem-part-2","text":"Part 1: https:\/\/ldjam.com\/events\/ludum-dare\/40\/greedy-robot-fight\/greedy-robot-fight-post-mortem\n\n### Day 3\n- GUI\n- Fixed a weird lua class system problem\n- After fixing that i am able to add the bad bot, then i create the sprite!\n\n### Day 3 (AI):\n\nAnd now its the time to create the AI (Bad Bot Movement), i had the idea to create a full features AI, that can be offensive (Shoot to the player), and defensive too (Hide if the player can attack), but for time reasons it just rush the player\n\n#### Basic checking\n\nWhen its the bad bot turn, it first check if can attack you, then send the attack, otherwise it search for a movements\n\n#### Searching for a movement\n\nThe AI has to search a tile where it can use the laser to damage the player, then i make this:\n\n![test2.png](\/\/\/raw\/0f5\/8\/z\/dd02.png)\n\nThis make the same as the laser attack, but instead of attack it calculate the distance between the tile and the bot, as you can see the \"Near Tile\" says 1, and the other tiles are 3-2 tiles far, ok now we know the quick way to attack player, now lest move the bot there!!! ...but how?\n\n#### Path Finding\n\nThere is another life saver lib \"Jumper\" https:\/\/github.com\/Yonaba\/Jumper its a PathFinding library, super easy to setup very fast, and lightweight\n\nThen i simply generate a path from the bot to the nearest tile, make a move check it can attack and otherwise continue moving until can attack\n\nThis is probably one of the coolest things i ever do, i feel done when the bot starts moving in the first turn =D\n\n### Release\n\nI record a video and yay! Its uploaded, now lets review the first bugs\n\n### First Bug\n\nThe first bug was that the levels save the player and bot position, and sometimes that break walls, or other things, very strange but after a lot of research i found a solution\n\n\n#### Solution\n\nI didn't notice that if you set a table in a variable from another table and then you modify the variable, it change the original table too, then i fix it by making a clone of the original table\n\nI am a bit disappointed about lua, i will try to learn more about it before making another game\n\nThanks for playing and rate my game, cya in LD41 :wink:","title":"Greedy Robot Fight | Post Mortem | Part 2","wayback_source":[]}