thewhat Posted September 27, 2007 Share Posted September 27, 2007 Hi all. As the title says, I'm building a game in PHP/Mysql. Now this is my first time but I've got everything mapped out pretty well. Most of the nation building aspects will be done through mysql with the users being able to extract specific info from a DB and placed on their nation and whatnot. I have a few questions though - for those more experienced with these languages. Creating a war system. ??? How would this work? Essentially, what I'd need would be for one user to be able to "destroy" another users info. Soldiers, tanks, etc. But it's clear to me that I have NO idea on how to go about this. So, my question to all of you is this: What options would you suggest to me to create such a system. Sadly, I know this will be all to simple in the end. A Db with some kind of manipulative function and I'm done, probably. But considering I'm kind of stuck atm, I'll ask around. Quote Link to comment https://forums.phpfreaks.com/topic/70855-building-a-game-in-phpmysql-my-input-and-hopefully-yours/ Share on other sites More sharing options...
redarrow Posted September 27, 2007 Share Posted September 27, 2007 is it idear only. <?php if($rec['what_ever']=="what_ever"){ $rec['what_ever']="destroyed"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/70855-building-a-game-in-phpmysql-my-input-and-hopefully-yours/#findComment-356202 Share on other sites More sharing options...
GingerRobot Posted September 27, 2007 Share Posted September 27, 2007 You're going to have to come up with some form of algorithm based on what units each person has. This could be very simple - say a person has 5 soliders with a power of 1 each and 2 tanks with a firepower of 2 each. Total firepower = 5*1 +2*2 = 9. Other user has 4 soldiers and 3 tanks. Total firepower = 4*1 + 3*2 = 10. User two destroys user 1. However, its unlikely your game would be very good with such a simplistic battle. You'd want to take into account factors such as which units are better against what, who is defending, speed of units etc. You'd also probably want to consider the idea that you dont destory all of either team at first, but rather destroy some of their units. In short, its as complex as you want it to be. Quote Link to comment https://forums.phpfreaks.com/topic/70855-building-a-game-in-phpmysql-my-input-and-hopefully-yours/#findComment-356208 Share on other sites More sharing options...
thewhat Posted September 27, 2007 Author Share Posted September 27, 2007 redarrow - I dont have anything written up yet. So, no. Heh GingerRobot - Thank you! I'm going to look into this further. Quote Link to comment https://forums.phpfreaks.com/topic/70855-building-a-game-in-phpmysql-my-input-and-hopefully-yours/#findComment-356221 Share on other sites More sharing options...
thewhat Posted September 28, 2007 Author Share Posted September 28, 2007 Hi again. Anyone familiar with cron jobs? I've had an idea floating around recently that would require cron. Essentially, the player/user would click something that would give them something from a database, HOWEVER, it would take x amount of hours. I know it seems like I'm asking alot of questions but I think if more people join in on this convo it could be a useful thread for the future. Quote Link to comment https://forums.phpfreaks.com/topic/70855-building-a-game-in-phpmysql-my-input-and-hopefully-yours/#findComment-357055 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.