Jump to content
xisto Community
Sign in to follow this  
s243a

Understanding The Army System Code

Recommended Posts

I just download the army system code because I was curious if it would be better to modify the existing code or rewrite a new game. The code can be download at:

http://forums.xisto.com/no_longer_exists/

I started a discussion about creating a new game at:

http://forums.xisto.com/topic/20398-a-home-grown-army-system/

 

I created this discussion to help dissect the code and understand what it works. From what the army system does it looks needles complicated. But perhaps there is a lot of extra stuff there for administrator options. The discussion is created to try understand how the army system works. Not knowing php, this will be a formidable task for me I would appreciate any help.

Share this post


Link to post
Share on other sites

Okay, I dont know php, put looking at the code so far it looks like the main functions in the game are in the file army.php. Near the first the class army is defined army. Each member in the game I assume when they play has an instance of the class army. It has the properties, $page_title, $nav, $output, $currency, $max, $html, $member, $inv, $all_inv, $sql_class. I am not sure what any of these things do. Darn lack of comments. There is a strange bit of code that is commented out:

	// Maximum values  // siege  	= max['maxsiege']  // fort    = max['maxfort']  // unit production	= max['maxprod']  // spy level  = max['maxspy']
There is a method called auto_run(), which must intiate some kind of thread that runs while you are playing. Is there threads in php. Okay, that is enough for now.

Share this post


Link to post
Share on other sites

Ok, this looks like it could be where our error would be, everyone take a look-see, it is located in sources/army/army_func.php

	// How much time do we have left before the next update	function timediff($time)	{  global $ibforums;  if($time <= 60) {  $time_unit = $ibforums->lang['sec'];  if($time == 1) $time_unit = $ibforums->lang['sec1'];  $time2 = $time.$time_unit;  }  elseif($time <= 3600) {  $time_unit = $ibforums->lang['min'];  $time = floor($time / 60);  if($time == 1) $time_unit = $ibforums->lang['min1'];  $time2 = $time.$time_unit;  }  elseif($time <= 86400) {  $time_unit = $ibforums->lang['hr'];  $time = floor($time / 3600);  if($time == 1) $time_unit = $ibforums->lang['hr1'];  $time2 = $time.$time_unit;  }  elseif($time <= 604800) {  $time_unit = $ibforums->lang['day'];  $time = floor($time / 86400);  if($time == 1) $time_unit = $ibforums->lang['day1'];  $time2 = $time.$time_unit;  }  elseif($time > 604800) {  $time_unit = $ibforums->lang['week'];  $time = floor($time / 604800);  if($time == 1) $time_unit = $ibforums->lang['week1'];  $time2 = $time.$time_unit;  }  return $time2;	}

Share this post


Link to post
Share on other sites

Notice that the time difference is equal to the current time multiplied by the unit time$time2 = $time.$time_unit;If the current time is the numbers of hours the game has been running and the unit time is increased then the time would be proportionally increased. This would cause the game to jump ahead in time. So the question remains as to whether changing the unit time will change the variable time accordingly or leave it unchanged.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.