Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - thephpdev

#1
Support / Re: Error while Multi-Threading
October 23, 2012, 05:13:19 AM
Fedora Linux, Intel Pentium, 4GB Memory, 500GB Hard Drive, 2 cores, hyperthreaded.
#2
Support / Re: Error while Multi-Threading
October 22, 2012, 01:36:02 AM
The FPS is at around 5 naturally with collision and everything, and a polygon (triangle) count of around 12,288. When I remove collision detection I get something around 13-14, but I need collision detection. I have never used any of the items you list there, but it sounds like something I would like to do. I will have to figure out some alternatives to the threading.
#3
Support / Re: Error while Multi-Threading
October 21, 2012, 10:53:59 PM
I want to use multiple threads because I get far too low FPS currently, and since I plan on having this be a rather big game with many things going on I am going to multi-thread it. Why isn't the library synchronized anyway? Naturally many people would want to do other things, and have other threads move the character etc.
#4
Support / Re: Error while Multi-Threading
October 21, 2012, 08:36:23 PM
I create the framebuffer and do my rendering inside the timer thread, but I modify the world in the other thread - not the buffer. Is that an issue?
#5
Support / Error while Multi-Threading
October 21, 2012, 06:47:33 PM
In my attempts to multi-thread my program, I have run into troubles with getting it to work with JPCT. Here is my error:
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
java: xcb_io.c:178: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.


I have JPCT update the screen and render with a timer thread, which is shown here:

frameTimer = new Timer(1000 / FPS, new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if (!isInitialized) {
open();
update3D(chunk);
playerProcess.setWidthHeight(buffer.getOutputWidth(), buffer.getOutputHeight());
playerProcess.start();
viewChanged = true;
}
buffer.clear(Color.BLACK);
font.blitString(buffer, "Frame Rate:  " + currentFPS, 5, 15, 0, Color.WHITE);
font.blitString(buffer, "Target Rate: " + FPS, 5, 35, 0, Color.WHITE);
synchronized (world) {
synchronized (player) {
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
}
}
buffer.displayGLOnly();
viewChanged = false;
frameID++;
if (new Date().getTime() - frameSecondTime >= 1000) {
playerProcess.setSpeed(1.2f * (25f / FPS));
frameTimer.setDelay(1000 / FPS);
currentFPS = frameID;
frameID = 0;
frameSecondTime = new Date().getTime();
}
if (!running) {
close();
frameTimer.stop();
Thread.currentThread().interrupt();
}
}
});


And then I have another thread that modifies the camera position and rotations plus the player object, which acts as an easily modifiable class that I want to be able to change at a later date. I create a synchronized block every time I want to modify world or player, both in the timer thread and in my own processing thread. Any idea of how to fix this, or what's wrong?