EvilZone
Programming and Scripting => Projects and Discussion => : halfblood November 25, 2012, 01:28:30 PM
-
i want to build a web application. its an engine that simulates a match based on the statistics of each team. iv decided to go with asp.net that is vb.net. im not building for commercial purposes but generally for fun and also because i can. so anybody ever thought of it?? perhaps might want to share some views/ideas?? i want to see how people would approach this,might also give me some ideas. so post away how you would do it... thanks :)
-
First things first, asp.net != vb.net. and if you dont understand != then your not ready for this project. Idk what your experience is and idc, I'm just going to assume you know what your getting into and have the experience needed for this. That said, here's what I would do and I'm applying it to soccer cause I don't like american football and you never specified :P
The math would be the hardest part, a first step would be applying a point system to each stat for a team. So on a scale of say 10 points per stat, the better they are the lower their score. A 1 is a perfect score and 10 is the worst. This will help keep numbers low so the program runs better. So lets say you have five stats: pass completion, possession, shooting percentage, goals scored, and total game won percentage. Now well do this for Barcelona:
Pass completion: 2
Possession: 1
Shooting percentage: 4
Goals scored: 3
Game won percentage: 3
Just an approximation made up off the top of my head, real stats would be much different.
Now after doing this per team you would then have to do some.math to calculate the percentage chance of a win between any two teams. At first you'd calculate this just on stats, but later you'd have to tweak it to account for the unpredictability that makes sports so lovable. Id have to think harder about how to do that before I could tell you. Your better off doing it yourself imo.
Now when you build the program your going to have to make sure your output is backwards, low scores are the *winners*.
Of course to make it more accurate, you'd need to look at other stats and possibly change how you do point percentages. Maybe make 100 the total per stat for more accurate results, add in stuff like whether the team usually wins in a comeback or not etc.
Its a huge undertaking mate, but if its something your into then good luck. I honestly think the hardest padrt will be the math as long as your keeping its graphics simple. Cheers
-
As i said it is just for fun. so there really isnt a right way or wrong way to do this. nobody is going to test me for this. anyway my point of approach was actually the opposite, 1 is the lowest skill point while 10 might be the highest. so we go for a player say cristiano ronaldo,
speed 10
handling 10
attack 10. you get the average of this which is 10 then 10 is a perfect set, you get it into percentage which is 100% so it would now be 10=100%.. then you get a random number between 1 and 100 and if the random number <= player skill percentage then he scores a goal. anyway thats just my view. again i say i dont need tutorials or lectures in this just other peoples views. but thanks chap i appreciate it certainly you have given me more facts that should take into account. :)
-
Skill set still needs randomness. No one is 100%, plus you need to factor in things such as weather, moral, homefiled advantage, illness, other players effecting the outcome, wear/tear such as longevity of the game, crowds rooting/booing, previews games played, etc...
I would suggest getting actual stats for all games and then average then add probability of only a couple factors. Once you have the code working, add more factors, making things modular/OOP. It might be a great exercise to learn programming whether it fails or not. I can even see a few places where something such as recursion or sorting algorithms could come into play.
-
yea you could do it 1-100 with 100 being the highest. but your code will be more efficient if 1 is the highest, because lower numbers compute faster. Will it make a difference in this program? No. Is it a good habit to get into? Hell yea
-
actually what i had in mind was a rugby game. it lasts 14mins. so during that time i loop around all players with calculation of their stats. the game shouldnt be too predictable and it also shouldnt be based on luck too much. generally make it such that the higher stats you team has the higher chambes of you winning the game. after the main stats coding is where i can factor moral,energy,weather,fans.. but to me the tricky parts gets to automation using a time control. id want after 7mins they go for half time then resume play automatically after 2mins for the rest of the game... should be a fun project..:) actually il go with 1 as the highest, generally consumes less memory,
-
a question. so i got the match engine sorted out. and btw i decided to go with php. so how can i now implement it so that all matches in all the teams that have registered play out regardless of whether the owner of the team is online or not?
-
Im not sure if I understood the question correctly, but couldn't you just not specify such a condition in the first place? Perhaps a code sample would help, though. I can't help with what I can't see! :)
-
its some what like a sport management game. now suppose it has about 1000 teams. how do i get the match engine to simulate all the matches at the same time, probably 500 matches
-
It would be a lot easier if I could see an excerpt of the code. :)
-
It would be a lot easier if I could see an excerpt of the code. :)
There is.no.code atm, he's asking for ideas to generate it. Yhink.of what he's asking for as a function, a black box within a larger piece of code then write out the logic you would use for it. Its a good habit to get into, create a logic flow chart before actually writing the code to.reduce your logic errors.
@OP
It is impossible to do 500 calculations at the exact same.nanosecond, comouters just don't work tthat way. However if you just use a for loop, or a do while, to repeat the calculations for each match then to the end user it would appear simultaneous.
What I would do:
Create a random number genrator function then do this:
Do
CallRandomNumber()
Calculate here
X --
While (x > 0)
Roughly something like that, the random nunber generator would he the "luck" factor and is random.so its not human biased. Its not truly random since no computet can ever really ve, but its close enough for now
-
Well you could do multiple calculations at once kinda. Use threading. It is CPU time share, or parallel processing if you have multiple cores.
-
Well you could do multiple calculations at once kinda. Use threading. It is CPU time share, or parallel processing if you have multiple cores.
It's really too complicated though for this project, there is no need to use multi-threading at this point, he needs to get it working first. Especially as the OP sounds like he's a bit new to coding...
Yes, multi-threading is possible. But honestly, not worth it here
-
It's really too complicated though for this project, there is no need to use multi-threading at this point, he needs to get it working first. Especially as the OP sounds like he's a bit new to coding...
Yes, multi-threading is possible. But honestly, not worth it here
I agree threading is a bit over le head. But with what was asked I gave appropriate answers. Like Daemon said, stick with looping for now. But if you have 1,000 sets to test, I would cut that down a bit if your going php.
-
i already got the code for the match engine sorted out.
just an example for you to get the point..
if (team1attack>tean2attack)
{ $team1points=7
$team2points=3
}
thats just a basic example...
so lets say i have about 1000 team profiles on my website and i want the all matches to take place at the same time,how do i get this done? such as is on www.blackoutrugby.com (http://www.blackoutrugby.com) or hattrick.... that my question, at the momment
oh and i really appreciate the contribution
-
/sigh
Go and reread my post and techb's we explain it in there man. You are not going to ever ever ever be able to have 1000 matchups take place at the same time, nowhere near enough threads in a home computer. Even the engines on those sites you link do one match at a time, it just doesn't appear that way to a user because the calculations are done so fast that it appears instantaneous to us slow-ass humans.