Jump to content
  • Advertisement
Sign in to follow this  
FlashbackJon

[web] Turn-based battle...

This topic is 3807 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm building a game that runs via PHP/MySQL (with a hint of javascript and Ajax). The easiest comparison to make is that it is ultimately like *shudder* Pokemon. Players have a stable of monsters and issue challenges to other players in order to engage in turn-based battles that net experience. The trick is that even while engaged in battle, they can do other things with their monsters and possibly engage in multiple battles at once. I'm also trying to figure out the best way to manage fights from multiple monsters, and keep a tally at the player console of what fights they are engaged in, and what fights are waiting on their input. I don't want increases or upgrades that occur outside the fight to affect a fight already in progress. Here are my thoughts on table design, and I'm looking for feedback. I already have a pretty sizable `monsters` table, containing all their base stats. I'm looking to create another table called `battlestats` that stores snapshots of the appropriate stats as the fight goes on. I'm shying away from retaining "historical" snapshots, so just one record per monster per battle. This is the big question: essentially, it seems like a lot of unnecessary copying, but I can't think of a better way to do it. Finally, as far as battles, I'm thinking a `battles` table with only the basics in it, and a `rounds` table that actually records what occurs during the fight. Thoughts? Recommendations? Need additional info?

Share this post


Link to post
Share on other sites
Advertisement
What is the big question? You said 'this is the big question', but didn't ask a question. :P

If a monster can be in multiple battles at once, then you have to know how you're going to resolve that monster's state when both battles conclude and probably disagree on that monster's final state.

Share this post


Link to post
Share on other sites
How about locking out a monster that is in a battle. You can have a variable in the MySQL DB that is set to TRUE whenever the person is in a fight and sets back to FALSE when they are done. That was if the player is challenged while in a fight the challenger will get a message. To prevent disconnects from making the variable = TRUE on system disconnects when battles are not completed, you can make sure the variable is set to FALSE on login.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!