how to make a soccer game in 2D with java?

Hi

I’m new and I want to make a simple 2D soccer game using java ???

Can you help me please ?

Cordially

  1. Learn Java
  2. Open Eclipse/Netbeans etc.
  3. (Optional) Use tutorial.
  4. Start.

Your question is really vague…

Jimmt’s answer was a little bit vague. I can do better. ;D

No. We can’t help you.

(unless you give us more information)

Thank you for answered HeroesGraveDev et jimmt :slight_smile:

I know java programming
my problem is programming multithreding, I’m not very good :’(
To begin, I want to know how the java classes organized for the game of soccer?
What are the classes that I have created?
Should I create a UML diagram? if yes how?

I know UML, computer science student I

Here I hope to have had a little more specific

Cordially

Don’t worry about multithreading too much, it’ll honestly make your game slower if you don’t get it perfect, not to mention that 2D starter game probably doesn’t require too much optimization anyways.
UML diagrams are ok, but usually I just envision/draw my class architecture. Everything falls in place after that.
If you’re a cs student, I’m kind of curious as to why you don’t know which classes to make, but I would start with a main class (SoccerGame or something), a Player class (could have both same-team and opposing team classes), a Team class with a list/array of players, a Ball class, and maybe a custom swing component extending JFrame or JPanel.

You’re right I’ll start doing classes you just montionner then I’ll show you the evolution of my work in a few days so you can tell me what to change :slight_smile:

Perhaps it’s merely a language barrier, but if you already know java programming, you wouldn’t need to ask how to organize java classes for a soccer game. This isn’t to say every programmer knows how to organize those classes, but experience in design means you should at least have a rough idea.

Learn to walk before you run, write it without multithreading first.

Throw your UML tool out. Useful as UML is for explaining designs to others, it’s pointless overkill for simple single-developer apps.

Start simple, and with a high level library like Java2D, LibGDX, or Slick2D

I must agree with sproingie.

I think you need to read up on how games work. Probably doing a quick Pingpong game will teach you a lot. I base this on your reference to multithreading in a soccer game, which leads me to believe that you think a game is this living thing, which has multiple processes going at once, like the ball moving by itself in one thread and each player using his own thread. This is NOT the case, and this approach should never be used.

A game normally consists of a gameloop, which updates all the processes in the game, usually moving things along using a deltaTime (the time elapsed since the last update). This can be done each frame or as often as you’d like, depending in which type of gameloop you implement. There are plenty of good threads about gameloops on this forum, and I’m sure you can find a simple Pingpong tutorial somewhere on the web.

Good luck with it!

Max Buckland wrote Programming Game AI by Example which is a great introduction to various AI techniques. His chapter 4 is called “Simple Soccer” where he implements the AI for a simple soccer game. The code is in C++ but you should be able to port the class structure over to Java pretty straight forwardly.

With some googling, it looks like someone has gone through the effort of porting the examples to Java. I can’t vouch for the quality of the code as I have not looked at it but it should give you a good head start.

One doesn’t simply come to Java forum and ask the best organized classes. No. It’s same with you come to comic-con and ask with loud speaker who is the best super hero.

You forgot something.

@OP: Rebirth is right. You need to think for yourself sometimes. (Oh wait, he meant that you get an argument. Oh well, now you have another reason)

Thanks, save my time for making meme.

Unless you’re a minion on an enterprise dev team, dont bother and just do it. The reason why ppl encouraging good organized classes is because they pity on you, who struggling on debugging and hurt own eyes with dat scrolling and ugly code. But if you don’t mind it and just need to get thing done, then dont worry.

Said minions are well advised to not bother either and just do as they are told to. Makes their boss happy and saves them headaches :stuck_out_tongue:

That’s if you have a boss that knows how to code. :slight_smile:

I had a software manager once that didn’t know anything about coding and determined your performance based on lines of code…it was hell.

-Pickle

Yeah me too. It happened when I made an enterprise for someone who non-computer based. Revisions hell.

You had a manager that read through your code? That in and of itself is strange to me. Unless you’re saying he gauged your performance based on wc -l, like the old joke, in which case I don’t see the problem - that’s easily abusable in your favor…

He didn’t go line by line, but basically I was working on a system that was in a maintenance phase, and he would look at the printed copys of code where your changes were highlighted. If there wasn’t much highlighted text, he would wonder “what were you doing all day?”

He was a bitter bitter pill :slight_smile:

-Pickle