Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (489)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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  
  [All Answered :D]Random Q's(optimization/cross-compatibility)  (Read 1428 times)
0 Members and 1 Guest are viewing this topic.
Offline Cakey

Junior Member





« Posted 2009-03-22 01:02:21 »

1.is it faster to use public variables from "subclasses" or get/set mutator/accessor methods to private variables?

2.is it faster to deal with the byte's of an image to edit it or to use say the Graphics class?


3.Does OpenGL know not to render things that aren't in sight?

4.How do you program for cross platform compatibility?
I read this about mac's but don't entirely get it:
Quote
Mac OS X
The Mac OS X port of Jogl, in particular the GL interface and its implementation, can be used either with the provided GLCanvas widget or with the Cocoa NSOpenGLView. In order to use it with Cocoa the following steps should be taken:
    * Instantiate a net.java.games.jogl.impl.macosx.MacOSXGLImpl using the public constructor taking no arguments.
    * Upon the first render of your application, or whenever the available OpenGL routines might have changed (because a window moved from one screen to another) call the publicly-accessible method MacOSXGLImpl.resetGLFunctionAvailability().
    * Only use the GL instance when the OpenGL context from the NSOpenGLView is current.
What's cocoa?

5.Do I have to reprogram the whole game to have a Mac version a Windows version and a Linux version?

6.Do different versions of java effect applets/applications a lot?

Offline lhkbob

JGO Knight


Medals: 32



« Reply #1 - Posted 2009-03-22 06:11:45 »

Quote
1.is it faster to use public variables from "subclasses" or get/set mutator/accessor methods to private variables?
Premature optimization is the root of all evil.  I went through a phase like this and it made things much harder.  Variable access will, 99% likely not be your slow-point and you'll see no performance gain either way.

Quote
2.is it faster to deal with the byte's of an image to edit it or to use say the Graphics class?
Dealing with the bytes has been faster in my experience, but it's much more of a pain to use.  When using Graphics, you have the nice methods to draw things and it can handle any type of image.  When dealing with the actual data, you have to have ways of doing it handling all types of data and pixel formats.

Also, keep in mind that any changes to a BufferedImage will have to be sent to the graphics card, which is always a slower operation, too.

Quote
3.Does OpenGL know not to render things that aren't in sight?
Yes, it gets clipped away so you don't see it.  But because you don't see anything it's best not to send it to the graphics card if you know its not showing.  I'd look into "view frustum culling" to learn more.

Quote
4.How do you program for cross platform compatibility?
This I cannot answer so well, except to point out that whatever it is you're reading, it's very old.  net.java.games.jogl is the old package name for JOGL before it became a official.  You should not need to worry about choosing an NS or Cocoa implementation, jogl does this for you on Mac.  These are just different windowing systems available on Mac.

Quote
5.Do I have to reprogram the whole game to have a Mac version a Windows version and a Linux version?
No, that's the beauty of Java.  It theoretically runs the same on the different platforms.  I say theoretically because in rarer cases it doesn't work that way.  Program in such a way that each part is as separated as possible.  If it turns out there's a bug with some JVM or video card driver that you must support, you'll have to change a small part of the code.  You don't want to change AI code to fix a bug with graphics.

Quote
6.Do different versions of java effect applets/applications a lot?
When you compile your code, the .class file has a minimum java version required to run it (e.g. if you compile with JDK 1.6, someone needs 1.6 to run it, too).  Besides that, the newer java versions offer up syntactic changes with generics and annotations which won't work on 1.4 or lower, and
they often improve performance.

Offline gouessej
« Reply #2 - Posted 2009-03-22 09:33:39 »

I agree with lhkbob, you don't need to do something special to support several operating system. Before thinking about low level optimizations, use both a spatial subdivision (trees, graphs, voxels, ...) and a kind of view frustum culling. In my case, this is critical and this has greatly improved the frame rate.

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

Junior Member





« Reply #3 - Posted 2009-03-22 16:03:20 »

wow lhkbob thanks for tackling all that haha.

here's a couple more:

1. Why do applets work on some browsers and not on others? is this in the HTML or in the .jar?

2. Does mac/linux use different applet api?

3. is jnlp more cross compatable then applets?

Offline h3ckboy

JGO Coder


Medals: 5



« Reply #4 - Posted 2009-03-22 18:33:31 »

1. Why do applets work on some browsers and not on others? is this in the HTML or in the .jar?
may be that the browser does not have java enabled
3. is jnlp more cross compatable then applets?
not that I am aware of, but I may be wrong.
Offline Cakey

Junior Member





« Reply #5 - Posted 2009-03-22 19:32:50 »

You were right about ti being the java script enabled haha I can't believe I didn't check for that.
I just ran my applet on safari, IE, and fire-fox successfully.

Is there a cross-compatibility tutorial anywere for java(especially jogl)? because I can't find anything about it anywhere... And I really want my Mac using friends to be able to run my little applet Sad, and later things I make.

Offline gouessej
« Reply #6 - Posted 2009-03-22 21:59:38 »

You were right about ti being the java script enabled haha I can't believe I didn't check for that.
I just ran my applet on safari, IE, and fire-fox successfully.

Is there a cross-compatibility tutorial anywere for java(especially jogl)? because I can't find anything about it anywhere... And I really want my Mac using friends to be able to run my little applet Sad, and later things I make.
Do you understand what I meant??  [size=15pt]you don't need to do something special to support several operating systems[/size]
Of course, Linux and Mac don't have a different API for applets.

When you use Java Webstart, you only have to add a single line in your JNLP file to load all necessary files as I did for TUER, watch my JNLP file if you don't see what I mean. For applets, look at GL gears rewritten in Java on java.net, it is explained correctly.

Offline Cakey

Junior Member





« Reply #7 - Posted 2009-03-22 22:03:47 »

thanks for baring with me everyone. I know I'm probably an annoying poster, but I'm just trying, and a year from now I may be worth net-working with haha. peace & love.

Offline gouessej
« Reply #8 - Posted 2009-03-22 22:06:47 »

thanks for baring with me everyone. I know I'm probably an annoying poster, but I'm just trying, and a year from now I may be worth net-working with haha. peace & love.
No you're not annoying but please read our answers carefully. There are no stupid questions, it is better to ask a question than to do nothing.

Offline h3ckboy

JGO Coder


Medals: 5



« Reply #9 - Posted 2009-03-23 18:14:42 »

thanks for baring with me everyone. I know I'm probably an annoying poster, but I'm just trying, and a year from now I may be worth net-working with haha. peace & love.

don't worry it took me longer to get 2D vectors.

now that was an intense thread Wink
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.

TehJavaDev (18 views)
2014-08-28 18:26:30

CopyableCougar4 (26 views)
2014-08-22 19:31:30

atombrot (39 views)
2014-08-19 09:29:53

Tekkerue (36 views)
2014-08-16 06:45:27

Tekkerue (33 views)
2014-08-16 06:22:17

Tekkerue (22 views)
2014-08-16 06:20:21

Tekkerue (33 views)
2014-08-16 06:12:11

Rayexar (70 views)
2014-08-11 02:49:23

BurntPizza (47 views)
2014-08-09 21:09:32

BurntPizza (38 views)
2014-08-08 02:01:56
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!