Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (497)
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  
  processEvent vs processKeyEvent  (Read 2980 times)
0 Members and 1 Guest are viewing this topic.
Offline x30ice

Senior Newbie





« Posted 2006-01-18 22:36:44 »

Some little questions  Tongue

For an action (to name it) keyboard based game (5 game keys plus escape and maybe pause) it's better to use processEvent or processKeyEvent (in terms of keeping the class small) ? In the little tests I've done it seems processKeyEvent is lighter, but I'm not really sure.

Any hint to how to get the smallest double-buffering technique ?

Thanks for your help.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #1 - Posted 2006-01-19 00:49:51 »

Automate your builds:
1. compile
2. zip it

Then compare the file-sizes of the zips of different versions.

There is no other way to find out. To answer your question, we would have to do the very same thing.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Anon666

Junior Member




aka Abuse/AbU5e/TehJumpingJawa


« Reply #2 - Posted 2006-01-19 01:23:54 »

The extra 3 bytes you spend on the method name, are more than made up for with the extra discrimination you get on the parameter. (i.e. you are guaranteed the event will be a KeyEvent, so don't have to do a check yourself.)
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #3 - Posted 2006-01-19 03:19:35 »

For an action (to name it) keyboard based game (5 game keys plus escape and maybe pause) it's better to use processEvent or processKeyEvent (in terms of keeping the class small) ? In the little tests I've done it seems processKeyEvent is lighter, but I'm not really sure.

[size=25pt]WARNING![/size]
Danger Will Robinson, DANGER!

You're micro-optimizing. All you're going to get for your troubles is a lot of pain, anguish, and impossible to maintain code. Look for the areas where you can get BIG savings, not little ones.

To repeat a famous quote:

First rule of optimization: Don't do it.
Exception for experts only: Don't do it. Yet.

Any hint to how to get the smallest double-buffering technique ?

If it's an action game, just setup the BufferStrategy and be happy. If it's a non-action game, Swing will do it for you automatically.

Java Game Console Project
Last Journal Entry: 12/17/04
Offline Rick

Junior Member


Projects: 1


Java games rock!


« Reply #4 - Posted 2006-01-19 03:50:46 »

See my thread "Source for smallest game loop" for and example game loop.
Offline Markus_Persson

JGO Wizard


Medals: 12
Projects: 19


Mojang Specifications


« Reply #5 - Posted 2006-01-19 14:09:13 »

[size=25pt]WARNING![/size]
Danger Will Robinson, DANGER!

You're micro-optimizing. All you're going to get for your troubles is a lot of pain, anguish, and impossible to maintain code. Look for the areas where you can get BIG savings, not little ones.

To repeat a famous quote:

First rule of optimization: Don't do it.
Exception for experts only: Don't do it. Yet.

Marry me.

Play Minecraft!
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #6 - Posted 2006-01-19 16:24:38 »

[size=25pt]WARNING![/size]
Danger Will Robinson, DANGER!

You're micro-optimizing. All you're going to get for your troubles is a lot of pain, anguish, and impossible to maintain code. Look for the areas where you can get BIG savings, not little ones.

To repeat a famous quote:

First rule of optimization: Don't do it.
Exception for experts only: Don't do it. Yet.

Marry me.

Sorry, my wife won't let me. Tongue  Cheesy

Java Game Console Project
Last Journal Entry: 12/17/04
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.

xsi3rr4x (12 views)
2014-04-15 18:08:23

BurntPizza (11 views)
2014-04-15 03:46:01

UprightPath (24 views)
2014-04-14 17:39:50

UprightPath (10 views)
2014-04-14 17:35:47

Porlus (27 views)
2014-04-14 15:48:38

tom_mai78101 (49 views)
2014-04-10 04:04:31

BurntPizza (108 views)
2014-04-08 23:06:04

tom_mai78101 (208 views)
2014-04-05 13:34:39

trollwarrior1 (176 views)
2014-04-04 12:06:45

CJLetsGame (182 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
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!