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

[java] Running games in 2 windows in java???

Started by carlos100 Apr 27, 2006 at 6:34 AM 1 replies 1.1k views
Original Post
carlos100
carlos100
I have been making a simple game for a uni project. The basic idea is a virtual pet that you can play agmes with. I have a main window that shows the virtual pet and has the interface and the stat monitoring within it. But when the user chooses to play a game I want the game to appear in a new window over the top, but with the original window still open behind it. When I ahve been trying to do this the arcade style games are running ridiculously slowly because the other window is open behind. I have tried running the games as objects, at runtime and also having the gam,es main class file extending thread and running that way but nothing seems to make the games run at speed. The games run fine on their own I just need to know how to run them at a good speed from another class. Anyone able to help???
Son of Cain
Son of Cain
What rendering API are you using?

Without further information on your code, it's hard to guess what might be the cause of the slowdown. All I can advice is: the data shared by the status monitor window and the puzzle games' window must either provide synchronized access to it, or, when initiliazing a game with your pet, you supply it all the information required, avoiding concurrent proccessing of this data by both windows.

Son Of Cain
a.k.a javabeats at yahoo.ca
5MinuteGaming
5MinuteGaming
The only reasonable assumption I can make for the slowdown would be that your AI Pet monitoring window is using a lot of processor time making the game run more slowly.

The only other thing I can think of is if you are using shared classes. For instance, say you have a Pet object which you have a single instance of but is referenced in both the Monitor and the Game and you've synchronized both then the problem, I would say, would be that synchronization might be slowing you down. You might be close to a deadlock in some situations on window waiting for the lock to be released. You might need to add in a notifyAll() call on the objects being snychronized if any.

Otherwise, well, I got nothing!

Topic Locked

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

Sign in to reply to this topic.