Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (532)
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  
  Another "how to start" topic. How to stark game making?  (Read 2435 times)
0 Members and 1 Guest are viewing this topic.
Offline Knitter

Senior Newbie





« Posted 2008-08-06 14:29:07 »

Hi,
First, let me introduce myself, as this is my first topic. I've been reading the forums for some time now, never posted a question or answered one, but have been around for some time. I'm from Portugal, so if any if there is any Portuguese out there feel free to say hi Smiley

I'm a student, finishing my bachelor degree in computer science, and have learned to program using games, most of my classes asked us to make some kind of game to teach us something about programming. So, games are something I like, a lot!, and, currently, am starting a small project to create various games using Java, as this is my favorite language of all. But I'm facing some questions that I would like to your help with.

I have no problem with Java, what I have some problem is understanding where to begin.
I have a small game I want to write, it will feature some elements running from one end of the screen to the other, most likely some sharks, that the user needs to stop before they get to some treasure/food/whatever. The game is very simple and, as I don't have any graphics, I'll most like use any image that will allow me to test the game and learn.

So:
1) should I use a game engine, and if so what are your suggestions?
2) I've read some topics about lwjgl and I'm stating to read more on the official page, I understand it is aimed at 3D games, is it also useful for 2D games? Are there any immediate problems with the library, like multiplatform issues? Or I'm is it also good for 2D games?
3) any good tutorials out there, that explain how and why to structure the code instead of the ins/outs of Java language, some that would offer solutions to common problems like performance, image flickering, optimizing dirty rectangles, etc.
4) I want to use Swing on some games, mostly because it fits better than creating my own menus, is there any problem I should be aware of?
5) any advices that you can offer?

I'm going to follow the Space Invaders tutorial, from www.cokeandcode.com, maybe some questions will be answered there, mostly I have no idea how to start creating the games I want.

Thanks for reading the all thing Smiley

REJOICE! For very bad things are about to happen!
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #1 - Posted 2008-08-06 14:40:30 »

LWJGL works great for 2d games as well. Check out my website and puppygames for some examples. It's been used for numerous commercial games and is cross platform. Highly recommended.

Don't use Swing however, unless you're doing something with lots of gui controls (like a management sim or something). Just do things yourself with text and images - you can get a long way with just text and buttons which can be coded up very simply and quickly. IMHO Swing is too ugly and slow for games.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Knitter

Senior Newbie





« Reply #2 - Posted 2008-08-06 14:52:50 »

Swing is one of the things I use more, and, like most things in Java, if it's slow it's the programmers fault Smiley
As to being ugly, well, is as ugly as any other control in your OS, considering it uses the OS's look and feel and, if you want your own, either build one, not that hard, or use one of the many and nice look-and-feels out there.

But I'm considering Swing for small games that usually have such menus and interaction, things like the Windows games suite, Solitaire, Free Cell, that sort of things. Small applications that work best, from a usability view, with these controls that with "home made image/text based" graphics.

I'll be looking at those links, thanks.

REJOICE! For very bad things are about to happen!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #3 - Posted 2008-08-06 15:04:25 »

It's slow if you're trying to hit a smooth 60fps no matter what. Smiley

Sure you can write your own look and feel, but that only really affects the visual element. Swing controls don't give great feedback to the user and that can't be easily done with just a L&F change. Similarly you can't easily have overlapping or transparent controls, so you usually have to settle for a blocky rectangle next to your game area. You can't do something simple like this and so it sticks out like a sore thumb. This isn't really surprising - Swing is built for "traditional" GUI apps, with totally different conventions, interaction and rules. Trying to crowbar that into a game isn't going to yeild good results.

If you're going for something like Solitare then I guess it'd work, but I've always thought they had an ugly and non-intuitive UI anway.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Knitter

Senior Newbie





« Reply #4 - Posted 2008-08-06 15:11:22 »

You can't do something simple like this and so it sticks out like a sore thumb.

Though I'm starting to deviate from the topic, I'll have to say that you can easily make something like that, but I'm not thinking on using swing that way, most of the use will be for "standard" menus and windows.

One other way I want to use Swing is by using JFrame, JPanels, etc., instead of other components like Canvas or something alike.

REJOICE! For very bad things are about to happen!
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #5 - Posted 2008-08-06 15:18:16 »

Though I'm starting to deviate from the topic, I'll have to say that you can easily make something like that
I'd like to see that. There's only so far you can go with the L&F API and I think you'd have a hard time getting something that runs at an acceptable framerate with the same quality (ie. proper antialiased edges and everything).

However we're probably way off topic now. Smiley

Of course there's always Slick which has a nice variety of options for GUI controls.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline DragonsRage

Senior Newbie





« Reply #6 - Posted 2008-08-06 15:43:07 »

LWJGL and JOGL are both terrific for 2D games. I don't recommend using a game engine because making your own won't take long and the process of making it will allow you to familiarize yourself with LWJGL/JOGL. When choosing which to use, LWJGL has been used for more commercial games, but it seems more people use JOGL; especially on these forums.


One other way I want to use Swing is by using JFrame, JPanels, etc., instead of other components like Canvas or something alike.

Using a JFrame and JPanel is most likely not going to provide you with any additional benefits over Frame or Canvas. I don't recommend using Swing for things like buttons because swing is bulky by nature, and while the performance hit is likely insignificant with a simple game, it is quite significant for a larger game.

Swing is one of the things I use more, and, like most things in Java, if it's slow it's the programmers fault Smiley

It is not that it is slow, it's just not fast.  Smiley

Secrets and lies

     () ()
     (O.o)
     (>.<)
Offline Knitter

Senior Newbie





« Reply #7 - Posted 2008-08-06 16:00:00 »

When choosing which to use, LWJGL has been used for more commercial games, but it seems more people use JOGL; especially on these forums.
I think I'll be going for LWJGL at the moment, maybe I'll try JOGL later.
So no game engine? I have been looking at GTGE, though I don't like the authors view on the LGPL license, but that's another problem, nevertheless I'm not very fond of reinventing the wheel Smiley, so sooner or later I'll have to use a game engine, even if it's made by me.

Using a JFrame and JPanel is most likely not going to provide you with any additional benefits over Frame or Canvas.
I would prefer to use lightweight components instead of heavy ones, but it's not that important, either one or the other will suffice.

Thanks.

REJOICE! For very bad things are about to happen!
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11


Game Engineer


« Reply #8 - Posted 2008-08-06 19:47:10 »

I've made some pretty graphics using Swing.



That was using a custom border layout that I made which lets you place images around each component. The result looks pretty clean, although I totally agree that Swing is annoying most of the time. On the program with the above screenshot, for example, components are often resized stupidly and there's no way to fix it. Also on Mac Swing seems to have been screwed over lately – unless you resize the window, it appears blank at first.

Below is a screenshot for a GUI for a level editor that I made without Swing. I think it looks prettier and it's much easier to control. Basically I just check to see if the mouse click intersects a Rectangle object that represents each button. Simple.


See my work:
OTC Software
Offline Knitter

Senior Newbie





« Reply #9 - Posted 2008-08-08 15:06:13 »

I know there are a lot of sprite sites out there, but where can I find a site with good tutorials on how to use sprite sheets?

I have used tiles, created from one single image, but that image had all sprites spaced evenly, I have some sheets with images of different sizes, how can I use them correctly?

Also, some nice tutorials would be welcome, for example, the Space Invaders tutorial was the first one to use accelerated graphics. But it uses a strange form of movement and sprite animation, at least from what I'm used to.

REJOICE! For very bad things are about to happen!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11


Game Engineer


« Reply #10 - Posted 2008-08-09 00:06:02 »

I believe the tutorial uses dx and dy and delta, which are actually much smarter to use on a game, because it allows for dynamic frame rate.

See my work:
OTC Software
Offline Knitter

Senior Newbie





« Reply #11 - Posted 2008-08-09 01:31:27 »

I believe the tutorial uses dx and dy and delta, which are actually much smarter to use on a game, because it allows for dynamic frame rate.
I got a bit lost on why the OO hierarchy was the way it was, but I failed to understand how to make an entity move with the same speed, it would start slowly but at the end was speeding up.
But that is another problem for me to solve Smiley

I think I now understand what my real questions were, let's see if I can make any interesting games Cheesy

Oh, by the way, anyone knows any jigsaw creation algorithms? I wanted to make a small jigsaw puzzle but I can't manage to find a single algorithm on the subject. Or any hints on how to start.

REJOICE! For very bad things are about to happen!
Offline DragonsRage

Senior Newbie





« Reply #12 - Posted 2008-08-09 06:11:20 »

I made a jigsaw game back in the day. If I recall correctly I started out with the whole image and slowly worked in an algorithm to make pieces. I started by breaking it into squares that gradually became fancy arcs and curves.

I had an array of arrays to represent the pieces like a 2D rpg would have a tiled map. The pieces are initially set to null and are created one by one starting at the top left and filling in rows before columns. When the algorithm created the tile it would check for any neighbors, if the neighbor was not null, it would make its side the opposite of its neighbor's so they could fit together, if the neighbor was null, it would randomly create an arc to represent its side, and if the piece was at the edge of the image it would make that side flat.

The hardest part is that the shapes don't have set dimensions so converting screen coords to test if the piece belongs there when the player moves it is difficult. I don't remember how I overcame this, sorry. Sad

I know my explanation is confusing and sorry about that, but hopefully it will give you ideas on how to start. Smiley

Secrets and lies

     () ()
     (O.o)
     (>.<)
Offline Knitter

Senior Newbie





« Reply #13 - Posted 2008-08-09 13:12:03 »

(...)
The hardest part is that the shapes don't have set dimensions so converting screen coords to test if the piece belongs there when the player moves it is difficult. I don't remember how I overcame this, sorry. Sad

I know my explanation is confusing and sorry about that, but hopefully it will give you ideas on how to start. Smiley

It was not confusing, don't worry Smiley.
I had two methods to create the pieces, either have about 6 images representing pieces and then cut the image based on these example images or create the lines on the fly. I would prefer the last one.
For matching the images I was thinking of creating an object that would have the piece and references for each neighbor, some linked list or similar, though a piece can have a max of 4 neighbors, so 4 simple variables would do.
At creation I would fill in the variables or the list, whatever, and so each piece would know and have direct access to the ones next to it.

Now, cutting the pieces on the fly is something I honestly can't do. After posting here I search a bit more, even found a source code in Delphi, but I'm not that fluent in Delphi to completely understand how the curves are made.

REJOICE! For very bad things are about to happen!
Offline DragonsRage

Senior Newbie





« Reply #14 - Posted 2008-08-09 15:10:37 »

I found a few links that might help you. Smiley

http://anthonyf.wordpress.com/2006/12/27/a-lispy-jigsaw-puzzle-game/

This site does not list any code but does describe the process they used to create the puzzle piece. It seems most people use an image mask, or template for their puzzle pieces.

http://www.pygame.org/project/828/?release_id=1451

And here is the source for a jigsaw game in python and pygame, python is fairly easy to read without experience programming in it. I think you might have to download the python language to view the code though, not sure. (it's a small download anyway).

Secrets and lies

     () ()
     (O.o)
     (>.<)
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.

pw (15 views)
2014-07-24 01:59:36

Riven (14 views)
2014-07-23 21:16:32

Riven (13 views)
2014-07-23 21:07:15

Riven (15 views)
2014-07-23 20:56:16

ctomni231 (43 views)
2014-07-18 06:55:21

Zero Volt (40 views)
2014-07-17 23:47:54

danieldean (32 views)
2014-07-17 23:41:23

MustardPeter (36 views)
2014-07-16 23:30:00

Cero (51 views)
2014-07-16 00:42:17

Riven (50 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!