Sign in to follow this  

Developing a simple soccer game, need help

This topic is 4653 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys, as you can see i am new to this forum and am rather happy to see so many people with a similar interest in game programming as i I am currently working on a soccer game of which I have started the utmost basics such as the soccer pitch designed in photoshop and set as a background on a form designed in C# I am pretty new to game programming and programming c# in particular, but really want to test myself in seeing if i could complete this game all bymyself my initial aim is now that I have the canvas ready is that I have two characters on the pitch. These characters or more appropriately players would be represented by round coins which i have also designed. Rather than jumping the gun, i want to first play with behaviours of agents, consequently I want to have one player which is a human player on one team and and an AI agent on the other team i.e. only two players on the pitch with no ball involved. I want to programm it such that when i move the human player anywhere on the pitch, the AI player manipulates the human player movement and moves accordingly. Likewise Artificial Intelligence integrated. I want to build this game in a similar way to how a person builds a car where he carries out a few mods. Tests analyses and then moves onto the next few mods. Likewise i want to get two players running on a pitch, then maybe introduce a ball and finish with say a game of 5 a side soccer Hence if someone could lend a hand in designing a game which to be honest is very exciting for me though programming is not my strongest of qualities lol help on the forum would be great as well as my msn contact which is kilo_4que@hotmail.com Regards

Share this post


Link to post
Share on other sites
the rendering/animation is one part of the problem. A.I. is far more difficult. I've been toying with the ideal of a Sensible Soccer remake (since SWOS and Kick Off 3 are my all time favorite footie game).

Collision detection can be kept to a minimum of work. Simple sphere collision tests should be more than adequate.

as far as A.I. is concerned, that's another story. You can always start off with no A.I. or very very little. To get the controls, game flow, animation working together. Rip graphics from other footie games using emulators, or design you own simple graphics. Sensible Soccer had shokingly low-res graphics, but it worked. So that's not the end of the world.

Share this post


Link to post
Share on other sites
Hi oliii, thanks for ure reply matey. Theres some very good positives i have taken from ure post ;)

Regarding graphics, I have designed my very own simple ones such as circular coins to represent players and a similar coin with a pic of a football in the centre to signify player occupying the ball.

On the subject of AI you have got it 100% correct, im also aiming to get one player to run around on the pitch with good flow and am then gona plan on some AI for an agent opposition just to manipulate movement and understand behaviours.

Consequently, I have two ideas of how to design the game but dont know weather one of the recommendations has potential of good AI. I mean i can design the game similar to the old Sega Mega Drive classic, "Italia 90" where players pass a ball around etc or I can have a new much simpler concept where the ball doesnt travel, but if a pass is possible then the player u are passing to highlights as the player in possesion i.e. u have a imaginary straight path between u and ure player. If that path is being blocked by opposition and an attempted pass is made then the opposition cause an interception.

I think to some extent the latter is easier to program that no ball object is needed but then gets difficult in algorithms and would be much of a pleasure to play lol. Plus AI wouldnt seem to be as evident which I want to introduce later due to AI being a subject of interest which got me interested in gaming and robotics such as RoboCup.

Share this post


Link to post
Share on other sites
as far as AI goes, I'm really intrigued by the boids and the emergent behaviours that comes out of the hat. Although I don't think you can do a soccer game without higher level of intelligence, like decision making (state machine most problably, to keep it simple), a simple boid interraction could be worth a try, at least for navigation.

I don't believe Sensible Soccer and other of those great 8-bit games went further than the basic concepts of football strategies. Zone defense, man marking, intercepting, one-twoes, long passes, through balls, preset attacking patterns and default defensive positions, and basically going with the flow (you have the ball and inside opponent territory, switch to offensive and push the back line forward, ect...). Maybe not even that. Get to a set position if attacking or defending, go towards the closest opponent, if nobody else challenges, move into space if attacking...

There are also individual skills, like how to beat the defender, or wait for the defender to make the tackle, or make the defender just hold on until the right time to tackle the ball (or brake a leg).

Goal (kick off 3) AI was tricky at times, and at the same time predicatable enough. Sometimes, if the A.I. had the ball and was in the offensive (the game was weird, sometimes, the AI would just 'switch on' and beat the shit out of you), the dude would try to get into the best position to either make the pass he was supposed to or shoot. You could frustrate him by just standing at the right spot and prevent the preset attack to develop. Which is fair enough. They were also very good at protecting the ball and dribling.

Sensible Soccer was a more arcady affair, and would just pass the ball around until in a good position to take a shot. The game controls were dead simple. One button, and short press for short pass, long press for a through ball or strong pass, pull the stick back at the right moment, and the ball would take off for a shot, add some swerve to aim for the spot. Very intuitive, very simple. One thing I always hated though, is to never be in control of the keeper. That's actually something hard to do.

There are lots of thing to consider to make the computer play football with more skill than kids in a schoolyard (however fun it used to be). That's just my thinking. I haven't really though on how to do a team AI for a sports game, but it's an interesting problem, and not easy to formalise.

my 2 cents.

Share this post


Link to post
Share on other sites
also, having an artificial type of physics would be weird to me. I'd personnaly prefer a normal physics, where the ball just reacts naturally, and have zone of influences of the players that attract the ball to them if close enough (depend on the skill level maybe), and if the ball goes astray (poor passing skills and under pressure), make the player who is supposed to get to the ball turn towards the loose ball (change in balance also dependent of skill level). if an opponent is in the way, then collision and he gets the ball or is deflected (if it's a shot, or strong pass, of defender interception skills poor). through balls could be a problem, since you have to target in front of the intended target. Same for long passes. That can be fixed by calculating where the ball would land, and make the closest player converge towards that spot.

Share this post


Link to post
Share on other sites
the thing ive found about developing ai in the past is to develop it incrementally, tweaking it here and there, slowly perfecting it and adding parts.

Share this post


Link to post
Share on other sites
Give me your thoughts on this:
Keep in mind that I have never done a soccer type game of this sorts and that this is just an idea.

For the ai, couldn't you just have each player have a radius of action around them. What I mean is that they follow maybe a simple "run-in-place-randomly" ai pattern while the ball is not in their "radius of action" and when it is they follow the ball until they are "connected to it" then they could make decisions based on teammate position on the field as well as the general location of the opposing goal. Given distances from the goal they can either shoot if they are within a certain area or pass to a player that is in that area. This seems like logical way to do it but tell me any faults in it... as I know there are some :)

toXic1337

[EDIT]
This is what oliii is saying... (srry didn't read all of your posts oliii)

Share this post


Link to post
Share on other sites
Quote:
Original post by oliii
as far as AI goes, I'm really intrigued by the boids and the emergent behaviours that comes out of the hat. Although I don't think you can do a soccer game without higher level of intelligence, like decision making (state machine most problably, to keep it simple), a simple boid interraction could be worth a try, at least for navigation.

I don't believe Sensible Soccer and other of those great 8-bit games went further than the basic concepts of football strategies. Zone defense, man marking, intercepting, one-twoes, long passes, through balls, preset attacking patterns and default defensive positions, and basically going with the flow (you have the ball and inside opponent territory, switch to offensive and push the back line forward, ect...). Maybe not even that. Get to a set position if attacking or defending, go towards the closest opponent, if nobody else challenges, move into space if attacking...

There are also individual skills, like how to beat the defender, or wait for the defender to make the tackle, or make the defender just hold on until the right time to tackle the ball (or brake a leg).

Goal (kick off 3) AI was tricky at times, and at the same time predicatable enough. Sometimes, if the A.I. had the ball and was in the offensive (the game was weird, sometimes, the AI would just 'switch on' and beat the shit out of you), the dude would try to get into the best position to either make the pass he was supposed to or shoot. You could frustrate him by just standing at the right spot and prevent the preset attack to develop. Which is fair enough. They were also very good at protecting the ball and dribling.

Sensible Soccer was a more arcady affair, and would just pass the ball around until in a good position to take a shot. The game controls were dead simple. One button, and short press for short pass, long press for a through ball or strong pass, pull the stick back at the right moment, and the ball would take off for a shot, add some swerve to aim for the spot. Very intuitive, very simple. One thing I always hated though, is to never be in control of the keeper. That's actually something hard to do.

There are lots of thing to consider to make the computer play football with more skill than kids in a schoolyard (however fun it used to be). That's just my thinking. I haven't really though on how to do a team AI for a sports game, but it's an interesting problem, and not easy to formalise.

my 2 cents.


Hi Oliii, first and foremost i would like to thank everyone for the excellent contributions. Furthermore regarding your above post i would say yes of course without higher level of AI the soccer game would be pointless in implementing as an AIFG application or more so it would merely be impossible to implement such a game if thurough AI is not introduced however, in my case the game is not to be too detailed. I am just wanting to see the powers of AI in gaming.

I think i may have started the thread a little misleading lol, I want to implement a game but not something with too much involved, something simple such that the final game would be played 5 v 5 with simple passing and shooting, no offside or fouls involved if you get what i mean. However as mentioned before and following from what Genjix says, my intentions are to start simple but build upwards in the shortest time possible. I initally want two players on a pitch without a ball running around where the human player is controlled and the AI agent moves by manipulating human player movements just to test the waters. I also want this game to be a learning curve for myself as I am initially coming from a mathematical background and have learnt languages such as Haskell and Prolog with Propositional Calculus. Its just an interest to do something in programming and I set myself a target in completing this "Simple" soccer game

To Toxic: matey what you have said is more or less what ive also had in mind but to keep things simple i designed my players as coins which may now be a problem in knowing which way the player is actually facing lol.

Also to add guys, although the ideas are excellent and i myself have done a fair bit on the design, what im struggling with is what ud call the basics. I have designs etc but i firstly need to know how to actually get the little coins ive designed onto the football pitch to be able to control them. Or to make things simpler i need one coin on the pitch which i can actually control so that i can at least say, wayhay I have one player occupying the pitch

Regards

Share this post


Link to post
Share on other sites
look into the SDL library for anything related to 2D sprites. YOu should get your players onto the pitch in no time. That's for C-C++.

if you're using c#, I can;t really help you, but there must be simple ways of putting graphics onto the screen.

Share this post


Link to post
Share on other sites
lol everyone i know is more into c++ and i find it very talented for someone to be able to do c++ with all its multi inheritence involved.

So what your saying oliii is that i should be able to find the coding on the site???

Share this post


Link to post
Share on other sites
libsdl

SDL for c#

SDL.Net

SDL is basically a simple API to do quick prototypes of 2D games. It handles inputs, sounds, graphics for you, like loading bitmaps and rendering them. There are loads of examples and tutorials on how to get a simple SDL demo working.

As far as coding basic 2D game logic, I guess you'll be better off looking at SDL examples.

Share this post


Link to post
Share on other sites
Two cent here,

Since you are trying out some Ai stuffs, and I BELIEVE that graphics may not be your upmost priority, maybe you can use a engine or maybe even director/flash to create a simple game with 2D sprites...

As you developed further, you may then want to move on to some "in-depth" programming on graphics and then finally the rest of the stuffs like audio, etc....

i think the use of thrid party software for a initial startup will help a lot, especially when you are able to create some things visually.. <that's help to "boast" your ego from time to time and strive you to create more and better games....>

(* for the sentence above in <>, please do not see it as a negetive feed-back, just how i feel when i'm learning and this do help my rest of friends to pick up game stuff)
;)

Share this post


Link to post
Share on other sites
Hi guys, i finally have been trying to get a player moving on the pitch but am experiencing some errors.

I was trying to get a player moving up down left and right using the arrow keys. I was using bits of code from another proram which has behaviours of an object exactly as i want my player to behave on the pitch but i for some reason am experiencing an error on something known as KeyCode.

If it is possible can someone have a look at it for me please.

my msn is kilo_4que@hotmail.com

regards

Share this post


Link to post
Share on other sites
its ok guys lol, i realised a silly mistake i made which was that i didnt have KeyPreview set to true

So now I have a player who i can move up down left and right well not really move him in them directions but direct him in them directions as i am using a timer method which makes the player move automatically in a straight direction and the the arrow keys just direct him in moving in the required direction.

What i now need to do is be able to move the player forward manually rather than let the player move itself and i also want to figure out how i can position the player anywhere within 360 degrees rather than 90 degrees left or right using the arrow keys

Regards

Share this post


Link to post
Share on other sites

This topic is 4653 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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