views:

742

answers:

7

I would like to create a baseball simulation game.

Are these sports management games based on luck? A management game entirely based on luck is not fair, but it cannot be too predictable either. How does the logic behind these games work?

+4  A: 

Usually timing plus a randomness to make the game replayable EDIT To clarify I mean in terms of when the pitch comes at you, if it was exact you could learn to play it perfectly, you would need a small randomness around the exact time that you swing to make the game have some chance). AI has a big part in this if you do things like curve balls, add the ability to steal bases etc.

Getting games "right" isn't a factor of design or maths so much as a feel. You will try something, play it, and see if it was fun. If it isn't try different algorithms or gameplay until you get it right.

Spence
You might want to clarify that a little with an example, something like "Say you are modelling the role of the batter; In order to determine what type of hit you got you would calculate a random result based on the timing of the pitch; the better the timing the more chance of a better hit".
RCIX
Release often, release early, something like that.
Victor
+2  A: 

A simulation is very much about an imagined world in that you create classes that represent all aspects of an imagined world. You need to model the players, specify the game rules, and game dynamics.

http://cplus.about.com/b/2008/05/31/nathans-zombie-simulator-in-c.htm

Look here for agent based model: http://www.montemagno.com/projects.html

Andrew Siemer
AI may be a good idea.
Victor
+4  A: 

As you have already figured out, the core component of such games is the match simulation engine. As Spence said so, you want that simulation to "look right" rather than to "be right".

I worked on a rugby game simulation some time ago and there's an approach that works quite well. Your match is a finite state machine. Each game phase is a state, has an outcome which translates to a phase transition or changes in game state (score, replacements, ...). Add in a event/listener system to handle things that are not strictly related to the structure of the game you're simulating and you have a good structure (everytime something happens in your simulation, a foul for instance, fire an event; the listeners can be a comment-generation system or an AI responsible for teams' strategies).

You can start with a rough simulation engine that handles things at a team level using an average of your players' stats and then move on to something more detailed that's simulating things at a player level. I think that kind of iterative approach suits a game simulation very well because you want it to look right, and as soon as an element looks right you can stop iterating on it and work on another part of your system.

Random is of course part of the game because as you said so, you don't want games to be too predictable. A very simple thing to do is to have virtual dice rolls against a player and team statistics when they are performing a particular action (throwing the ball for instance).

Edit: I make the assumption that we're talking about management games like Hattrick, where you're managing a roster and simulating game results rather than 2D/3D graphical simulations.

Altherac
Yes, it's supposed to be management game.
Victor
+7  A: 

It's all about probability and statistics. You set the chance of something happening based on some attributes you assign, and then the random factor comes in during play to make things less predictable and more fun. Generally you get a load of statistics from some external source, encode them into your game's database, and write a system that compares random numbers to these statistics to generate results that approximate the real-life observations that the stats were based on.

Oversimplified example: say your game has Babe Ruth who hits a home run 8.5% of the time, and some lesser guy who hits one 4% of the time. These are the attributes you test against. So for each pitch you simulate, pick a random number between 0 and 100%. If it's less than or equal to the attribute, the batter scores a home run, if it's greater than the attribute, they don't. After a few pitches you'll start to see Babe Ruth's quality show relative to the other guy as he will tend to hit over twice as many home runs.

In reality you'd have more than 1 attribute for this, depending on the kind of pitching for example. And the other player might get to choose which relief pitchers to use to try and exploit weaknesses in the batter's abilities. So the gameplay comes from the interplay between these various attributes, with you trying to maximise the chance that the attribute tests work in your favour.

PS. Apologies for any mistakes regarding baseball: I'm English so can't be expected to understand these things. ;)

Kylotan
Actually you have good understanding of baseball. Nice post.
Victor
+1 @Kylotan : I think you've actually nailed down the in-game mechanics of a sport-sim better than the answer the OP has accpeted. It's a bunch of stats + players makes decisions as to which stats to pitch against each other. Players who make the better decisions, for example who to field in a game, will win more often than those who don't. In fact I'd be surprised if professional sports teams don't use some form of simulator-driven input to decide who to field in real-life tourneys.
bguiz
+1  A: 

One great thing about creating your own game is that you get to decide how the game logic is going to work. If you want the game to have a high degree of luck you can design that in. If you don't want the game to have a high degree of luck then you can design it out.

It's your game, you get to make up the rules.

David Locke
Nice, just gathering some ideas.
Victor
+1  A: 

Are you talking about a baseball game you play or a game simulator? Baseball games can be arcade-like or fantasy sports like or a blend.

I was at Dynamix when Front Page Sports Baseball was made. It was stats-based, meaning that you could play out games and seasons using the stats of the various players. That meant licensing Major League data. It used stats to influence outcomes.

There was a regular mode and a "fast-sim" mode that could breeze through the games faster.

Nosredna
Is just simulator, with no gameplay. I was thinking about creating an arcade game, but that would be different project.
Victor
Then your job is trying to match the statistics. When a batter comes up, each pitch is a dice roll based on the hitter's stats, the pitchers stats, and possibly the fielders' stats.
Nosredna
+1  A: 

I think Kylotan has the right strategy. Baseball has stats for everything. Simulate a game to the most detailed level you can manage. Combine player stats to determine a percentage chance for every outcome. Use randomness to decide the outcome.

For instance: The chance of a hit is based on Batting Average, Pitcher's ERA, etc. The opposing team's feilding percent determines the chance an out becomes an error.

Every stat you display to the 'manager' when selecting lineups should have some effect on gameplay - otherwise the manager is making decisions based on misleading information.

AShelly