Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Understanding The Army System Code
s243a
post Apr 17 2005, 05:16 AM
Post #1


Super Member
*********

Group: Members
Posts: 408
Joined: 7-December 04
From: Nova Scoita, Canada
Member No.: 2,604



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://mods.invisionize.com/db/index.php/f/3347ttp://
I started a discussion about creating a new game at:
http://www.trap17.com/forums/a-home-grown-...t20398-s10.html

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.
Go to the top of the page
 
+Quote Post
s243a
post Apr 17 2005, 05:44 AM
Post #2


Super Member
*********

Group: Members
Posts: 408
Joined: 7-December 04
From: Nova Scoita, Canada
Member No.: 2,604



Okay, I don’t 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:
CODE

// 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.
Go to the top of the page
 
+Quote Post
GM-University
post Apr 17 2005, 02:18 PM
Post #3


Super Member
*********

Group: Members
Posts: 287
Joined: 23-February 05
Member No.: 3,945



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
CODE

// 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;
}
Go to the top of the page
 
+Quote Post
s243a
post Apr 17 2005, 02:33 PM
Post #4


Super Member
*********

Group: Members
Posts: 408
Joined: 7-December 04
From: Nova Scoita, Canada
Member No.: 2,604



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.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. How do you test your php code(86)
  2. What's Your Favorite Game System - Console(188)
  3. Crack The Binary Code An Win A Gmail Invitation!(9)
  4. Get Filename Of Referring Url(8)
  5. Install Two Anti-virus Software In 1 System(39)
  6. New System Shuts Down After Running About 1 Minute(14)
  7. Simple C File Handling In Action(5)
  8. School's Blocking System.(30)
  9. Your First Autoit(6)
  10. Runescape 2 Private Server: Code/guide 1(12)
  11. Google Operating System(9)
  12. Make A Moderately-secure Password System Using Javascript(10)
  13. Davinci Code(10)
  14. How To Remember Complex Passwords(14)
  15. What Operating System Do You Use?(24)
  1. Level Up System?(3)
  2. Credit System V3.0 Online(163)
  3. Php Code For Login Form With Validation In Php(6)
  4. Credit System V3 And Multiple Accounts, Trap17 And Astahost Forums(12)
  5. Galexcd's Last Credit Giveaway!(16)
  6. If We Have Negative Hosting Credits, Are They Pushed Over To The New Mycent System?(7)
  7. Setting Up A New Free Account [resolved](14)
  8. Fixed Centred Layout(2)
  9. Point / Credit System(5)
  10. Everything About Mycents - Your Virtual Money(26)
  11. Everything About Our Billing System? Shopping System? Support Center.(0)
  12. Incremental Backups(2)
  13. Signup Bonus Promotional Code Found Here(0)


 



- Lo-Fi Version Time is now: 1st December 2008 - 05:52 PM