|
biffone
|
 |
« on: August 26, 2007, 06:48:53 pm » |
|
I've attached a purpose for separation of the renderer module . It is a very simple test and it is not state of the art program . it is only a prototype.
The project it is an eclipse project and it contains 2 simple renderer implementation JOGL and Java2D. To run the test you must run the Test class.
Uncomment what render you want to test
Renderer renderer = new JOGLRenderer(); // Renderer renderer = new Java2DRenderer();
For JOGLRenderer you must use some native binary . You must run the Test class with java.library.path properties: Ex -Djava.library.path=lib/main/native/linux - for linux ( I use Ubuntu on my computer) -Djava.library.path=lib/main/native/windows - for windows . I din't test this. If you have problem contact me
Tell me what is your opinion.
Best regards
|
test.zip (1267.24 KB - downloaded 65 times.)
|
|
« Last Edit: August 26, 2007, 07:01:03 pm by biffone »
|
Logged
|
|
|
| |
|
2playgames
OpenWar Project Founder
Administrator
Sr. Member
 
Offline
Posts: 857
Busy busy busy busy busy
|
 |
« Reply #1 on: August 27, 2007, 04:34:43 pm » |
|
I will use your example to split the graphics bit of the main class into it's own abstract class and create a Java 2D implementation for it. Then I'll leave a JOGL/LWJGL implementation to you or someone else 
|
|
|
|
|
Logged
|
|
|
| |
|
|
biffone
|
 |
« Reply #2 on: August 27, 2007, 05:14:09 pm » |
|
Great. I will be very happy if i can help . i will create JOGL implementation and LWJGL . And i think we must change the InputManager and to use JInput or LWJGL ( or both implementation ) . I see in code that you also has the same opinion
|
|
|
|
|
Logged
|
|
|
| |
|
2playgames
OpenWar Project Founder
Administrator
Sr. Member
 
Offline
Posts: 857
Busy busy busy busy busy
|
 |
« Reply #3 on: August 27, 2007, 05:44:26 pm » |
|
i will create JOGL implementation and LWJGL don't you think one of those would be enough?  And i think we must change the InputManager and to use JInput or LWJGL ( or both implementation ) . I see in code that you also has the same opinion yes, the AWT input model is not very good for games
|
|
|
|
|
Logged
|
|
|
| |
|
|
biffone
|
 |
« Reply #4 on: August 27, 2007, 06:01:55 pm » |
|
I think one it is enough. I've preferred JOGL because it has the Sun company behind but also LWJGL it is good . I've worked with both
Regarding to the Input i think we can use Jinput ( the same reason like JOGL : Sun behind ) .
|
|
|
|
|
Logged
|
|
|
| |
|
|
biffone
|
 |
« Reply #5 on: August 27, 2007, 09:26:20 pm » |
|
Do you know when you will finish the new renderer arhitecture?
In this time i want to code the JOGL implementation. For this i need to know the signature of the methods in interface . Can i use for this GameGraphis class?
|
|
|
|
|
Logged
|
|
|
| |
|
2playgames
OpenWar Project Founder
Administrator
Sr. Member
 
Offline
Posts: 857
Busy busy busy busy busy
|
 |
« Reply #6 on: August 27, 2007, 09:33:31 pm » |
|
I will start to work on the new architecture sometime this week. I'm affraid you can't base anything on the current classes, since many things will be changed.
|
|
|
|
|
Logged
|
|
|
| |
|
|
biffone
|
 |
« Reply #7 on: August 27, 2007, 10:07:08 pm » |
|
In this case i can look at the input module or sound module . But before to begin I've looked closer in the code and i see a lot of singletons ( ok not a lot but the main components are singleton ). The evil part with this singletons is that singleton link very hard modules. The modules are not independent. I will create a new thread to explain this.
|
|
|
|
|
Logged
|
|
|
| |
|
2playgames
OpenWar Project Founder
Administrator
Sr. Member
 
Offline
Posts: 857
Busy busy busy busy busy
|
 |
« Reply #8 on: September 04, 2007, 10:06:57 pm » |
|
The new modular architecture is online. It has some bugs (such as not being able to exit the game except hitting stop in eclipse, and no support for image transparency) but please update to the new version and tell me what you think (you can run GameTest) 
|
|
|
|
|
Logged
|
|
|
| |
|
2playgames
OpenWar Project Founder
Administrator
Sr. Member
 
Offline
Posts: 857
Busy busy busy busy busy
|
 |
« Reply #9 on: September 05, 2007, 11:26:33 am » |
|
the two bugs above have been fixed. now it just has a nasty habit of hanging
|
|
|
|
|
Logged
|
|
|
| |
|
|
biffone
|
 |
« Reply #10 on: September 05, 2007, 05:49:10 pm » |
|
Hi
The problem is that i don't think i can write a JOGL Renderer with this approach .
In this architecture the renderer thread is not managed by renderer it is managed by Game class . I think it will better if it will managed by REnderer ( each renderer will manage this ) . Regarding Drawable, i think it will be nice if the display has the list with drawables not the game class . It is related very close with renderer
Display.addDrawable ();
This modification will fit perfect with the approach with renderer thread managed by Renderer
The problem is that JOGL work perfect when it running in one thread (AWT thread) . This this is the Sun recommendation
|
|
|
|
|
Logged
|
|
|
| |
|
2playgames
OpenWar Project Founder
Administrator
Sr. Member
 
Offline
Posts: 857
Busy busy busy busy busy
|
 |
« Reply #11 on: September 05, 2007, 06:25:33 pm » |
|
I believe the drawable list belongs in Game (or somewhere else), not in Display. Display should only be responsible for doing whatever the main game or a part of it tells it to do. It should theoretically be useful for other things than games.
Another reason not to put it in Display is that each display implementation would have to support the drawing loop (a.k.a. reinventing the wheel)
So, what would be your suggestion with the above approach?
|
|
|
|
« Last Edit: September 05, 2007, 06:27:15 pm by 2playgames »
|
Logged
|
|
|
| |
|
|
biffone
|
 |
« Reply #12 on: September 05, 2007, 09:47:42 pm » |
|
I've checked again the documentation.
The Jogl listener ( where the programmer can draw ) it is called in own thread and this thread in current implementation it is AWT thread. It is impossible to draw something in another thread.
The first ideea:
A solution is to have something like an AbstractDisplay . This class implements only the Rendering loop ( copy from Game Class) All renderer will extends this class with an exception JOGL ( because has an another rendering loop )
The second ideea . ( better )
I think the Drawable must belongs to the render part of the program not the game class . Maybe we can create an Interface Renderer that can contains the list of drawable and also has a method getDisplay() that returns a Display object that model the screen ( resolution , refresh , fullscreen ,etc ). And then we can create an AbstractRenderer that contains a basic rendering loop. Java2D renderer will extends AbstractRenderer the JOGL will implements directly Renderer. I think we must move the rendering loop to the rendering part .
|
|
|
|
|
Logged
|
|
|
| |
|
2playgames
OpenWar Project Founder
Administrator
Sr. Member
 
Offline
Posts: 857
Busy busy busy busy busy
|
 |
« Reply #13 on: September 05, 2007, 09:52:40 pm » |
|
maybe we can talk over IM sometime, it's hard to discuss this thing over a forum. I have MSN/Live, Skype and Google Talk
|
|
|
|
|
Logged
|
|
|
| |
|
|
biffone
|
 |
« Reply #14 on: September 05, 2007, 09:55:14 pm » |
|
andrei.dore - the skype id
|
|
|
|
|
Logged
|
|
|
| |
|
|
Meraxupypr
Guest
|
 |
« Reply #15 on: October 10, 2007, 12:58:14 am » |
|
one question, why not to use Slick for 2d render? slick,cokeandcode,com I'm interested in 2d rpg as a java programmer  PS: icq: 347008505 jabber: wormspy@gmail.commsn: wormspy@yandex.ru
|
|
|
|
|
Logged
|
|
|
| |
|
2playgames
OpenWar Project Founder
Administrator
Sr. Member
 
Offline
Posts: 857
Busy busy busy busy busy
|
 |
« Reply #16 on: October 10, 2007, 10:20:19 am » |
|
slick is a complete game engine. i like full control, and making a 2d engine is not that hard, so we're making our own 
|
|
|
|
|
Logged
|
|
|
| |
|
|