• Recently Browsing   0 members

    No registered users viewing this page.

Sign in to follow this  
Adidarw

[PHP] Designing new hockey management sim

Rate this topic

Recommended Posts

EDIT: Since I've been working on this, I've greatly changed the way I've been writing this. So what was originally posted below is not necessarily how things are still going to be working in the game. But the concept of what I'm making as a hockey game is still there.

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:

-- Penalties

-- Shots

-- Goals (who scored, who assisted, etc.)

-- Sense of time

-- etc.

- 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

Share this post


Link to post
Share on other sites

Are you using any php frameworks? (like cake or codeignitor)

You probably don't want to do this all by hand. Have prebuilt classes, controllers, etc will be much easier on you.

Edited by Fatal

Share this post


Link to post
Share on other sites

Doing everything by hand is how I've always done it. I've never taken on a project that was this big though.

I have changed the "gameplay" concept a bit since what I originally posted seemed way out of my league once I actually started trying to put things together. Now I'm going with a simpler way of simulating a game.

Basically it's gonna be a linear "rink" and players battle each other in a rock/paper/scissors fashion, one by one. There are some other factors in there so it's not technically as simple as rock/paper/scissors, but it's a lot more simple than what I originally had in mind. I'm building ideas and knowledge as I go. Once I get a working product and greater knowledge I can work with I'll think about changing the philosophy of how a game is played out.

Also, I figure instead of just a single player game it would be more popular to involve other people. I want to somehow get other managers in a league involved in public decisions like trades, rules, press releases. This is of course all overhead stuff I'm not really thinking much about until I get the simulation aspect down pat. Without a good simulation base, the rest is useless.

Share this post


Link to post
Share on other sites
Good Luck.

EHM fans everywhere will be rooting for you!

Agreed dude! I'm in my 3rd or 4th dynasty of EHM 2007. Haha. It sucks when a player like Eberle goes undrafted, and sucks bad after I sign him. Hahhah.

Share this post


Link to post
Share on other sites

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