Before I start:
1. Yes, I know about the NHL:EHM game and yes I play it
2. Why am I doing this? Because hockey and programming are hobbies of mine
3. Show me a decent open source hockey management simulator...
I'm putting forth an effort to create a new hockey management simulation game in PHP. I'm also learning the PHP language at the same time. I have some programming background so I understand how code works, the parts that are taking some time are looking up syntax and thinking of ways to go about coding scenarios.
The basic idea I have in mind to go about coding a game being played out is as follows:
- A game is a series of 3600 loops (each loop representing 1 second, totaling 3600 seconds or 60 minutes)
- Every second an action can happen such as skate forward/pass/shoot/pokecheck/hit/etc.
-- The location of the puck will be irrelevant (ie. if the action is "pass", the pass will happen instantly, the game will not wait a second or two for the puck to reach the player)
- The "rink" is a 200x85 grid (dimensions of an NHL rink in feet)
-- For simplicity sake, it's just going to be a rectangle, so no rounded corners
-- The game is going to be totally simulated, so there will be no actual visuals of players skating around, etc.
-- Players and certain "checkpoints" on the ice are represented by grid coordinates (the lower left corner of the rink would be 0,0)
- The purpose of the rink dimensions and 3600 loops is for a means of generating statistics for things such as:
-- Goals (who scored, who assisted, etc.)
-- Sense of time
- So far I only plan on the game being single player, meaning no real interaction with other people... possibly it will support a "player per team" format and each "installation" of the game would contain a different league. But I'm nowhere near having to really worry about this yet
- I plan on letting anyone and everyone take my code to modify it or do whatever to it to improve it when it's finished (or even during development if need be)...the more who can contribute the better it can potentially be.
Right now I'm still writing several "mini-scripts" just to get idea on how I want to code actual scenarios in the game, so I haven't actually started writing any code that will be used. I have a simple script that simulates a player skating laps around the outside border of the rink. The code for this is extremely simple, especially considering the rink is a rectangle.
I also have a script simulating a player taking shots on a goalie. Each player has only 1 attribute depicting how "skilled" they are. I can modify these attributes and after looping it several hundred times, the number of goals vs. saves will change accordingly. (Just because the offenders offense attribute is higher than the goalies defense attribute, doesn't mean the offender should score on every single attempt...however, an offender with a rating of 96 scores fairly often against a goalie with a rating of 60. If you drop the offenders attribute to a lower value like 70 he will still have greater skill than the goalie but the goal:save ratio will drop significantly). With this being said, remember I'm simply learning to lay bricks as I'm building a house. Obiously (in my mind) there are more things to consider in an actual game scenario, but in time it will become more complex.
My next obstacle is to add a defender into the mix between the forward and the goalie. Obviously I need to adjust the algorithm to make it more difficult to score if there is someone between the offender and the goalie. Other things to take into account in the future are the shooters distance from the net and his angle (I'm already loathing trying to figure out "shooting at the net from a 45 degree angle with a defender in the middle". In a grid format, how do you determine if the defender is "in between"?? hopefully I'll solve that one). As you can see, these problems are becoming more and more complex. Hopefully I'll come up with ideas as I solve the more simple problems.
Unfortunately (or fortunately, for the sake of originality) I can't find any open source hockey sim games to get any ideas from. I'm hoping there are some people here with some PHP experience, or any programming for that matter, who can possibly provide assistance when I need it. Even if you have no programming experience but are very educated in the game of hockey, you can help. I have never actually played real organized hockey, but OH do I love to watch it. I have little to no sense of what structure or plays are happening on the ice...so you hockey players out there, you can me on that part when the time comes!
If there are any programmers out there who think I'm going about this totally in the wrong way, please let me know. That's what I'm here for. The more I think about this, the more I wish I could think of an easier way to get the statistics that I want. Not that I'm necessarily looking for the easiest way to do things, just the best, most efficient way. Could an experienced programmer take this idea and write something and finish before I could...yes. But I'm just doing this for the fun of it.
Edited by Adidarw, 30 July 2009 - 08:29 PM.