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?
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.
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 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.
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.
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.
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?”