Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Trying to create a game using the standard libraries  (Read 675 times)
0 Members and 1 Guest are viewing this topic.
Offline innoxium

Junior Newbie





« Posted 2013-12-14 15:58:38 »

As the subject title states I want to create a game that uses only the standard java libraries. I am using jre7 last I knew if that is helpful.

I am using netbeans as well. I want it to be an isometric game and have no external images, if at all possible. I want to create the tiles and objects using Java's native graphic drawing libraries... Is that possible?
Offline CodeHead

JGO Knight


Medals: 41


From rags to riches...to rags.


« Reply #1 - Posted 2013-12-14 16:05:32 »

I am using netbeans as well. I want it to be an isometric game and have no external images, if at all possible.

You mean something like procedural generation, or do you mean you want to use regular images but want them all contained within the .jar file? Both are possible.

I want to create the tiles and objects using Java's native graphic drawing libraries... Is that possible?

Yes that's possible as well. The amount of work to achieve it depends on what you meant by the previous part of your message.

Arthur: Are all men from the future loud-mouthed braggarts?
Ash: Nope. Just me baby...Just me.
Offline SHC
« Reply #2 - Posted 2013-12-14 16:09:36 »

You can refer my game engine. It uses Swing and AWT which is available in the standard library.



https://code.google.com/p/game-engine-for-java/

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline innoxium

Junior Newbie





« Reply #3 - Posted 2013-12-14 16:22:20 »

@CodeHead

Well I am hoping to stay away from images if at all possible. I know that sounds odd and entirely not within the norm, but i suck horridly at drawing lol.

@SHC

I will look into it thanks for the offer!
Offline Damocles
« Reply #4 - Posted 2013-12-14 16:34:35 »

Shure its possible.

For inspiration and some coding tricks, have a look at the previous J4K games and their posted sourcecode.

http://www.java4k.com/index.php?action=home

You can generate all graphics in code, or alternatively store images in code an re-create them from there.
(stored as a String for example)

You can basically create a whole game in just one class-file if you wish to.

Offline Troubleshoots

JGO Knight


Medals: 36
Exp: 7-9 months


Damn maths.


« Reply #5 - Posted 2013-12-14 16:37:50 »

As the subject title states I want to create a game that uses only the standard java libraries. I am using jre7 last I knew if that is helpful.

I am using netbeans as well. I want it to be an isometric game and have no external images, if at all possible. I want to create the tiles and objects using Java's native graphic drawing libraries... Is that possible?

I assume you have no previous experience of game development? Do you have a good knowledge of the Java language? Are you familiar with swing & awt? Here are the topics I think you should research and also the things that you need to know:

  • The Java language
  • Swing & AWT
  • File handling (saving & loading)
  • The game loop
  • Double buffering
  • AABB collision detection & response

That's probably the bear minimum that you need to know to make a game.
Regarding your second question about graphic drawing libraries; unless you want to draw some very simple coloured rectangles then you should use sprites. You can draw each pixel with code, but that's just hassle and not worth it; you'll probably end up with something that looks worse than something that you draw. I suck at pixel art too but if you play around with an image editing software or pixel art software like Photoshop, GIMP, GraphicsGale etc. you should be able to draw something half-decent. I advise sticking to relatively small (max 32x32 pixels) sprites to start with.

Why are all OpenGL tutorials written in Brainf**k?
Offline Damocles
« Reply #6 - Posted 2013-12-14 16:44:06 »

You dont need to learn much about Swing and AWT apart from
the nessecary steps to create a Window with the canvas to draw to, and how to handle inputs.

For most games, you dont need all these fancy Buttons, Lists and Layout managers.

Offline innoxium

Junior Newbie





« Reply #7 - Posted 2013-12-14 16:54:36 »

@Damocles
The link doesn't work?
A single class seems a bit odd...

@Troubleshoots
I have programmed in java for several years now. Having started several times to create games  but something always comes up that makes me stop (usually i get fustrated or system corrupts).  I have use Swing and AWT for a while but it was always bare basic stuff I want to dive deeper. I have done file handling but not very good with it (dont fully understand the reader/writer stuff beyond text file usage)
As for the rest I know of them but have very little understandung of them.
As for photo editting they are not my friends... I know MSPaint after that the others confuse me.
Offline Troubleshoots

JGO Knight


Medals: 36
Exp: 7-9 months


Damn maths.


« Reply #8 - Posted 2013-12-14 17:31:20 »

@Damocles
The link doesn't work?
A single class seems a bit odd...

@Troubleshoots
I have programmed in java for several years now. Having started several times to create games  but something always comes up that makes me stop (usually i get fustrated or system corrupts).  I have use Swing and AWT for a while but it was always bare basic stuff I want to dive deeper. I have done file handling but not very good with it (dont fully understand the reader/writer stuff beyond text file usage)
As for the rest I know of them but have very little understandung of them.
As for photo editting they are not my friends... I know MSPaint after that the others confuse me.

I strongly advise not to read the code for the Java4K entries. A lot of it is heavily optimised and hard to understand. If you didn't know, Java4K is where developers try to make games that are <4 kilobytes, which usually requires a lot of crude optimization.

If you're serious about game development then using just the Java API isn't a good choice as it lacks the performance that most games need. However, for beginners it's a great place to start. Try searching on Youtube for some simple Java game development tutorials, then once you've set up a basic window and set up a basic game loop I suggest searching through Google for articles/tutorials/forum posts regarding the topics I listed above (game loops, aabb collision, etc). Don't just watch/read articles and tutorials though; maybe try creating a pong or snake game. Once you're at the stage of feeling comfortable with those principles of game development, I challenge you to create a very simple platform game using coloured rectangles for tiles (load the map from a text file) and a coloured rectangle for the player.

After that is where it gets more difficult. If you don't care too much about performance for your game, you could continue to use swing & AWT for it, however if you want to create faster, better games then you should consider looking into some game engines (I recommend LibGDX for Java). Game engines can be hard to learn; they're much more advanced and use OpenGL for rendering. You could also consider learning how to use OpenGL (for Java learn LWJGL) which can be confusing and is a vast, vast topic. Learning OpenGL will give you a much better understanding of how things work and you'll even be able to create your own game engine if you want.

As a whole, game development is a huge and confusing topic, but the number one thing is that when learning, don't give up. Good luck.

Why are all OpenGL tutorials written in Brainf**k?
Offline HeroesGraveDev

JGO Kernel


Medals: 269
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #9 - Posted 2013-12-14 17:47:53 »

@Troubleshoots: <4, not >4.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online lcass
« Reply #10 - Posted 2013-12-14 20:50:56 »

Every one of my games in made and I will be happy to help and answer any querys. If this is your first time I would suggest that you do use images , generating them in the code is a painstaking process litteraly piece by piece.
Offline philfrei
« Reply #11 - Posted 2013-12-15 03:01:46 »

If you are using the term "isometric" to mean stuff like the classic Q*Bert pyramid, that can certainly be done with simple graphics that you can draw yourself. All you need is a polygon and to choose whether to fill it or just paint the border. These things are provided in AWT & Graphics2D libraries. Drawing the equivalent of a Q*Bert might be easier to do as an import.

It is possible to get by without explicitly double buffering. If you use a Swing JComponent or JPanel, the double buffering is handled automatically. It's not the fastest, but for a simple isometric game it could very well be fine.

The biggest hurdle, my guess, is getting the game loop to work. There are a couple different methods. One of the simplest is to use a util.Timer to call an update() method and then a render(), at a fixed repeating increment. A more popular alternative is to use a while loop and calculate elapsed time during the update() and render(), and then use the elapsed time to calculate how much to sleep in order to make the increment a fixed repeating amount.

Alternatively, logic can be written that makes the updates proportional to the elapsed time. (In this case, there is no requirement for a fixed repeating time interval. The interval can vary (within reason). But all these game loops work with core Java.

So basically the answer to your initial question is yes.

I have gotten horribly stalled out with "Hexara" (a puzzle game), but the graphics and graphic effects are all drawn with Java2D, with the sole exception of the little symbols/icons within the hexes which I think I made with Microsoft Paint. At this point the sound is all procedural as well, using only the javax.sound.sampled library.

http://www.java-gaming.org/topics/hexara-work-in-progress/23676/view.html

"It's after the end of the world! Don't you know that yet?"
Offline ctomni231

JGO Wizard


Medals: 99
Projects: 1
Exp: 7 years


Not a glitch. Just have a lil' pixelexia...


« Reply #12 - Posted 2013-12-16 05:34:46 »

Yeah, it is possible to write a game using nothing but the Java API.

Even though it is possible, I wouldn't say it was an easy task. I did a lot of research into the Graphics2D library and BasicStroke library in order to manipulate the graphics. You can draw anything you want, but for game play purposes, it'll be very slow if you draw complex images.

However, if you are curious... I was forced to deal with the pure API in the 2013 Java4K Competition. It was a challenge to find a way to display that many graphics, keep it relatively smooth, and stay under that 4K limit. I learned so much from the experience, but it isn't one for the faint of heart.

If I were to say a suggestion, I'd just use images. They are pretty easy to manipulate and work with. Since you can even compress images inside the jar, there is no reason to even use the Java2D Graphics API for custom images unless you were trying to learn more about it.


Offline innoxium

Junior Newbie





« Reply #13 - Posted 2013-12-16 15:07:25 »

Thank you guys for the advice and encouragement!

I don't plan on going heavy on the textures and imagery I think eventually I will do files but first I want to better understand the libraries i have available. My ultimate goal is to make a isometric 8-bit mmorpg with graphics like zelda nes.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (46 views)
2014-10-17 03:59:02

Norakomi (37 views)
2014-10-16 15:22:06

Norakomi (29 views)
2014-10-16 15:20:20

lcass (32 views)
2014-10-15 16:18:58

TehJavaDev (62 views)
2014-10-14 00:39:48

TehJavaDev (62 views)
2014-10-14 00:35:47

TehJavaDev (52 views)
2014-10-14 00:32:37

BurntPizza (70 views)
2014-10-11 23:24:42

BurntPizza (40 views)
2014-10-11 23:10:45

BurntPizza (82 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!