Sign in to follow this  

Football/Soccer match simulation

This topic is 3628 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, 2 months ago I started to develop a MMO football/soccer manager game, yes, one more... In that time I was just able to do web-design with HTML, Flash and Actionscript and I was able to scratch C++. I decided to learn PHP and MySQL to accomplish my objectives and now I have a good background structure of the game. Divisions, players, transfers, tactics and so on, but know i have come across, maybe, the most difficult and important task of this game, the 90' match simulator. On this match simulator I want to achieve a 2D simulation, without great graphics, I don't mind to use small dots or balls as players and ball, the important thing is the mechanics of the players. So there is no need of a physical simulation, i don't want realistic elasticity of the ball, what i want is to achieve a simulator of movements, passes, shots and so on... Another important thing is that the game should be replayed without having to simulate again, if someone want to watch a game that has already occurred will just load the values achieved with the simulation and watch the simulation viewer. As I understood I need to divide my simulation in 2 parts: - The simulation process (with registry of the game to re-play) - The simulation viewer As I said in the beginning of this topic, I have some knowledge in flash and actionscript so I thought doing, at least, the viewer with flash. But I also would like to do the first part almost in the same platform just to avoid simulation non-sense... But is possible to do a cron flash? (cron job) And won't it be a waste of resources if the simulation process is just what it is a process, noone is actually watching it? I also know that, for example, managerzone, has the match simulation achieved in Java, at least the viewer, but is Java so much better to achieve this simulation than Flash? What about another programming language? Is there a great programming language that i should start learning to achieve this? Thx in advance.

Share this post


Link to post
Share on other sites
You could write the simulation engine in any language really, im currently playing around a bit with a soccer engine in Java (relativly easy to work with and decent platform support), the match is stored as xml data in a database, this data could then be extracted using for example a php script and then loaded into a flash applet that displays the match.

For the viewer portion i definitly recomend going with Flash since its relativly easy to use and more importantly, virtually everyone has the Flash player installed.

For the simulation you can use pretty much any language you want, it just needs to be able to:
1) Read pre-match settings (tactics, player info, etc) from somewhere (a database for example)
2) Store the result somewhere (xml in a database is good since its quite easy to parse XML using ActionScript)

If you intend to simulate the matches in realtime to allow the players to change tactics while the simulation is running things get a bit more complicated though:

Personally im thinking about doing the simulation in small steps, (~ 2 game minutes each) and read in any changes at the start of each step, or possibly to only allow changes in half-time and have a 5-15 minute (real time) break between the two halves.

If you allready know php you could use it to write the engine aswell, just have your script query the database and grab the next game in the queue, simulate it, store the match.

Share this post


Link to post
Share on other sites
Ok,

Doing it all in PHP, store in MySQL the match info and view it through flash seems a good option to me, but i'm still a bit worried about the PHP performance because there could be an heavy processing of matches, and even the code that process each match could be heavy.

I don't want to do simulations in real time, but i also don't want to just simulate a text, i want to simulate movements, there will obviously increase the amount of code and time of processing, so that is why i'm worried about which language would be better for performance and if the difference of performances between PHP and Java, for example, are that different to be worried...

Share this post


Link to post
Share on other sites
I have been reading a bit more and it seems that with Flash and Flex i would have what really want, based on the same programming language, actionscript...

But again i ask if the performance won't fall when there is the need to simulate several matches? If there isn't another better option for this?

Share this post


Link to post
Share on other sites
Just to remember, since you're doing a client/server game (a 'MMO'), you should run the simulation on the server side, to ensure it never gets cheated by nasty users.

Use flash/actionscript only as a viewer (it's easy to decompile a flash file and change its actionscript code).

The flash application could be querying a php file, with a normal http request or something like SOAP or REST, and requesting the match status. Flash would then animate the screen with pretty graphics;

The user could also interact with the flash application and make changes on the match (such as doing a player substitution or changing tactics) and you would redirect this commands to the same PHP app, which would validate these commands and apply them to the simulation;


Just my two cents.

Share this post


Link to post
Share on other sites
Quote:
Original post by zebentao
I have been reading a bit more and it seems that with Flash and Flex i would have what really want, based on the same programming language, actionscript...

But again i ask if the performance won't fall when there is the need to simulate several matches? If there isn't another better option for this?


IIRC you can get JIT compilation with ActionScript 3.0 , thus performance should be adequate (I don't think its on par with the JIT compilers avaliable for .Net or Java (yet) , but its alot faster than it used to be), the problem of simulating multiple matches at the same time scales extremely well so throwing more hardware at the problem is always an option.

Since the match simulation is likely to get quite complex (i know mine is atleast , soccer AI isn't trivial) you really want to use a high-level language that you are comfortable with, don't worry too much about performance at a low level, if your algorithms are sound you will be fine, and porting over to a language that has better compilers will be relativly easy to do later on (But most likely its "cheaper" to buy slightly better hardware instead of wasting valuable time on that).

Share this post


Link to post
Share on other sites

This topic is 3628 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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