Page 1 of 1

Posted: Sat Jun 05, 2010 12:02 pm
by archibalduk
dabo wrote:Looks like everyone agrees on the fact that the 2d match engine should be added at a later stage.
I think that makes sense. :thup: However, how do you plan to simulate matches? The reason I ask is that if the game is simulating every second of the match then technically you'll have already created a 2D match engine.

Does anybody know how EHM or FM (SI's Football Manager) simulates games? I seem to remember reading that FM (and I presume this also applies to EHM as they're both based on the same engine originally) calculates the final scores first and from that simulates the actual match (i.e. the movement/actions of each player) so that the match finishes on the pre-calculated score. Every time you make a change to your line-up or tactics, the game recalculates/re-simulates the final score and then simulates the remaining match action. I'm not sure how from this it figures out who scores/assists and things like injuries and penalties.

But I suppose even before getting to the stage of simulating the game, you somehow have to programme how all of the player attributes work and how they interrelate.

Crikey, this sounds like one hell of a mountain to climb!!

Posted: Sat Jun 05, 2010 12:28 pm
by archibalduk
With regards to match engines, I thought these links might be helpful:

http://community.sigames.com/forumdisplay.php?f=11 - Apparently hidden somewhere in this forum are a couple of threads on how to get started with a match engine (make sure you select the option to view all threads from the beginning - it defaults to just show the past month).
http://www.gamedev.net/ - This is supposed to be a very useful resource.
http://sourceforge.net/projects/openworldsoccer/ and http://sourceforge.net/projects/yodasoccer/ - Two opensource soccer games. Perhaps their code may be a helpful starting point for a match sim?

I have no programming experience whatsoever but I thought I'd post these links in case there is anything helpful there.

Posted: Sat Jun 05, 2010 12:37 pm
by dabo
archibalduk wrote:
dabo wrote:Looks like everyone agrees on the fact that the 2d match engine should be added at a later stage.
I think that makes sense. :thup: However, how do you plan to simulate matches? The reason I ask is that if the game is simulating every second of the match then technically you'll have already created a 2D match engine.
This is another big question which I cannot give a good answer to atm. The rough idea I have in my head is to simulate games in steps where events occur depending on the players who are currently on the ice etc. Would be nice to have something to build on for the future and just add a graphical representation (2d rink) later. But right now it is too soon to say, I have to try things out first.
archibalduk wrote:With regards to match engines, I thought these links might be helpful:

http://community.sigames.com/forumdisplay.php?f=11 - Apparently hidden somewhere in this forum are a couple of threads on how to get started with a match engine (make sure you select the option to view all threads from the beginning - it defaults to just show the past month).
http://www.gamedev.net/ - This is supposed to be a very useful resource.
http://sourceforge.net/projects/openworldsoccer/ and http://sourceforge.net/projects/yodasoccer/ - Two opensource soccer games. Perhaps their code may be a helpful starting point for a match sim?

I have no programming experience whatsoever but I thought I'd post these links in case there is anything helpful there.
Thank you.

Posted: Sat Jun 05, 2010 9:59 pm
by archibalduk
It seems Marc Vaughan (I think he's MD of something similar of SI Games) was at one point writing a book on writing a sports management game. It might be worth contacting him to see if he ever finished it (he's apparently very enthusiastic to give pointers to others seeking to write a sports management game).

Here's a draft I found on the SI Forums:
Marc Vaughan wrote:Writing a Sports Management Simulation

Index

SECTION ONE - INTRODUCTION 2
WELCOME 2
INTRODUCTION 3
WHAT IS THIS BOOK ABOUT 3
DESIGNING FOR THE FUTURE 3
COMMON SPORTS MANAGEMENT GAME FEATURES 3
COOL IDEAS 4
SECTION TWO - IMPLEMENTING THE GAME 7
AN OVERVIEW 7
THE USER INTERFACE 7
SCREEN DISPLAYS 7
BASIC GRAPHICS USING DIRECTX 8
BASIC GRAPHICS USING THE GDI 8
CONSTRUCTING A USER INTERFACE 8
MAKING A SCREEN MANAGER 8
CONSTRUCTING SCREEN OBJECTS 8
THE GAME ENGINE 8
THE GAME DATABASE 8
THE MATCH ENGINE 10
THE COMPETITIONS 10
THE TRANSFER SYSTEM 10
APPENDIX ONE – LIST OF TEXT SPORTS SIMULATIONS AND DEVELOPERS 10
APPENDIX TWO – USEFUL URL’S FOR THE NOVICE DEVELOPER 10
APPENDIX THREE – RECOMMENDED READING 10
Marc Vaughan wrote:Section One - Introduction

Welcome
Sports Management Simulations are games, which defy tradition. In most computer game genre's new games are heralded with fanfare and amazing rendered graphics, Sports Management games however are involved with immersing the player in a lifelike simulation of that sport. This is not done through flashy graphics (although some have attempted this) - but by realistically recreating the world that surrounds that sport.

Sports Management games are also unique in that they are largely boundless there is no final end of level boss to defeat or carefully scripted end sequence to herald the game being put out to pasture. Players are able to continue the game for as long as they desire creating a sporting dynasty that will live in their imagination. For this reason these games have a very long life span staying popular for much longer periods of time that games in different genres.

Because of their deceptively simple appearance most people do not consider the amount of work that goes into a game. Even a mediocre game takes around 10,000 man-hours to develop, while a big one like Championship Manager 3 takes around 75,000 hours. Most people work about 2,000 hours a year, but games producers and associated staff work more than 2,500 often reaching 3,000. I personally probably work around 3,250 hours a year. You might consider me a workaholic (my wife does) but without this commitment to perfection a game won't be successful.


Introduction
Ever since sports were invented supporters standing on the sidelines have muttered comments about what they would do given the chance to manage their team. Sports Management games tap into this mentality and allow supporters to finally find out whether their beliefs are true and if they do really know something that their teams manager has missed.

These games started out as very basic simulations with simple arithmetic determining the outcome of matches but have in recent years developed to the stage where respected managers have indicated that prospective coaches could do worse than playing these games in order to learn the basics of their profession*.

For me developing such simulations began as a child using self made board games and has continued into my adult life through computer programs. I have been lucky enough to manage to obtain a job where I can indulge in my hobby by developing the Championship Manager series of computer games.

*Placemarker for quote from the Polish manager about CM

What is this book about
This book is first and foremost a guide to developing your own text based sports management simulation, whatever sport it might be for I hope this book serves as a guide and inspiration to help you while you write your game.

Designing for the future
The importance of good design cannot be overstated. A well structured but balance basic game can be built upon and enhanced for several years which saves much time and heartache rewriting the basic interface of the game when you decide to update it.

I would recommend that before you even think of installing a compiler on your computer you try and thrash out the basic design for your game, this will include a
• Overview of the game.
• Features that you expect the game to contain, keep this fairly basic initially placing only features that you feel are 'essential' here.
• Layout of the main screens in the game.
• Structure of the in-game database. This is an essential part of any sports management game and it is important to tie down exactly what data is to be contained in the game at a very early stage.

Within the computing industry this is known as a high level design.

By specifying these basic details at an early stage it allows you to aim at a fixed target and structure your program in an organised and (hopefully) efficient manner.

Common Sports Management Game Features
Most sports management games have a lot in common, grabbing any at random from a shelf you will find the following items within them: This chapter describes a brief overview of these common features and the different manner in which games have implemented them.

League System
All management games to my knowledge feature a competition structure within which the players teams compete. Some management games attempt to simulate an incredible amount of leagues very simply (such as World League Manager) while others concentrate on fewer leagues but attempt to model them as realistically as possible (such as Championship Manager).

It is up to you to decide where in this spectrum you aim your game to be.
<Screen Shot - Japanese League in CM3>

Transfer (Trade) System
Another common facet of Management games is the ability for staff within teams to move from one team to another. The way in which this works can vary wildy depending on the sport involved and the accuracy of the simulation that is undertaken.

For instance Front Office Football contains a fully modelled implementation of the complicated draft system used in American Football while the Premier Manager soccer game approaches this in a much simpler manner allowing users a less accurate but easier to use implementation of the soccer transfer system.
<Screen Shot - Front Office Football - Trade Screen>

Match Engine
In a sports simulation the teams modelled must compete against one another in some manner, this is done by simulating the competition they are playing in using what is called a match engine.

Games implement match engines in a variety of ways from simple points tallying and the displaying of results (in the original Football Manager) to the indepth simulations that are common in commercial games today.

It should also be noted that the manner in which these 'matches' are represented to the user also varies considerably. Games such as Championship Manager preferring to stimulate the imgination of the player through the use of a sophisticated text based commentary, while other simulations prefer to display a graphical representation of the match that is being played. These graphical representations can vary wildly from the functional SAAP match display to the glorious 3D emplyed in Premier Manager.
<Screen Shot - Premier Manager 3D engine>

In Game Stats
No Sports Management game would be complete without stats for the player to refer to. These stats give the player feedback on the performance of teams and player within the game and also add motivation and realism to the game.

Common statistics found in sports simulations include MVP awards, passes completed, goals scored etc.
<Screen Shot - EHM stats screen>

Cool Ideas
This section includes an overview of some of the best sports strategy games that have been released and a brief look at what made them great. Some of these you might decide to include in your game.

Media Stories
Many games have attempted to include the media, the idea behind this is largely twofold, in the game the media can add a veneer of realism to the game drawing the player even more into the virtual world, secondly, in real-life the media affect the outcome of many sports by influencing individuals in teams with speculative stories and driving fans into frenzies with stories about players.

The most successful implementation of media within sports simulations so far have been within soccer simulations, initially with On the Ball and most recently with Championship Manager 00/01.
<Screen Shot – EHM Media News screen>

Player Personalities
In early simulations players were represented as little more than numbers within a sim, most modern day games however attempt to represent players as being 'human' and having character-traits and personalities. These are often displayed via. simple text messages upon a player profile but they can have a huge effect on how a player 'sees' a game.

<Screen Shot – CM01/02 Player Future screen>

2D Match View
A 2D match view is usually a birds eye representation of the pitch whereby the user can watch the movement of the sportsmen during the match. This has the advantage over text commentary that users can instantly see exactly where and how players are positioned giving feedback much more accurately than with a standard text commentary.

This also has the sometimes undesired effect of showing up any flaws that might be present in the match engine.
<Screen Shot – USM99 Match Overview screen>

3D Match View
With the advent of 3D graphics cards even the retro world of text based sports simulations has fallen prey to flash animations. Some sports simulations most notably ‘Premier Manager’ and ‘EA Football Manager’ have included very impressive looking 3D displays to support their game. This allows the players to view the game in the same way that a real manager would.

Again the main drawback of this sort of visulisation is that if it looks unrealistic then it destroys the sense of ‘realism’ that the game is attempting to create..
<Screen Shot – EA Premier Manager 3D Match View>

Hyper Links
Long before the Internet made such things trendy sports simulations were using hyper-links to allow users to navigate easily around the interface of their particular games.

Most professional games include some form of hyper linking from the rather basic attempts of ‘Premier Manager’ where player and club names are linked, to the fully fledge hyper linking of Championship Manager where you can click on nearly any reference to a football related item and be brought to your desired destination.

<Screen Shot – CM Fixture List screen>

Staff History
Most successful sports games allow users to build up a sense of history within the game, this is usually done by reporting data upon each season which passes within the game, whether as part of a staff profile (games played during a season etc.) or as a history of a clubs achievements (trophies won etc.).
<Screen Shot – Jump Shot Basketball Player History screen>

Mimiking Television Sports Reports
Users tend to be most at home with a game if they recognise the format that it is presented in, one easy way of doing this is to mimic the reports that television programs give to a sport when reporting on a match. Championship Manager does this with its stats reports as is shown on the screenshot below.
<Screen Shot – CM Match Stats screen>

Text Descriptions of players
A few text management games have eschewed the traditional use of numbers to display a players characteristics to the user, instead they have opted to use either a few short sentences or a verbal description of their ability. The most well known game which does this is Midnight Oils ‘Sick as a Parrot’.
<Screen Shot – EA Premier Manager player factfile screen>

Fog Of War
The fog of war is a name taken from military war simulations where a player cannot see territory where he has no troops. In the sports simulation industry it has a slightly different meaning and implementation, generally it is a term used to describe a situation where not all the information upon a player is available instantly on every player in the game. To view a players full information a manager is forced to rely on scouts or coaches to fill him in.

SAAP has taken this approach the furthest in the sports simulation world, allowing views of players to ONLY be available through coaches and scouts.
<Screen Shot – SAAP Coach report screen>


Building a community
For a long time sports enthusiasts unhappy with the level of management simulation games available to them in their favourite sports have attempted to create their own games (Championship Manager is one of the better known games which started in this way). With the advent of the internet it is now possible to easily bring these games to a wide audience without the requirement of a large publisher to promote the game.

In order for such a setup to be successful it is neccassary to build up a community around your game, this involves in most cases a well laid out website and a messageboard within which fans can posts questions to you (and other fans) about the game.

Many great games have started in this manner including Front Office Football, Out of the Park Base Ball, Jumpshot Basketball and East Side Hockey Manager.
<Screen Shot - FOF Forum>
Marc Vaughan wrote:Section Two - Implementing the Game

Basic Programming Principles
Advice on programming a large project
Debugging tools

An Overview
A common problem with developers is the daunting process initially of deciding exactly where and how to start on the development of their game. If you look at the game as a whole then it’s a daunting task and you'll probably never get past drawing up designs let alone finish the game.

WIthi this in mind I propose to split the development into more manageable chunks, this will give the developer a more managable task with a sense of achievement as each of the chunks is completed.

The chunks that the program will be split into are as follows:
• Graphic User Interface
• Database
• Match Engine
• Trade System
• Competitions


The User Interface
The user interface is commonly one of the most overlooked areas of game development. While a sleek and intuitive user interface won’t save a poor game from being slated, a poor user interface can kill the desire to play an otherwise well thought out and addictive game.

Text Based Sports Simulations require a user interface which is intuitive and which allows users easy access to every area of the game world with a minimum of fuss.

The next few sections of this book will take you through the basics of drawing on the screen, rendering text to a display and finally creating your own user interface.

Screen Displays
A screen display module deals with the displaying and interaction with the user interface for the game. All professional management games user a GUI of some sort.

Front Office Football, Jump Shot Basketball and a few other game some implement their games using the standard windows look and feel, while Championship Manager and some games use a custom interface designed specifically for their game.

I have listed briefly below the comparative advantages and disadvantages of each approach to a games user interface.

Windows Interface
Advantages
Intuitive as most users are familiar with the windows interface
Quick to develop as there are many RAD tools available for Windows
Very few incompatibility issues

Disadvantages
Not graphically appealing
Doesn’t ‘look’ like a game
Limited flexibility in components

Custom Graphic User Interface
Advantages
Customised to the game so it is ‘exactly’ what is required
Can be made to appear very attractive
Looks more ‘like’ a game

Disadvantages
Increases development time
Can be incompatible with some machines is based on DirectX

Should you decide to develop your game using the standard windows interface I would recommend that you purchase a book dedicated to Windows GUI development as that topic is tool large to discuss in this tome.

The options available for developing a ‘custom user interface’ (DirectX and GDI)

Direct X
DirectX is the name given to the set of libraries which are provided by Microsoft to enable people to make fast sleep graphical presentations that are needed in certain high end applications and of course games.

These libraries can be used for implementing many fancy techniques such as texture mapping

Basic Graphics Using DirectX8
Many of us have been programming in DirectDraw for a while. We are used to locking our surfaces, writing out our screens, and flipping our buffers. We all have code for how to blit a sprite, and how to handle the surfaces. However, DirectX8 changes all that. While you can still count on backwards compatibility with DX7, you will be short-changing yourself on the improvements gained by moving to 3D (blit speed, alpha blending, stretching, etc.) .

This sample will show how you can still use 2D coding techniques in the 3D world, and how you can gain a speed increase over standard 2D DirectDraw code.

There are really only two basic parts to 2D programming. Rendering a bitmap, and writing directly to a surface (for lines, circles, etc.) This tutorial will show how to do that.

Opening a screen
Drawing a pixel
Copying a bitmap display buffer to the screen

Basic Graphics Using the GDI
Opening a screen
Drawing a pixel
Copying a bitmap display buffer to the screen

Constructing a user interface
Making a screen manager
Constructing Screen Objects

The Game Engine

The Game Database
At the heart of every Sports Management Game is a database containing the details of the players and teams modelled in the game.

This database is crucial to the game and accesses to it must be quick and efficient regardless of the size of the database that is being stored.

There are two approaches an SMG designer can take to implementing such a database, he can either implement his own ‘custom’ database format or use an existing standard database format (such as Jet - the Microsoft Access database engine).

I have briefly listed the advantages and disadvantages of each approach to database development below:

Standard Database Format
Advantages
Existing Database format with no bugs
Easy for users to update the database themselves

Disadvantages
Slow to access, search and save

Custom Database Format
Advantages
Fast to access, search and save

Disadvantages
Because it is implemented from scratch may contain bugs
Harder for users to edit the database

Should you decide to implement your game database utilising a ‘standard’ database format I recommend that you purchase a book dedicated to interfacing with your chosen database engine.

Implementing a custom database is fairly easy so long as care is taken in the initial design for the game.

The most important thing when designing the database is to initially determine the data that will be held within each of the database tables and how each of the tables in the database links to the other tables (if appropriate). An example document doing this for my ‘xxx’ game is shown in the ‘High Level Database Design’ document held on the CD.

Once the data to be stored has been determined it is now time to write an engine to allow access to this data quickly and efficiently.

When designing our database system there are a number of important points to bear in mind:

• Unique ID’s
Ensure that every item in a table has a unique id – this can be used to link data from one table to another.
These ID’s should equate to the location of the structure within the database table, for instance the first first item in a database table should have an ID of 0 (ZERO) because this is the value that would be required to access it from within the table array.

This means that any table which needs to reference this data can simply store the ‘id’ of the entry in order to be able to access it at a later data.

If speed is critical within your database you can make tables store raw pointers to other tables, however in this case you will be required to save down the base address of each table when you save the database so that upon loading the data links can be realigned.

• Speed
Read/Write in large blocks where possible as the longest delay in accessing data off disk is the ‘search’ period.

This usually equates to keeping all frequently accessed database tables in memory while the game is running and only storing in-frequently accessed tables on disk.

• Creating the database
A binary database can be read up much faster than a ‘text’ based database – however creating one is fairly awkward because you have to design a ‘custom’ editor to create the database with.

An easy work-around for this dilemma, which we will be using, is to allow your database to be fed from either a text or binary base but to always save its data in binary format. This will allow you to initially setup your database using a standard text editor however you will be able to release the game using a fast and efficient binary format should you so desire.

• Capacity to access old database versions
Hopefully your game will stand the test of time and be succeeded by a ‘sequel’ to the original. This sequel will undoubtedly be more in depth and require even more data than the first game.
Because of this it makes sense to allow your database to read and write different versions so that when you come to implement your ‘sequel’ you can build upon the existing game without having to re-implement your database from scratch.


File Access In C++
Detail the basics of opening a binary file and reading/writing from/to it. Also emphasise the importance of closing the file after use.

Implementing our database (Including Version numbers)
The first step of any management game is to define exactly the data that will be present within the games database. If this isn’t known the the game will quickly become unmanageable and hard to program.

For the purposes of this example I will define a simple database table holding the player information for players in a ficticious soccer management game.

Table Field Type
Player Name Character String [length 100]
Player Strength Character [range 1-20]
Player Agility Character [range 1-20]
Player Skill Character [range 1-20]
Player Heading Character [range 1-20]
Player Tackling Character [range 1-20]
Player Age Character [range 15-40]

The easiest way to create databases from scratch is to simply create them by reading data from a text file and placing it into an array of structures within your game.

The structures should be nearly identical to the table which is defined above, with the addition of a
For the purposes of this example I will define a simple database table holding the player information for players in a ficticious soccer management game.

Define the basic database structure that we’ll use for the test application
Reading up the test database as a text file
Writing the test database down as a binary file
Reading the test database as a binary file
Accessing the database in memory (inc. building a basic factfile display)

The match engine
There are many different approaches to implementing a ‘match engine’ itself, the only common component behind any match engine is the requirement for that engine to select a team of players for a CPU club to field.

There are several different approaches to doing this, the most common is simply matching players to their best role within a team.

Discuss how to implement Computer AI for team selections.
Detail the different approaches possible (simple random numbers, zonal play-offs and full simulations).


The Competitions
League
Cup

The transfer system
Buying and selling players
AI for computer purchases

Appendix One – List of Text Sports Simulations and Developers

Company: Solsemic Sofftware
URL: http://www.solsemic.com
This company is run by Jim Grindin and concentrates purely on the development of the American Football Management Game Front Office Football.

Appendix Two – Useful URL’s for the novice developer
Useful URLs for the novice developer

Appendix Three – Recommended Reading
Source: http://community.sigames.com/showthread.php?t=15699

Posted: Sun Jun 06, 2010 8:13 am
by Alessandro
Wow great finding Archi

Posted: Sun Jun 06, 2010 10:15 am
by axwel3221
Oh well well well. Archi delivers.

Posted: Sun Jan 09, 2011 11:26 am
by speedy_gonzales
Hi Dabo,

I recently got interested into AI programming myself.
I stumbled upon this book:
"Programming game AI by example" written by Mat Buckland, giving a nice example for a football simulation.
It is really very interesting! I just wanted to throw it into this thread. Maybe it does something good.

Cheers

Posted: Sun Jan 09, 2011 7:18 pm
by dabo
Thank you, I bought that book some years ago; a good one for sure. If I was the one implementing a 2d-rink sim in the future I would definitely use ideas from that football example. But the position is open to do it if you are interested. :)

Re: Match Engine / Simulation

Posted: Mon Apr 18, 2011 9:42 pm
by speedy_gonzales
Oi mate,

Congrats on your Master's degree. I got mine 2 weeks earlier:)
Anyway, I found an interesting webpage discussing the relation between attributes and the match engine:
http://www.mantralux.com/player-attributes-explained/

I hope this is interesting for one or the other.

Cheerio

Re: Match Engine / Simulation

Posted: Wed Apr 20, 2011 9:42 am
by dabo
Thanks and congratulations to you too.

Thanks for the link, nice find.

Re: Match Engine / Simulation

Posted: Wed Apr 20, 2011 1:56 pm
by speedy_gonzales
Hehe, merci.
Btw, in case you didn't notice. there is another link in my posted page, directing to a more excessive discussion:

http://community.sigames.com/showthread ... atch-Play-

This is again referring to FM2011.
Have a nice easter weekend,
Cu

Re: Match Engine / Simulation

Posted: Mon Nov 21, 2011 7:39 am
by CM0304
Archi was really an excellent info-collector :-p

Re: Match Engine / Simulation

Posted: Fri Apr 06, 2012 2:59 am
by CM0304
It seems the 2D was designed just for the description of the commentary lines
we all know CM0102 and 0304's 2D is just for the description of the commentary lines
one line for one scene,I think!

Re: Match Engine / Simulation

Posted: Wed Apr 18, 2012 3:56 pm
by CM0304
CM0304 wrote:It seems the 2D was designed just for the description of the commentary lines
we all know CM0102 and 0304's 2D is just for the description of the commentary lines
one line for one scene,I think!
I believe my point as CM0304's commentary lines are just the same as CM0102 :-#

Re: Match Engine / Simulation

Posted: Fri Apr 27, 2012 3:05 pm
by CM0304
I am thinking a vital thing as the game concept should be real,not fake or so-called simulation
one concept,simulating the result,the simulation of 2D,just for the result usage.
the future concpet should the instant-simulation.that's real and should be more exciting for the in-game instruction,every player has his own move mode and the result should be settled in the end of the game,it maybe difficult but it should be in the next generation of manager game

Re: Match Engine / Simulation

Posted: Tue Sep 11, 2012 12:03 am
by Linden16
Not exactly sure where to post this, but I would love an "exhibtion type" game mode where instead of starting a whole season, you can just simulate between two teams. (Like EA's play now mode)

Would be fun for those who make their own roster then wish to see how it plays out