Skip to main content
GameDev.net gamedev.net
🔒 Locked

[java] basic java game question

Started by role Jan 1, 2003 at 8:03 PM 8 replies 600+ views
Original Post
role
role
hi all i just started write java game in a few months i want to know ''bout basic game stuff : first, bout using awt or swing i read many java game tutorial that using awt for making games but i think swing is more nice and clean so which one more efficient (faster) awt or swing?? is using swing slower than awt or vice versa then bout full screen exclusive, i rather confuse using full screen (how to do it) is using full screen really boost the speed or not? i like windowed game, but if i continue write windowed game is it easy to turn it into full screen game? plz give me a fullscreen quick tutorial (the code in check resolution, turn it into full screen, and the difference paint method) i don''t understand bout render, and checking screen resolution and turn it into resolution i want (what if the resolution i want not support by player computer? or player''s computer not support full screen mode) then, bout applet or application i try to use applet at first, but applet can''t read and write to file system, so i change to application, but recently i read a tutorial that said applet can read/write using jarsigner so which one good for build games applet or application? i have many map,graphic,sound to load and player''s data to save so i need file security and speed, i prefer applet and regarding to my first question, using Applet or JApplet?? and the last question, bout editor in building a game what do you all use? a GUI editor or not? a notepad or jbuilder? i use notepad now, but i think the progress took very long time okay, that''s all thank you very much NB: i''m trying to make a massive RPG game, so i really think bout speed!
Silicon Munky
Silicon Munky
well last thing''s first...
I was using JBuilder exclusivly, but it was not compiling code properly, so I code in JBuilder and use cmd.exe to compile and run my code.

Switching from an applet to full screen isn''t too difficult. I just converted the VolatileDuke demo from an Applet to Full Screen, didn''t take too long.

I haven''t used AWT for awhile, but I think Swing is faster. Swing is much nicer to use anyways.

The Full Screen exclusive tutorial on the Sun Site, is pretty decent.

http://sunsite.ccu.edu.tw/java/tutorial/extra/fullscreen/
Silicon Munky
Silicon Munky
I take it back, people are telling me that AWT is faster than swing.
NuffSaid
NuffSaid
quote:
Original post by role

so which one more efficient (faster) awt or swing??



Swing has a lot more overhead compared to AWT. Since you''re making a game, most of Swing''s features and controls won''t be used by you, so I think AWT would be better.


quote:

then bout full screen exclusive,


Try this tutorial from Sun
quote:

then, bout applet or application
i try to use applet at first, but applet can''t read and write to file system,
so i change to application, but recently i read a tutorial that said applet can read/write using jarsigner
so which one good for build games applet or application?
i have many map,graphic,sound to load and player''s data to save
so i need file security and speed, i prefer applet
and regarding to my first question, using Applet or JApplet??



I don''t know much about applets as I don''t write them. But I would think that applications would be the way to go, unless you want people to play your game from a website. THen, use applets.

quote:

and the last question, bout editor
in building a game what do you all use? a GUI editor or not?
a notepad or jbuilder? i use notepad now, but i think the progress took very long time



Try Netbeans and Eclipse. My personal choice is Netbeans because it includes a GUI builder, but since you''re writing a game, Eclipse should work fine too.
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
role
role
Okay thank you all !
i think i got the conclusion!!

first i''ll use AWT.
umm is it better using Panel or Canvas for the main screen?
what''s the difference between them?

then i''ll read the full screen tutorial NOW.
oh yeah is full screen faster than windowed mode or vice versa?

third i make my game as application.
do u have idea to secure data game from player access?
i mean the graphic is gif, very easy to manipulate by players, and... all my game data maps is notepad editable!

and for the last, i''ll try both Eclipse and JBuilder.
i''m going to download it now

thanxx

best regards,
NuffSaid
NuffSaid
quote:
Java 2 Platform 1.4.1 SE
A Canvas component represents a blank rectangular area of the screen onto which the application can draw or from which the application can trap input events from the user.




That''s what the Canvas is for. Its for drawing stuff. So I''d suggest that you use it.
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
role
role
arrghh, i still can''t use full screen exclusive
plz show me more link to full screen exclusive tutorial
especially more example, i''m better learn by example

i still confuse how to use active render, where to put the code?
and if the player''s computer not support full screen, where to put repaint? how to use buffer or page flipping??

and where to put my drawing code?

how to change to my desire resolution?
(800x600x16 or 640x480x16)

oh yeah, i use textpad, eclipse to large to download! (54 mb)
and thanxx i''ll use canvas instead of panel

make me sick!!
iCERAiN
iCERAiN
I allways used frame...
maybe this helps you (the 2nd post):

http://www.gamedev.net/community/forums/topic.asp?topic_id=131717

and yes fullscreen boost the speed.

[edited by - iCERAiN on January 4, 2003 4:42:08 AM]
role
role
thank you iCERAiN the code help me much!!
but, i have many many question from that code :

private VolatileImage dbImage;

what''s VolatileImage?? what''s the difference with common Image?

GraphicsDevice myDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();

what''s the function of GraphicsDevice??

this.dispose();

what for?? it''ll dispose the frame isn''t it?

dbImage.validate(getGraphicsConfiguration()) == VolatileImage.IMAGE_INCOMPATIBLE)

and what the hell is this????!?!?!?!

and still, where the active render?? passive render??
what if the system not support full screen, where to put my drawing code??

i''m totally confuse bout full screen exclusive!!


thanxx for any helppp
iCERAiN
iCERAiN
VolatileImage is new in 1.4.0 and supports hardware accelerated drawing so its faster.

The other questions are good questions, i only got fullscreen working for me without asking so much questions useing the sample code form sun.

quote:

what if the system not support full screen, where to put my drawing code??


Never had such problems but whats about changing

System.out.println("Sorry No Fullscreen");
System.exit(0);

into something like:

int witdh = Toolkit.getDefaultToolkit().getScreenSize().width;
int height = Toolkit.getDefaultToolkit().getScreenSize().height;
setUndecorated(true);
setResizable(false);
setSize(width,height);
setVisible(true);

Looks like a fake-fullscreen, used before 1.4.0.

I allways do my drawing in the paint method.
hope this helps a little bit...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.