Is the learning of JFrame relavant to android game development - java

I am having a tough time learning JFrame. So I thought that can I skip JFrame or will it effect my ultimate goal of learning android game development?

JFrame, is a frame which allows output. Output is the easiest part of any game development. The hardest part is rendering to an Image object, based off a set of 'world' objects that have to be defined by the game logic. A JFrame is just a simple way of outputting your players view into the world. The most crucial part to any game, be it android, iPhone, Xbox, playstation, or PC, is what happens in the background.
for 3D games you need to learn a lot of math - trig, matrices, maybe a little calculus even -, for 2D its a lot simpler, however you still need to know some math. You may wish to implement some simple physics, in which case youll need a comprehensive knowledge of mechanics, and how objects interact with each other. youll then need to build something that can manage these objects and implements all the functionality above.
Having done the above, you now need to render these world objects to an area of memory, so that they can be read by the output device, be it a JFrame, or smartphone screen and shown to the user.
To conclude, I would not get yourself hung up on smartphone development, using swing or awt can be a lot simpler than developing on a smartphone, and the back end of your program, which will most likely account for over 90% of your code, can, in most cases, just be swapped out for the smartphone code and just change the front end.
Hope this helps

Related

Java Screen Capture OpenGL and DirectX fullscreen Applications

I am trying to design a program in java to periodically (every 100 milliseconds or so) take screenshots of my display and compute the average pixel rgb values of the entire screen. I need this to be able to work with video games and iTunes/Quicktime videos. However I have tried using JNA and robot to capture the screen and it only works when I am not capturing a video game in full screen or an iTunes video. For instance I tested my code by saving an image to examine and see what is happening. When I am in a video game I only see a screenshot of a blank window. I think this is because games use directx or openGL and communicate with the hardware differently than your typical app.
If I use this this method for capturing a screenshot instead of robot or JNA will this solve my problem? It looks like it is copying over data from the openGL screen buffer. What about DirectX applications?
I basically just want to be able to get the perceived pixel data on the screen at all times. Regardless of whether or not its a fullscreen DirectX or OpenGL application or not. Thanks in advance for your help.
I'm going to guess this is for a homebrew version of the amBX lighting system. Even if it's not, the following page may help you; it contains both the java code and arduino code for a DIY ambient lighting setup, which needs to accomplish the same thing:
http://siliconrepublic.blogspot.com/2011/02/arduino-based-pc-ambient-lighting.html
Things to consider:
1. For processing speed reasons, that sample of code purposely ignores some of the pixels on the screen
2. Depending on what you're displaying (racing games vs. first-person shooters vs. top-down-view strategy or MOBA games vs. movies) you may want to purposely segment the display into separate sectors. For example, for a racing game you may want both the left and right sides to be more independent and very responsive to rapid changes, whereas for general film viewing you may want a more general output because you're dealing with a wider variety of ways the camera can move.

Android game development structure

I would like to develop a game on Android platform, I have about a year experience with Java and also used the OpenGL library in C++. I also programmed Minesweeper and Connect Four in Java. Basically, here's the type of game I want to create:
Pressing the screen would make your character go up in the screen and releasing it will make it go down. I know there are games like this already but it doesn't matter to me, it's my current goal.
The structure of both games I programmed was quite easy, it was only a GridLayout. This wouldn't fit in any defined layout. Then, I have absolutely no idea how to test a character/environment collision. I'm also wondering what would be the easiest/fastest way to draw the "collision" environment, I assume it would be with OpenGL but from what I know, it would still take a long time and wouldn't be that easy.
I've been trying to find a tutorial about this but obviously, I've been unsuccessful.
PS: I already know the basics to make an Android app so you shouldn't need to worry about that.
think about each segment of what you're trying to achieve individually.
First off, you could probably read up on libgdx: http://code.google.com/p/libgdx/
it's a great android game engine which will do alot for the work for you.
For the player, think of it as just incrementing the players y position by a few pixels if it's pressed down, else decrement it.
For the map, you'd probably need some sort of 2d polygon based collision for the upper and lower collideable environments, libgdx has a physics library built in but i'm not sure how the support it for polygon-based collision. And finally, just create the map and make it wider than your game screen, and just move the camera along as the player moves.

What is the best way to accommodate for different screen sizes in a game?

I am creating a Java game for Windows and I have come across a problem: there are lots of different screens and resolutions when it comes to Windows. What would be the best way to make it so that it looks just about the same on all screens?
You basically have three options:
Fix the size of the game window to something small that will fit n all screens (800*600 maybe)? This is easy to do, but could annoy users with big screens.....
Make the game resolution-independent, so that that it is rendered to a scale to fit the current window size. This is how most FPS games work for example. The main downside of this is that you need to do some extra scaling maths in your code and there may be some runtime overhead for rescaling images etc.
Make the game screen dynamically resizable, so that the components within it rearrange and resize themselves to fit the available space (like with a web page). This is the hardest to implement as you have to make use of appropriate layout managers and test lots of different combinations, but can give the nicest user "experience". I've successfully used MigLayout to do this in the past with a Swing game.
Any of these options could be best for you depending on the circumstances. It will probably depend mainly on the type/design of your game and your willingness to spend time on making the more complicated methods work well.

Can Java be used to make a 2D Bird's eye view style game?

I've been working on making a video game, and I've had alot of debate between a few languages, Java can be used well for 3D games but. Can Java make 2D bird's eye view games? I'm quiet new to programming so sorry if I seem somewhat ignorant. Thanks for your time!
that's not a question can Java make a 2d bird's eye game?. the main quesiton is does a 2d bird's game created with java meet your needs or not?. just by looking at cell phones you can easily spot many 2D games using bird's eye camera created with java. so it sure can!
Yes. (This simple answer is as exciting as the question.)
I used LWJGL to make a 2D "bird's eye" game in OpenGL. It just requires setting up the perspective correctly. Performance on a laptop (with a proper OpenGL 1.6+ dedicated video card ;-) was more than adequate for a large number of objects and particles.
However, LWJGL is a low-level OpenGL/basic-IO wrapper targeted for games and is the "hard way". There are other Java game libraries (some are just 2D like Slick) to make writing a game easier. According to list of game engines this also includes Jake2, Jogre, and Java Monkey Engine (3D, but see above).
If one felt like being .. silly .. the Java 2D API could be used directly (there are cases when it will try to use hardware acceleration but there are also gotchas). I do not do any JME programming, but I would suspect there are also frameworks for it.
And remember -- a "bird's eye view" is simply the chosen projection/rendering for a given model.
Happy coding.

easiest framework for a simple 2D animation

Well I am going to bed right now, and in next 2 days I have to code a simple program with animation that will simulate an inverted broom on a cart (a pole balancing genetic algorithm problem) the cart has to be pushed constantly from both sides to prevent the broom from falling down
You can see it in this video
http://www.youtube.com/watch?v=Ums3eGIVgks
or this picture image http://lis.epfl.ch/research/projects/EvolutionOfAnalogNetworks/ArtificialNeuralNetworks/images/mechanik_small.png
Well, I need to simulate physical behavior of this, but I have very little time, so I need something that I can understand and start using fast (the assignment is more into physics and genetic programming, so the simulation has to be just to show how it works).
Thank you
I'd use HTML5 Canvas and pure javascript. It's super easy, you don't need to compile. All you need is notepad, Chrome/Firefox/IE9, and a little time. There are tons of examples out there:
http://3.paulhamill.com/node/36
If you want an application, create a java application which uses a JPanel in a JFrame. In the JPanel override the paintComponent(Graphics g) method, and look at the graphics class which allows you to draw simple shapes like lines, rectangles, and ellipses.

Categories

Resources