Tonight I added bots to games. I had to write a couple of methods in the Player module to support getting random bots, as well as code to set their traits to 1. I also had to revamp the creation/join flow. It was the case when you created a dungeon, it would automatically add you to it if you were logged on, or give you the unhelpful message "you still need to join". Since I had to add a form to select how many bots you want and how many rooms you want, I took the opportunity to apply the "post redirect" pattern. Now, as soon as you are done creating the dungeon, it redirects you to the join page with the name and dungeon id preset, if applicable. I like this because it gets rid of yet another "post refresh" place, and it also keeps all of the joining code in one place instead of spread. Its also more user friendly.
Now that the bots are in the game, next up is to have them read the room file with the <ai-block>, which I've mapped out in the dev folder, and issue some decisions. I've decided, to start, to have them submit in "random" order, meaning they are inserted into the db inbetween the player decisions at random. They may not even go to the db, just memory... this seems more likely than to do date math to see where to place a decision. I can't remember how the log/reporting thing works, if it uses that submitted_decisions table at all. We'll see.</ai-block>
Tonight I added bots to games. I had to write a couple of methods in the Player module to support getting random bots, as well as code to set their traits to 1. I also had to revamp the creation/join flow. It was the case when you created a dungeon, it would automatically add you to it if you were logged on, or give you the unhelpful message "you still need to join". Since I had to add a form to select how many bots you want and how many rooms you want, I took the opportunity to apply the "post redirect" pattern. Now, as soon as you are done creating the dungeon, it redirects you to the join page with the name and dungeon id preset, if applicable. I like this because it gets rid of yet another "post refresh" place, and it also keeps all of the joining code in one place instead of spread. Its also more user friendly.
Now that the bots are in the game, next up is to have them read the room file with the <ai-block>, which I've mapped out in the dev folder, and issue some decisions. I've decided, to start, to have them submit in "random" order, meaning they are inserted into the db inbetween the player decisions at random. They may not even go to the db, just memory... this seems more likely than to do date math to see where to place a decision. I can't remember how the log/reporting thing works, if it uses that submitted_decisions table at all. We'll see.</ai-block>