How to save a game in LWJGL? - java

I'm working with LWJGL for the first time, and Im enjoying it. I'm having a slight problem finding tutorials about things like making main menu, or saving/loading game state/information. Are there any decent tutorials available for this kind of thing? Any help is appreciated.

Well depending on what you're doing. A good idea for saving and loading is to use an XML file for each save. You could store any map data, or character data inside that file, then read all of that information when loading.
There are actually some pretty good tutorial series on YouTube:
TheCodingUniverse - http://www.youtube.com/playlist?list=PL19F2453814E0E315 (33 Videos so far)
There are also a lot more random tutorials on youtube if you just search for LWJGL tutorials.
Also if you plan on making 2D games, I would check out Slick2D. It's basically a 2D engine built off of LWJGL, it can be very helpful in rendering graphics, and stuff of that nature. Keep in mind it's only for 2D though, if you want something like that for 3D, I would check out JMonkey
The forum Java-Gaming can also be a useful place, these are some of the resources I used when first learning stuff with LWJGL. In my opinion I think going with a library like Slick or JMonkey is the way to do things, because they've done the stuff that is needed for every game, and leave you to make your game.

Related

Libgdx how i create a 3D Low-Poly Terrain with chunks

dear stackoverflow community,
I have now idea, how i can create a Low-Poly 3d Terrain in Libgdx,
By googling i found remains from the libgdx blog or website they can't help me, but by the research nothing what can help me.
I create a Value Noise but it does not work and i think its not the right way to do it.
Do you know a good tutorial or websites? ^^
LibGDX is not a game engine so don't expect any "generateTerrain()" method. You need to implement it yourself.
Here you can find general information about how to use libGDX for 3D.
And here you can find actual code that creates a height map.

Having Multiple WebViews or Importing Java Libraries

I am fairly new to the Android Development. I am just learning all about it but thanks to my web programming background it is being really fast.
I have a question about webviews. When I have a simple component (like a chart) but hard to draw with Java I am building it with HTML and CSS and using it as a webview.
My question can look like opinion based but I am asking this in terms of performance.
I am wondering, how is having couple of simple webviews affects performance? I know that there is libraries almost for everything but importing a big library for a simple chart or something else seems like an overkill to me when I can make it with ~50 lines of HTML and CSS code.
Which one is more powerful? WebView or importing libraries for everything?
I guess importing libraries are much better for performance because those are you know stored locally whereas mostly web-views are very slow and unresponsive but if you don't have technical skills to work with library you can go with webview but in future try to use any library or you can take help of youtube there are lots of videos which teach you how to do
Maybe video like this
https://www.youtube.com/watch?v=qWBA2ikLJjU

Mini2dx - Can't find tutorials

I don't know if this is the right place to ask, but i looked for a new 2D game engine and decided that i want to use Mini2Dx. It is a 2D Java Game Engine which has some already prebuilt features like UI-Elements, Particles, etc. The engine itself is based on LIBGDX.
Even though i really want to use it, I can't find any tutorials. Except for a spanish tutorial, that I don't understand.
Tutorial: https://www.youtube.com/watch?v=gkDpfBCo_XI&list=PLTd5ehIj0goOYxN4HotZAY4uphbgFTQ_c
Thank you!
Sadly mini2Dx is not in trends so don't have video tutorial in English.
But you can use documentation on his github wiki also you can check this game for reference that is sample game of mini2Dx.
There is also active community on his reddit page, that may help you in your development.

Seeking help in a basic, bare bones method of creating a 2D OpenGL-ES 2.0 Game

I have made many Android applications that use Java code and the XML layouts, however I am very new to OpenGL ES. I have programmed games in Swing Java, including pong, and an intermediate level 2d platformer (with a map editor, too!). I have extensive knowledge in Java, however, OpenGL is a new doorway I wish to open.
Using guides online, I have made simple things in OpenGL ES, including a cube that I manually mapped the co-ordinates for (which was a very fun experience), and drawing a triangle on the screen.
My question is, how can I make a 2d game with OpenGL ES? Now, what I've tried doesn't quite work well, as the images I draw arent to scale, and no matter what guide I use, the image is always choppy and not the right size on my Nexus S that I am debugging to.
What I need to learn to do is, be able to draw images and objects to the screen with OpenGL ES, and learn how to perform a game loop. I havent looked into a game loop in Android, but will soon. What I want to master first is drawing crisp, HD images to the screen, which just won't work for me.
If you require me to post examples of what I have done in the past, of course I will. But I am hoping you can help me with a fresh start. Thank you.
TL;DR: How to draw crisp, HD, 2D images to the screen using OpenGL ES, and how to have a game loop in Android?
You probably heard of Cocos2d, a 2d gaming framework that works as a wrapper on OpenGL.
It was originally developed for iOS, but it was ported to Android to.
The project page:
https://github.com/ZhouWeikuan/cocos2d/tree/master/cocos2d-android
Great starters guide:
http://dan.clarke.name/2011/04/how-to-make-a-simple-android-game-with-cocos2d/

Should I use Flash or Java?

I want to make some 2d games that I may want to submit to a game site, such as newgrounds.com. Even if I decide not to submit, I'd still like to know which is a better choice.
Which has a faster startup time?
Which performs faster in a 2d game?
Which IDE should I use?
Thanks in advance!
EDIT:
Also, a couple more quick questions.
I have used xna quite a bit, and silverlight a little. Where do I get started with flash? And what 2d libraries do i need? Also, is flash going to be anything like xna with an update loop and a draw loop?
The de facto standard for browser games is Flash. While there are game submission sites like ArcadePod.com that accept Java, most (including Newgrounds) are Flash exclusive.
Notably, Adobe Flash Pro and Adobe Flash Builder both cost $700.
Performance-wise and deployment-wise, Java using JOGL is probably the best I've seen in a browser.Check this out: https://jogl-demos.dev.java.net/applettest.html
That said, Flash and HTML5 should be hardware accelerated... at some point in the future. We should be seeing some very nice DHTML5 graphics libraries very soon. Combined with more Javascript-targeting compilers like GWT, I'm guessing that this is where we'll be seeing much game development in the future.
Definitley Flash over Java for in browser. Silverlight is also decent. Don't expect Flash or Silverlight to perform as well as XNA, as XNA makes use of the GPU with programmable shaders etc.
I recommend using FlashDevelop if you don't want to pay for any tools.
Realtime games in Flash use a loop. There are two ways of achieving this. The first is to create a Timer object and create a listener for it. The second is to listen to an ENTER_FRAME event (which is dependant on the Framerate you set). I personally use the second way of doing it. Since you can not guarantee the framerate its good practise to use a time delta to adjust values.
The best thing about Flash is there are a lot of mature engines out there, I will only focus on 2D ones here.
For physics, Box2D is the way to go, its a port of the C++ Box2D engine. Very powerful.
For keyboard input grab this class: KeyPoll
Depending on the type of game, the as3 game engine fixel might be useful
As for rendering, the simplest way is to use Sprites and Movieclips. You can draw programmatically, or if you use Adobe Flash Pro you can draw them by hand. An alternate way to render is to create a bitmap object and draw pixels to it.
I think it would be worth investing in a good book. For learning ActionScript3.0 everyone recommends Essential ActionScript 3.0 by Colin Mook.
For games development: Foundation Actionscript 3.0 Animation:
Making Things Move! and AdvancED ActionScript 3.0 Animation by Keith Peters are great. You can find his blog at Bit-101
And last but not least, a fairly new book The Essential Guide To Flash Games looks great but I have not read it yet.
Also if you search stackoverflow you will find similar questions about learning AS3 with links to online resources.
JavaFx is a very upcoming technology in developing both 2D/3D games and infact it gives same effect as Flash.you can have its libraries and inbuilt support IDE in Netbeans IDE.
I have developed both in Java2d/swings/graphics and Flash. Flash uses VECTOR Graphics which has a very good output irrespective of any screen resolution. Plus it will become fun and easier to design objects in flash rather doing everything by coding in Java.
That does not mean that you have everything ready in Flash. You still have to work with Actionscripts which obviously involves coding but it will be really fun once you learn it. You can always post your problems in this community where you have nice support for any actionscript related issues.
All the best!
If you are building a game, mass outreach is more important than any of the factors listed. Far more people have flash installed than JRE/Java Plugin, So I would advise you to go with Flash. Of course performance matters a lot, but getting people to play is more important.
For flash games, you can use Adobe creative suite or flex.
BTW, another good game development platform is MS silverlight, but thats out of the question too. It has even lesser market penetration than Java
Flash is better suited to 2D graphics rendering, was made for the browser environment, everyone has it installed and it's easier to learn than Java IMHO.
Here is a good way to get started looking for good libraries, although to be honest, Flash comes built-in with everything you "need", per se.
22 ActionScript 3.0 API's
Also, don't leave home without your API Documentation!
I'll try to dig through my history of API's and apps; it's been a while since I dabbled in AS3, but those were some nice times.
The sites you are looking to submit to will most likely take flash games over java versions.
I would recommend picking up flash its self and actionscript 3.
You may also want to pick up a free copy of the PushButton game engine which will take a lot of your development time away and allow you to focus more on actually building the games and not so much on getting the physics and collisions etc working.
http://pushbuttonengine.com/
In terms of user accessibility, I suggest flash.I believe it's easier to develop 2d games in flash...

Categories

Resources