Hello all......
Here is my question - And I am not requesting someone do this for me but if one could give some guidance that would be great....
I am wanting to put together a soccer management game (though it could be hockey as well - but let's do soccer for the moment)
Here is the full concept : A manager logs on to the site, where the index shows stuff (tables, recent trades, match results etc) He can than click on one of many links.. One will be rosters, one will be stats, one will be past results. He will also be able to input line-ups for his next match(s) from a form that the game will save..
The sim engine will be fully automated to run these matches by using the submitted lineups and will than update the tables, player stats, bank accounts etc - The engine will also provide match stats and match reports...
That in a nutshell is the concept - Now this is ambitious for a newbie with no real programming experience.. But I look at it as a good challenge... I picked php because of its easy html integration and mySQL integration with out a lot of extra work.......
In any case here are my questions on this :
In C/C++ you can use include (#include something.h) which will allow you to write seperate functions and include them during compile (this part I like as it allows me to seperate the different parts out ) and looks to keep code somewhat seperate.......
Does php have the same ability ( I know it is not compiled but interpeted) but the coding can get rather long as I will have a ton of information for each function
1.) $players - This will be a list of all the players available in the game
2.) $ratings - This will be a list of all the player attributes for various abilities (tackling, passing, shooting etc.. -- these will be from 1-20)
3.) $stats - this will be the player stats
Now whether these can be combined or not I also do not know - I will be using an mySQL database to hold all information in the league
The engine will simulate results based on the following: A manager puts in a lineup of players - Each players attributes are totaled for a "number" - This "number" along with a "tactic" (which will provide another number) will be the basis for all probabilities of actions.. Let's look at a situation...
Team "A" has submitted a lineup -
Team A has the ball on their side of the field. It will attempt to score. Generate a table from 1-100 (0-99) and populate it with the following factors : Player from team A's skill, Opposing Player's defensive capability, distance from goal, amount of fatigue (duration of game). This table will look something like this (imagine +1 to make it simpler, so 1-100 not 0-99) :
1-50 : Player successfully advances the ball
51-60 : Player fails to advance the ball but maintains possession
61-73 : Player fails to advance the ball and loses possession
74-82 : Player passes the ball far upfield to another attacker
83-95 : Player loses possession of the ball and the enemy attempts to score
95-100 : Critical failure : The player loses possession of the ball and instantly yields a goal to the opposing team
2) In the event of 1, roll again, but now have a different set of options for being on the opposing side. In the even of 2, make the same roll on the table again. In the event of three, make the same rolls for the opposing team, but use a different table as they're closer to the goal. In the event of 4, make the rolls again but change the player's statistics to Player 2 on Team A, and assume numbers being closer to the goal. In the event of 5, roll a table where the opposing team either succeeds or fails based on the skill of a random player. In the event of six, instantly give a goal to the opposing team (in the game of soccer this happens way less than 5% of the time, it'd be more like .01%, but you could also roll on another table of critical failures that include injury, or looking stupid for ten seconds).
3) Repeat the process based on the results.
NOW this is a LOOONNGGG post but I wanted to give you the basic concept - So back to my question.....
What would be the cleanest way to put this together ? Should I have multiple functions, some other thought - also there will be substitutions - red cards, yellow cards, injuries (at least by random chance) - and this will all be stored in mySQL for output
Thoughts
Thank You in advance