Jump to content
MakeWebGames

Online Cricket Management Game


unknown123

Recommended Posts

Hi

I am creating a online cricket management game where a user competes with other teams that are manged by other users from all around the world. The users will be able to control their finances, coaching their team by hiring coaches, buying and selling players from other users to improve their team. The managers (users) will be able to watch a live scorecard & commentary as the game is played.

Something similar www.cricketclubmanager.com & www.battrick.org to this but better.

I have already have started designing my website, so far i have done the main pages of the website, fully working database and the login system using PHP/MySql.

The part that I am stuck on is the coding for the online game itself, which I have not started at all. I have no idea how i am going to all the calculations for the game, the league system, player stats, training players. Can anyone help me with this or head me the right direction.

Thanks In Advance

Link to comment
Share on other sites

Re: Online Cricket Management Game

I was going to do something similar, but for a different sport, then realised I wouldn't have a clue how to do the actual games... the trading/training etc would be easy enough, just figuring out the calculations and algorithms for the game would waste too much time

Link to comment
Share on other sites

Re: Online Cricket Management Game

Maybe have it so that certain players have a % chance of scoring, a home run, 2 runs, etc etc. or whatever you have in cricket. So, just alot of rands, such as

 

<?php
$runs=rand(1-10);
if  {
$runs <= 7;
//mySQL query here
}
if {
$runs > 7;
// mySQL query here
}
?>

 

Im still only learning =p

But couldn't you do that for each player, so that it's more a game of luck, and being tactical about which players you buy, more expensive ones have a better chance of hitting, say 6 runs.

The mySQL query would have to update the score board, and most runs wins? Also needs a chance of the person being hit out, or cought out, so fielders would have a chance of catching the ball. More expensive ones with a better chance etc.

Just an idea, like I said, im still learning :-)

Link to comment
Share on other sites

Re: Online Cricket Management Game

Thanks for the idea but i was thinking about doing by the deliveries the bowler bowls, for example if the bowler bowls a bad delivery, the batsmen will score more runs than a bowler bowling a good delivery also considering how good the batsmen/bowler are into the equation. Don't know if this possible.

Link to comment
Share on other sites

Re: Online Cricket Management Game

Hmm. Maybe sumat along the lines of;

<html>
<head></head>
<body>
<?php
// the batter is better than the bowler in this case (better players are more expensive)
$bowlerskill = rand(1,10);
$batterskill = rand(11,20);
$badbowl = rand(5,10);
$badbat = rand(1,3);
$bowl = $bowlerskill - $badbowl;
$bat = $batterskill - $badbat;
$runs = $bowl + $bat;
$cobbo = rand(1,100);
if ($cobbo < 50) {
echo"You were bowled out!
";
}
if ($cobbo > 50) {
echo"You scored $runs runs!
";
}
echo"<a href=points.php>Try again</a>";
//replace the "echo's" for mySQL querys!
?>
</body>
</html>

 

Ermmm, gime a few mins to try and work sumat out...

There we go!

Now just make each of the rand() different fro the skill of the bowler / batter.

There are probably alot better and more efficient ways of doing this, but im only a noobie still, so if anyone can show me a way i could improve this, please let me know, always happy to learn.

See the script run here: www.myhostingplan.org/points.php

+1 if this helped anybody please :-)

Link to comment
Share on other sites

Re: Online Cricket Management Game

 

Maybe have it so that certain players have a % chance of scoring, a home run, 2 runs, etc etc. or whatever you have in cricket. So, just alot of rands, such as

 

<?php
$runs=rand(1-10);
if  {
$runs <= 7;
//mySQL query here
}
if {
$runs > 7;
// mySQL query here
}
?>

 

Im still only learning =p

But couldn't you do that for each player, so that it's more a game of luck, and being tactical about which players you buy, more expensive ones have a better chance of hitting, say 6 runs.

The mySQL query would have to update the score board, and most runs wins? Also needs a chance of the person being hit out, or cought out, so fielders would have a chance of catching the ball. More expensive ones with a better chance etc.

Just an idea, like I said, im still learning :-)

Quite a few errors in that, This is what it should be...

 

<?php
$runs=rand(1,10);
if  ($runs <= 7)
{
//mySQL query here
}
if ($runs > 7)
{
// mySQL query here
}
?>
Link to comment
Share on other sites

Re: Online Cricket Management Game

 

Maybe have it so that certain players have a % chance of scoring, a home run, 2 runs, etc etc. or whatever you have in cricket. So, just alot of rands, such as

 

<?php
$runs=rand(1-10);
if  {
$runs <= 7;
//mySQL query here
}
if {
$runs > 7;
// mySQL query here
}
?>

 

Im still only learning =p

But couldn't you do that for each player, so that it's more a game of luck, and being tactical about which players you buy, more expensive ones have a better chance of hitting, say 6 runs.

The mySQL query would have to update the score board, and most runs wins? Also needs a chance of the person being hit out, or cought out, so fielders would have a chance of catching the ball. More expensive ones with a better chance etc.

Just an idea, like I said, im still learning :-)

Quite a few errors in that, This is what it should be...

 

<?php
$runs=rand(1,10);
if  ($runs <= 7)
{
//mySQL query here
}
if ($runs > 7)
{
// mySQL query here
}
?>

 

Yeah sory about that, it was late and I didn't bother to check the script at all.

+1 If it helped please, every little bit helps :-)

Link to comment
Share on other sites

Re: Online Cricket Management Game

 

I can't find no option to do that. Do I need to make a certain number of posts to get that option or anything else?

You cannot see...

Force: +3/-2

[Light] [Dark]

?

Before, i could only see...

Force: +3/-2

... before i cannot see the light/dark option until i made my 5th post.

Link to comment
Share on other sites

Re: Online Cricket Management Game

 

I dont exactly understand what piece of the puzzle you are addressing but...

$x=rand(1,100)

if($x <= 50)

{

}

else if($x <= 80)

{

}

else

{

}

Sorry, but that can't be right, my head might not be screwed on right here, but, doesn't that mean, if somone scored 40, theyd get the message from both if statements?

 

<?php
$batter = rand(1,100);
if ($batter <= 50) {
echo"whatever1";
}
if ($batter >= 51) {
echo"whatever2";
}
if ($batter >= 80) {
echo"whatever3";
}
?>

 

Hmm, I don't know how to make it so that, if it's greater than 51 but less than 79, anybody help me with this?

Link to comment
Share on other sites

Re: Online Cricket Management Game

 

Got it!

 

<?php
$batter = rand(1,100);
if ($batter <= 50) {
echo"whatever1";
}
if ($batter >= 51 And $batter <= 79) {
echo"whatever2";
}
if ($batter >= 80) {
echo"whatever3";
}
?>

 

 

<?php
$batter = rand(1,count($batters));
if ($batter <= 79) echo 'Batter: ', $batter <= 50 ? 'Whatever1' : 'Whatever2';
else echo 'Whatever 3';
?>

'And' is not a valid operator, '||' is.

Link to comment
Share on other sites

Re: Online Cricket Management Game

Well, i haven't started any coding at all for my game because I am still learning PHP (just started reading 2 books called "PHP Game Programming" & "Sams PHP & MySql Web Development"). Don't know if they will help me so at the same time I ask questions on here and I already have learnt a few things.

Link to comment
Share on other sites

Re: Online Cricket Management Game

 

Ah o.k. And no i don't like I said, im still learning. But I Just went to php.net and it said there than And is a valid operator, and the code worked perfectly when I ran it.

And is a valid Mysql operator yes, for php no!

I actually do not think php.net will actually say it is valid.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...