Jump to content

jofolk

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jofolk's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Like a lot of other people I am working on MMO (Kingdom Building Type). I am pretty much doing it in order to help me learn PHP with an end goal. In other words, I am a n00b when it comes to PHP. The question I have is I am trying to build my combat function and I would like to make it rather complicated and I am having a problem trying to figure out the easiest way to do it. I could use an easy formula to figure it out, but like I said I am trying to learn and I think a more realistic type combat would be cool. This is what I am trying to do... I would like to actually have every solider from each army engage in combat. Basically... Army A (200 lvl 5 soldiers, 300 lvl 3 soldiers, 500 lvl 1 soldiers, 700 Average Weapons, 500 Poor Weapons, 1000 Poor Armor) Army B (500 lvl 4 soldiers, 500 Elite Weapons, 500 Elite Armor) So far I have a function that fills an array with what each solider is caring (giving the best weapons and armor to the highest lvl soldiers). I also have a function that takes two arrays (one for each solider) and returns an array with the solider that survived, died, and how many hit points he has left. All that was the easy part. What I am trying to figure out now is how do I basically have all the solider fight each other and give me the results of the battle, for example... Army A (100 lvl 5 soldiers survived and solider X defeated Z many opponents and is the hero of the battle) Army B (all died and solider X defeated Z many opponents and almost turned the tide) In addition, I would like to also figure out a way to make it even more realistic. If Army A has 1000 soldiers and Army B has 500, you must assume Army B troops would be getting beaten on by two troops at a time at first. How would I go about doing that? I am not expecting anyone to help me with writing the code. All I am hoping for is a point in the right direction. I am sure I could do this with a ton of conditionals, but with me be so new to PHP I would hate to create a ton of script if there was an easier way (I created a round() function and couldn't figure out why it wouldn't work until I found out a round() function was already built in to PHP). Thank you for your help in advance.
  2. Thank you for your feedback. I looked into the cron and I got it to run a script. I am trying to figure out how to make it work. Could you please let me if my logic is correct. Player select links for upgrading building. ->Database updates with time the building with be complete (building_finish_time, building_qued_type, building_qued_new_level). Cron is set to run action.php every minute. for(ALL of the Rows) If (building_finish_time < NOW){ UPDATE building database SET building_type = building_type + building_qued_new_level WHERE building_type = building_qued_type; building_finish_time = 1 Jan 2050; } I think that will work, but I am wrong running the Cron every minute. Will that cause a problem if I have a ton of people playing the game. Any feedback will be greatly appreciated. Thank you,
  3. I am trying to make a game much like Tribalwars. I am noob to PHP and got many of the functions to work but I am having a problem finding a resource on how to do something and I was hoping to get some help. I would like to make a script where the user select a link, which starts a timer, and then when the timer runs out it executes another script. (i.e. User would like to upgrade a building and it takes 2 hours to upgrade. Once the 2 hours is over their building is upgraded.) Like I said I am really new to PHP and programming in general. Can this function be created in PHP or does this need to be a server side script that is executed when the link is activated? Also, is there a site or a book that anyone would recommend I visit/read that would help me create my game. Thank you in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.