View Single Post
Old 11-07-2014, 12:30 AM   #43
Join Date: Dec 2003
Location: Sydney, Australia
Been awhile since I last posted, but I've still been working away. The actual game engine is coming along nicely. I've designed a nice little code block that steps the sim through each step of a play. Each step has court positions for the offense, an attribute that determines roughly how long the step would take to run, and things like screens/passes/cuts etc.

{"playid": "quick_1_pnr", "step": 001, "offpos": {"pos": {"1": 12, "2": 14, "3": 10, "4": 4, "5": 12}}, "passtarget": 0, "shottarget": 0, "screen": ("5", "1"), "step_duration": 1, "possession_ballhandler": "1", "cut": (0,0)}
I've edited it a little as it's actually one dictionary entry embedded in a much bigger dictionary, but that should give you a fairly good idea of how it works. It may seem weird that position numbers are strings rather than integers, but it's due to something I coded while still a n00b and I actually like it now because it helps me easily pick numbers that refer to basketball positions as opposed to variable values.

The code block iterates through each value and actions anything required. The coolest thing about this is that, by storing the steps of a play in this format and separately from the main code of the game engine, in theory it opens up the door as far as allowing people to design their own plays. Obviously that's a "long term" thing, but it's something that would be cool to do if I could do it right.

Outside of that, I've been dabbling in other, more long-term, areas of the sim, especially when I get stuck on something or burnt out tracking loop control issues. I've put a lot of work into the generation side of things as far as players and teams go. After a lot of website text scrapping (thank god for rabid football-loving fans worldwide and their wiki site updating skills!) I have name files and country/city files for about 120 countries.

My idea is that you will be able to enable/disable any country's national league. Enabling it will generate a league randomly, at this stage made up of the same number of teams that the country has IRL in it's national league, as well as up to two divisions. It would assign a team to a weighted random city from that country based on population. Turning off a country would mean that there is no national league, but each country would still have a pool of players generated to make up national teams etc. Of course I would also plan on including the ability to manually edit a league to match reality, but I need to figure out how that will work for teams located in cities not included in the initial file - I have a hacky method of weighting the random choices that is quicker than the standard way to do it (given the size of the numbers that make up populations), but does not lend itself to easily allowing a user to simply append a city to a csv file.

On the player side, each country has 3 attributes that directly effects player generation - talent (1-5, from poor to NBA), height(1-short, 2-normal, 3-tall), and athleticism (similar, 1-3). So, for example, USA would be a 533 national, while China might be a 232, Australia a 322, South Korea, Spain a 422, etc. I have coded real early generators for all of the above, but until I'm at the stage where I can start simulating entire games, let alone seasons, it hasn't really been possible to judge how balanced it is.
Politics, n. Strife of interests masquerading as a contest of principles.
--Ambrose Bierce
Groundhog is offline   Reply With Quote