Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
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  
  Lotta hassle with 11/24/03 release  (Read 1784 times)
0 Members and 1 Guest are viewing this topic.
Offline Java Cool Dude

Senior Member




Java forever


« Posted 2003-11-24 22:44:48 »

Now even the JWS demo on the home page that involve interaction crash blaming it on:
1  
2  
java.lang.Error: Illegal Scenegraph Modification 
        at com.xith3d.scenegraph.View.checkForIllegalModification(View.java:256)

Sigh! Looks like it's suicide time
Offline Java Cool Dude

Senior Member




Java forever


« Reply #1 - Posted 2003-11-24 22:49:44 »

Fixed tada Grin
1  
main.view.stopView();

That's all what it is required to prevent my demo from crashing.
I call that once just before I detach attach some BranchGroup Tongue
Offline Daath

Junior Member




Java games rock!


« Reply #2 - Posted 2003-11-24 23:18:38 »

actaully I just got same exception using latest build
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Java Cool Dude

Senior Member




Java forever


« Reply #3 - Posted 2003-11-24 23:44:27 »

Quote
actaully I just got same exception using latest build

Dude wait till you bump into some other nasty exceptions as well, I had to throw view.stopView() everywhere to get my work up and running again :/
Offline DavidYazel

Junior Member




Java games rock!


« Reply #4 - Posted 2003-11-25 00:22:38 »

Sorry guys.  The check which you are referring to can be deactived in View.java, there is a constant there which controls whether the check is done.

We could also remove it completely, or tie it to a property.

Please remember that it is a design tenant that the scenegraph is not threadsafe.  Having a swing component modify the scenegraph means that the swing thread is modifying the scenegraph.  If you add a branchgroup or change a transform while the view is rendering it will eventually bite you bad, and believe me that bug is hard to track down.

Many of the users of Xith3d are writing demos and perhaps arnt interested in building a solid game rendering engine.  For those of you that are, remember that you should be updating the scenegraph between frames, not while the view is running.  In Magicosm we have a lot of messages coming into the client on different threads.  We queue up scenegraph modifications and process them each frame.  This is done by having a SceneUpdaterInterface which can be implemented to perform scene modifications.  So for example we have an UpdateAddBranchGroup and UpdateChangeSwitch types.  In addition, groups of updates which must be done in between a frame switch are added to a special UpdateTransaction which is guarenteed to be executed all at once.  Other than that the scene updater, which is called once per frame, paces the updates so that no one update to the scenegraph takes too long.

Perhaps this type of archtiecture can be an add on to Xith3D to provide a more complete and robust game engine, but I don't think it belongs in the core.  How people design their frame rendering loops is very unique to their project and I don't want to go down the path of Java3d which took it to incredible heights to ensure that the scenegraph could be modfied by differnet threads and still work.


David Yazel
Xith3D Project Founder
http://xith3d.dev.java.net

It may look complicated, but in the end it is just a bunch of triangles
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #5 - Posted 2003-11-25 04:42:13 »

Hi
 Right, if your are updating the scenegraph outside of your rednering thread you *have* to sync them up, which the view.stopView() does. What I've done in the past with java3d and am in the process of doing again for xith is having a data model of my game state and a 3d model of it, nice and seperate, seperation of data and presentation Smiley, the data model gets updated on the fly from swing or mouse/keyboard events. The thread with the view.renderOnce() in it runs round rendering as fast as it can with an update before each render that updates teh 3d model from their respective data model components.
 From my own point of view removing that check is just asking for trouble Smiley. If your going to do it can we have it as a property that is enabled by default? Smiley

Cheers

Endolf

Offline Preston

Senior Member


Medals: 4



« Reply #6 - Posted 2003-11-25 09:53:38 »

Quote
Please remember that it is a design tenant that the scenegraph is not threadsafe.  Having a swing component modify the scenegraph means that the swing thread is modifying the scenegraph.  If you add a branchgroup or change a transform while the view is rendering it will eventually bite you bad, and believe me that bug is hard to track down.

Thanks for that article. It explains some things I noticed a short time ago.

Most of the collections are thread-unsafe, too, by default. It's a good design decision that those who need multi-threading have to activate this with own means.

Quote
How people design their frame rendering loops is very unique to their project

I fully agree. The typical model-view-controller pattern logic belongs to the application.

Xith3d is so nice.
Offline Daath

Junior Member




Java games rock!


« Reply #7 - Posted 2003-11-25 15:22:40 »

Dave's post should go to Xith3D FAQ -  I am sure newcomers will run into that issue again and again. Also idea about having xxxUpdate interfaces is most excellent one. Worth reading every word!
Offline Jens

Senior Member




Java for games!


« Reply #8 - Posted 2003-11-25 16:02:09 »

This is now a FAQ. Please complain if the explanation isn't good.

Xith3D Getting Started Guide (PDF,HTML,Source)
Offline Daath

Junior Member




Java games rock!


« Reply #9 - Posted 2003-11-25 16:10:56 »

Complain? ...no way  Smiley .. I shall resolve into reading DOCS and FAQ once in a while  Grin
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline shochu

Junior Member




Java games rock!


« Reply #10 - Posted 2003-11-26 18:49:26 »

I set up my mouse and keyboard listener's like in the demo.  I'm using the keyboard to move my character around on the screen by updating the translate tranform on the model.  I noticed that when I hold down the keyboard to move my character he flashes and jumps on the screen.  Would this be because the keyboard input is done in a sperate thread and it's trying to make changes to the scenegraph while the view is being rendered?  If this is the case how would I change the mouse and keyboard input to be threadsafe?  THanks for the help!
Offline kevglass

JGO Kernel


Medals: 159
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #11 - Posted 2003-11-26 18:51:03 »

Generally you have a listener that sets flags to indicate that keys are pressed.

Then in the scenegraph thread you check the thread and cause the effects. This way, no actual change take place in the AWT event thread (that has responded to the key press).

Kev

Offline shochu

Junior Member




Java games rock!


« Reply #12 - Posted 2003-11-26 23:05:41 »

THanks .... I'm working on that now =)
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 (12 views)
2014-08-28 18:26:30

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

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

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

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

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

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

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

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

BurntPizza (33 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!