Sign in to follow this  
Rani Giro

Implamenting a code

Recommended Posts

Im trying to make a game but i dont know how to implament it into a code.

i have learned the language but in that sense i dont know how to implament it into an actually working game code would like some help if possible.

Thanks to all who help.

Share this post


Link to post
Share on other sites

Exactly which language have you learned?

What kind of game are you trying to create?

Where are you stuck? Can you be more specific?

I have learned java and i wanna build a simple game like pong or something but dont know how to start the code.

Share this post


Link to post
Share on other sites

What have you tried? Using a popular search-engine I found this set of tutorials (first thing it returned) for, what appears to me, your exact dilemma, but if you want to figure it out with a little less guidance, then asking more specific questions and telling us what has and hasn't worked for you is going to help us best help you.

Edited by NoAdmiral

Share this post


Link to post
Share on other sites

Im trying to make a game but i dont know how to implament it into a code.

i have learned the language but in that sense i dont know how to implament it into an actually working game code would like some help if possible.

Thanks to all who help.

I'm not sure how much help you can get here, since your question is analogous to "I learned carpentry, can someone tell me how to build a house?"

 

You need to give more information and ask more specific questions.

Edited by 0r0d

Share this post


Link to post
Share on other sites

First construct the design of the program. Then follow the design by implementing them. Find flaws in designs then you go back to the drawing board to redesign. Try again to implement the new design. Repeat the process until you get the product you want. 

Share this post


Link to post
Share on other sites

You'd want to familiarize yourself with some sort of graphics engine first. Google's saying JGame.

 

Once you've done that, you should outline what you want your program to have, like owiley suggested.

 

Ideally, you'll be able to apply the general programming concepts you've learned to make Pong. If you're at this point and really have no idea what to do, you should probably review the basics. The Java Documentation is a good place to look, and I'm you can find more resources with a quick search.

Share this post


Link to post
Share on other sites

I have learned java and i wanna build a simple game like pong or something but dont know how to start the code.

 

Decide what you want to make first. Pong is good game to start with.

Even make sure that you are enough familiar with Java first.

 

These resources might be helpful for getting a clear understanding:

Now that you have your language (assuming its java) and game (assuming its Pong) fixed, you can move ahead.

You must now get yourself familiar with the concept of game loop.

These resources might be helpful:

Next, you have to learn the mere basics of input handling (keyboard and mouse), 2d graphic rendering.

 

In case of Java, you have the option of awt or Swing for input handling (and more) and Java2d for 2d graphic rendering.

Or if you want a all-in-one solution then go for Slick2d!

 

After a bit of knowledge about these things you can set to create your own Pong game. You will have to spend some time thinking about how you can make the game work. And then you can implement it. But afterwards make sure to refactor it and also download a professional version, so that you can compare.

 

As you go on creating games, you can simultaneously learn about audio, multi threading, networking, controllers, etc. Good luck!

Share this post


Link to post
Share on other sites

What have you tried? Using a popular search-engine I found this set of tutorials (first thing it returned) for, what appears to me, your exact dilemma, but if you want to figure it out with a little less guidance, then asking more specific questions and telling us what has and hasn't worked for you is going to help us best help you.

 

For starting out, and for creating a simple game like Pong, it is best if one doesn't directly go for tutorials.

He should instead spend at least some hours on pen/pencil and paper trying to figure out how his game would work.

Share this post


Link to post
Share on other sites

 

What have you tried? Using a popular search-engine I found this set of tutorials (first thing it returned) for, what appears to me, your exact dilemma, but if you want to figure it out with a little less guidance, then asking more specific questions and telling us what has and hasn't worked for you is going to help us best help you.

 

For starting out, and for creating a simple game like Pong, it is best if one doesn't directly go for tutorials.

He should instead spend at least some hours on pen/pencil and paper trying to figure out how his game would work.

 

I didn't mean to imply that following a tutorial was the best idea. I was just providing options (and suggesting that there are existing answers to a lot of questions).

Edited by NoAdmiral

Share this post


Link to post
Share on other sites

I would like to suggest the LibGDX framework. It is a well documented game framework for Java and something like pong can be easily written with it in a view pages of code. Just download the LibGDX setup tool and Android Studio. Create a project with the setup tool and import it into Android Studio and start coding your game.

 

However, guessing from your posts I don't think you really know how to program in Java, otherwise you would probably not ask this question. Yes you might know some syntax but that is really not enough to start out. Try to learn the basics of java first, there are plenty of online sources, I am self-thought myself.

 

  1. Basics of java, knowing how to iterate a loop does not make you a coder.
  2. Know when and how to apply proven design patterns for your games.

There are plenty of tutorials for LibGDX where you will be creating a complete game but not really needed if you know how to read documentation. Pong is really simple and it is a great pick to start out. Pong, at it's core, requires only 3 classes.

 

  1. A Paddle class, here you put the input controls and perhaps a image to represent the paddle.
  2. A ball class, the ball needs to know about it's environment so store references for the obstacles (paddles) and the level area here. Whenever the ball makes contact with these you invert either X or Y.
  3. A screen class where you can show scores/lives and initialize objects from the previous 2 classes.

Good luck, whenever you are stuck with your code just post it here on the forums and I am sure you can find some help.

Share this post


Link to post
Share on other sites
When it comes to design patterns, perhaps these aren't right for a newbie.

Design patterns are often misused. People go out of their way to find ways to fit their code to a design pattern, rather than looking at code that's already written and identifying patterns within. This leads to over engineered code that uses patterns for patterns sake. This is obvious when you see code with a class called Observer or such.

Learn to code first then worry about design patterns...

Share this post


Link to post
Share on other sites

Learn to code first then worry about design patterns...

 

Thats why I put Java 101 prior to design patterns. Programming any game requires you to at least recognize design patterns since LibGDX and other frameworks will use them. Yes you could tell a man to just .addlistener(new Listener() { ... }) but I rather tell a man how to fish instead of catching one for them.

Share this post


Link to post
Share on other sites

I disagree with the need to study design patterns early.

 

Many patterns have relations between several classes, eg state machine pattern, visitor pattern, adapter pattern, etc. You can only see them as pattern after you're really comfortable with a single class, and after you know inheritance and expressing relations between classes.

 

Until that time "static final void main(String[] args)" is just as much a pattern as "foo.addListener(new Listener() { .. })". A blurb of text with very little actual meaning that all examples use.

 

Even after you understand classes and their relations, you only need to recognize the patterns before you can use them. Recognizing is much easier, and does not need study, imho. Studying design patterns as subject on its own mostly adds names to the patterns, and extends the number of patterns that you recognize.

Share this post


Link to post
Share on other sites

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