Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 17 Aug 2011
Offline Last Active Jan 27 2014 05:02 PM

#5084314 I need a 2d cross-platform framework

Posted by on 08 August 2013 - 10:44 PM

You said you didn't want to use LibGDX because of the few tutorials. I'd recommend sticking with LibGDX for a little while then decide if you want to continue. The "Getting Started" page should help. They've got an official wiki, and an unofficial wiki that will help you get started. The JavaDocs are also available. The people on the forums are very helpful and you can also post here for LibGDX help. If you need help faster, there is a LibGDX IRC channel as well. Many of the contributors to LibGDX frequent the IRC. Plus, LibGDX's source is available if you want to look at their implementation of something. The JavaDocs and wiki are getting better all the time with user additions.

#5081507 Game development with Java

Posted by on 29 July 2013 - 11:51 AM

If you haven't looked through LibGDX's gallery I would check that out. A few of the more popular games made using LibGDX being Apparatus, Clash of the Olympians, and Ingress.


Yes, LibGDX is fine for game development and I enjoy using it. There's a great community behind it as well if you ever get stuck. As far as Minecraft and 3D, I believe the 3D API is still in the works. I'm not sure how fully-featured it is. You'll have to look around a bit. I do know it hasn't yet been put into a 'stable' release so you'll have to run the nightly builds which I've been doing with no trouble.


I would advise just jumping in and trying it out, at least for a little while. If you don't like it, try something else. If you only really care about desktop deployment you can look at jMonkeyEngine, LWJGL, or JOGL.

#5079950 Ball in Pong stops moving

Posted by on 23 July 2013 - 02:43 PM

I haven't run your code but I'm guessing your ball will move to one edge of the screen then stop? I added some comments to problem areas of your code. I'll expand on them after the code.

// Only the update code here. It's where the problem is. The rest of the class looks fine.
public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException{
    Input input = gc.getInput();
    if((ballStartX >=1) && (ballStartX <=300))
        ballStartX += 1 ;
    if((ballStartX <= 1) && (ballStartX >= 300)) // This will never return true. ballStartX cannot be both less than 1 and greater than 300.
        ballStartX -= 1;
    if((ballStartY >=1) && (ballStartY <=250))
        ballStartY += 1;
    if((ballStartY <=1) && (ballStartY >=250)) // Same as above. Never true.
        ballStartY -= 1;
        paddleXStart -= 1 ;
        if(paddleXStart < 0){
           paddleXStart =+ 1 ; // paddleXStart += 1; May want to change to if (paddleXStart < 0) { paddleXStart = 0; }
        paddleXStart += 1 ;
        if(paddleXStart > 439){ // Same as above. Might be better as if (paddleXStart > 439) { paddleXStart = 439; }
            paddleXStart -= 1;

Edit: Lost half my post.


As you can see, the ballwill never move left or I think up. I can't remember how Slick's coordinate system is. ballStartX will never be both less than 1 and greater than 300. You'll want to change

if((ballStartX <=1) && (ballStartX >=300))


if (ballStartX < 1) || ballStartX > 300)

The same goes for vertical movement.

if(paddleXStart < 0){
   paddleXStart =+ 1 ; // paddleXStart += 1; May want to change to if (paddleXStart < 0) { paddleXStart = 0; }

The above will not always exhibit the same behavior. If paddleStartX is located at (-0.5, 50) it will be set to (0.5, 50) while a paddle at (-1, 50) will go to (0, 50). Always setting its postion to 0 will fix this.



Your code is framerate-dependent right now. You may want to look at Slick's documentation and wiki and read up on delta time and framerate-independent motion.


ballStartX, ballStartY, paddleStartX, and paddleStartY sound like they store the initial positions of the paddle and ball so they can be returned to their initial configuration when a player scores. Personally I would rename them. However, it's more important that you understand your code since you're the one having to work with it.


You said you're just starting in Java so I'll let you know you may want to be consistent in your bracket usage. Some of your if statements use brackets while others do not. I can understand having single-line ifs not use brackets but some of yours do and some don't. Standardizing this may help readability.


Edit 2: Your ball is only moving one direction when it's on-screen.

if((ballStartX >=1) && (ballStartX <=300))
        ballStartX += 1 ;

If you want to change this behavior, which I assume you do, use a velocity variable and do something like

private float ballVelocity = 1f;
// update method
if (ballStartX < 1 || ballStartX > 300) {
    ballVelocity *= -1;
ballStartX += ballVeocity

#5077523 What do i need for android mobile game development?

Posted by on 14 July 2013 - 01:22 AM

I haven't used Box2D myself but it's popular and I've heard it's pretty easy to work with.


Yes. Box2D is a physics engine, not to be confused with a full game engine. Box2D will handle your physics but you'll need to render elsewhere using OpenGL, LibGDX (taken from your other thread), D3D, or whatever. You would probably have the rendering done in one class with the physics handled by another. A Physics Engine will only handle physics. A Game Engine, on the other hand, will handle a multitude of things, including physics, rendering, networking, and such.

#5077520 HELP! in Android Game Development.

Posted by on 14 July 2013 - 01:13 AM

If you use LibGDX or another engine, you'll still need to write your own shaders. OpenGL is a graphics library (Open Graphics Library). It lets you render using the power of the GPU. It is not, in itself, a shader. It can, however, use shaders to make pretty effects. Wiki has a nice reading on Shaders that you might want to check out. Depending on what you want to do, shaders aren't necessary.


LibGDX and other libraries or engines are there to extend OpenGL. In itself, OpenGL can tell the GPU to render things. It doesn't have window management, asset loading/management, sound (OpenAL does that), input handling, or anything else. It just draws. What LibGDX and other frameworks and engines do is give you access to (by handling) those things that OpenGL doesn't do alone.

#5077493 HELP! in Android Game Development.

Posted by on 13 July 2013 - 09:47 PM

Use what you want and are comfortable with. In your other topic you said you know Android development and OpenGL so you should already be able to do games for Android. You can either work with OpenGL ES directly or though a framework like LibGDX. LibGDX automatically handles other things like asset loading/management, sound, etc. It also allows for deployment to desktop, the web, and iOS (with a license).

#5074851 Advices for a student completely new to game dev

Posted by on 02 July 2013 - 03:14 PM

For programming Android and desktop games you don't need to know C++. You can develop games for both platforms using a variety of languages. If you're taking AP computer science your senior year, which I guess you may be since you said you're going to learn Java, then you'll learn the basics and can branch out into game programming in Java if you want. 


It depends on what you want to do. You certainly can learn C++ and use it effectively to make games or you can pick another language. A lot of people around here will recommend Python with PyGame or C# with Unity or XNA (now more likely MonoGame). Pick which language you want. If you haven't used Python or C# and you're going to be learning Java it might be easiest to just go with Java. A lot of Android apps are written in Java. Now with more people being able to deploy to Android using C/++ and Android support for Unity there are also a lot of games being written for Android not using Java too.


If you decide to go with Java then there are a variety of options available for deployment to Android. You can use the Android APIs and OpenGL ES 1 and 2 if you want to handle everything yourself. If not, you can use LibGDX which allows deployment to Android, Desktop, iOS (requires a license - not free), and the web. AndEngine is another popular one.


Edit: Apparently my links don't show up here even though they do in the editor. A quick Google search will let you find LibGDX and AndEngine.

#5071310 Code before Art? Is it Possible?

Posted by on 19 June 2013 - 08:23 PM


Since I'm an absolutely atrocious artist, is it at all possible to build the framework of the game before even adding artwork/characters/sprites, etc. 



It's definitely possible to work on the game mechanics without having graphics in place. The platformer I'm working on I started with no graphics, only drawing different colored rectangles to represent the player, enemies, weapons, bullets, and platforms. Since graphics are (usually) independent from game mechanics it's pretty easy to change them by changing resources or adding resources if you don't have any.




Since the game I have planned is a cross between RPG and RTS, I am wanting to focus very much on mechanics and how characters and the world interact with respect to dialog choices and actions made by the user. I want to focus all my time on how the game will work and how it interacts with the user and worry about realizing the world artistically later.  Is that at all possible and is it a good direction to go in?




It's certainly possible, as I said above, to work on a game without worrying much about the graphics, though, it is nice to at least have placeholders. You can find some tilesets and spritesheets available for free use online with a quick Google search if you want to have something to use. Also, if you're interested in making your own graphics, you might want to check out 2D Game Art for Programmers. I consider myself a horrendous artist as well but the posts there are quite helpful.






Are there any engines that are particularly useful? How would I go about engineering the framework?(any tutorials, books or articles would help me greatly)




If you're looking at developing using hardware accelerated graphics with sound libraries (which I would recommend) check out LWJGLSlick2DLibGDXJOGL and jMonkeyEngine. They all have wonderful communities that will be extremely helpful. LWJGL is a Java wrapper for OpenGL that also handles input, sound, and window managing. The others listed, besides JOGL, are based on LWJGL. Slick2D is a framework that handles a bit more than LWJGL and has some implementations of things like sprites and loading assets that you may find helpful. LibGDX allows for simultaneous deployment to PC, Android, HTML5 with WebGL, and iOS (still in the works) and also has implementations similar to those of Slick2D. I'm not extremely familiar with jMonkey but where the others are just frameworks, jMonkey is a full engine. I've heard good things about it. JOGL is another Java wrapper for OpenGL. Take a look at them and see which one you prefer, then go with that one. They all have wikis and tutorials plus helpful forums. You also always have the option to post here for help.




Yes, your game does seem like a lot of work. It may be something you build up to, not something you work all the way through at once for your first game. For me, it's been extremely helpful to prototype a new part of the game in a small, simple app, then implement it into the game itself after I've learned more. For example, when I changed my map to using the tmx format using the Tiled map editor, I wrote a small app that just read in a tmx file and displayed it and allowed simple scrolling. You'll want to start out small and work your way up. Good luck and if you need any help the forums here are a great resource.

#5068982 Transforming the Young Blank Dull Slate into a sharp Genius In Math.

Posted by on 11 June 2013 - 04:34 PM

As a sophomore in high school I'm sure he doesn't really know what he wants to do. He probably doesn't even really know what he's interested in. You say he is "horrid" at math. How so? What math classes has he taken? Is he interested in math at all? I know that I hated my geometry class but I had a lot of fun taking calculus classes. It was really only that one class that I didn't like.


1. If he needs to always be externally motivated to succeed at something, he's not really passionate about it. Let him find what he really wants to do and go for that. If he doesn't really want to make games, why force him? That will just lead to him being miserable.


2. You can't, because you do need math to do game programming. Admit it and show him that math really isn't that bad. Let him experience it himself.


3. Just taking math classes will help his math skills. What math classes has he taken? Again, has he shown any interest in mathematics? I've been reading Stephen Hawking's God Created the Integers and have quite enjoyed it. Hawking writes about a mathematician then describes their most important and influential works. I find it quite interesting and enjoy Hawking's writing style. Above all though, if he doesn't have an interest in mathematics then you can't make him do math. Just accept that he doesn't want to do math and may not want to do programming - and that's okay.


4. That's difficult. Wanting to learn is something I think is developed throughout life. As a sophomore, I wasn't all that interested in school. I was bored in most of my classes and, while that didn't change much, through most of my high school career, it has gotten better and I'm a lot more excited about learning now and going to school.


You say that he's interested in 3D modeling. Maybe he's interested in making art for games. There's nothing wrong with that. A lot of people around here are looking for good artists for their games. Encourage him to go after whatever it is he's passionate about. Don't try to force him into going a direction that he doesn't want to - it will end badly. Let him experience all his available options. He's young. He has a ton of opportunities and it would be unfortunate for him to miss out because he's doing something he'd rather not be doing but feels he has to.

#5065403 Game Developers' Pathway!

Posted by on 27 May 2013 - 09:20 PM

If you've read through the forums then you've no doubt found this post and its Java section. Those are worth reading over and will tell you a little bit about your choices for development tools.


As a beginner in Java you first need to learn the language. Learn your basic data types, language structure, objects, and get comfortable working with Java and your IDE. Once you have a good grasp on the language fundamentals you can experiment with game programming. This is where you start to get a lot of choices. You can work with just the standard JDK libraries (not generally recommended) or you can branch out into using something like Slick2D, LibGDX, LWJGL, or jMonkeyEngine. Each of these has its own pros and cons.


If you are doing Java to get into Android, you'll also want to head over to the Android Developer site and get to know Android better.

#5064027 i want to make games for people to be happy but don't know how

Posted by on 22 May 2013 - 11:58 PM

I know you may not want to hear this but making games is hard and takes a lot of work. You're young and have a lot of time to decide what you want to do. You may well end up making games for a living but don't block yourself off from trying new things because you're so focused on wanting to make games. Maybe, in your high school career, you'll discover you don't actually want to make games but want to be a music composer, physicist, doctor, or what-have-you. Be open to trying a wide range of classes.


Anyway, with that out of the way, you'll probably want to read through this article. It talks about getting started with game programming. You say you want to make games because you get to design, compose music, and draw your games. You may not be interested in actually programming games but in making art and music for games or game design. Another good thing to read through would be the FAQs at Sloperama. I'm sure those will be helpful to you as well and should get you started.

#5063395 Starting out - Game programming questions

Posted by on 20 May 2013 - 11:14 PM

why does everyone suggest C# btw.

for example here: http://www.gamedev.net/topic/642527-what-programming-language-should-i-go-with-cc-or-java/


I haven't had any experience with C# but from what I've heard, it's fairly easy to get started with. You can pick it up pretty quickly and there are some, from what I've heard, fairly good frameworks available for game programming in C# as well.

#5063362 chasing

Posted by on 20 May 2013 - 06:39 PM

Since you didn't specify, I'm assuming 2D for this. I'm also guessing each enemy has their "zone" or view distance stored with the rest of their information. You can find the distance between the player and the enemy by using the following

float x = player.x - enemy.x; // Distance between x positions of player and enemy
float y = player.y - enemy.y; // Likewise, difference between y values of positions
float distance = Math.sqrt((x * x) - (y * y)); // Replace with your math library - this is a Java implementation


Then, if the distance calculated is less than than the enemy's view distance or zone, the enemy attacks. For making sure the enemy actually 'sees' the player, you can do a check where, if the enemy is facing left and the player's x position is left of (less than) the enemy's, attack. If the player's x position is right of (greater than) the enemy's, attack. You can adjust this to have the enemy have a view angle as well so he can't see floor to ceiling but has a more realistic feeling field of view.

#5058287 What programming language should i go with? (C++,C# or java?)

Posted by on 01 May 2013 - 07:02 AM

This would fit better in the For Beginners section. To answer your question, use whichever language you want. This article  talks about C++, Java, C#, and Python. If you don't like using Java then you really won't want to learn game programming in Java because you'll get bored and discouraged. Pick whichever language you want and start game programming in it. As a beginner there is no "best choice" really.

#5058239 Beginner questions

Posted by on 30 April 2013 - 09:54 PM

Allow me to point you to this link. This will discuss C++, Java, C#, and Python as options for a beginning developer. As 0r0d said, start with what you know. I would choose C# or Java since you said you know both. Take a look at the options for each language and see which you find easier to use or better to work with and get programming with it.