About Store Forum Documentation Contact
Donations:
178$/mo



Post Reply 
Problem with actors and threads, Esenthel 2.0
Author Message
Patalarc Offline
Member

Post: #1
Problem with actors and threads, Esenthel 2.0
First of all, greetings to all the community. (This is my first post, sorry for my bad English)

I'm programming a game with a procedural generated world.

When I create actors in a second thread (i need to do so because certain features of the game), in Esenthel 1.0 had a bug that only happened from time to time to create an actor: “ERROR: Can't create actor… etc…”

I fix this replacing: “example.create(Phys_example);” by:

while (!example.createTry(Phys_example)) Time.wait(10);

With this, in those rare occasions when he could not create the actor, just tried again and created, in the worst case always succeed on the second attempt and as the error does not happen often is not noticed at all the time playing.

With this change, I tried the game and it works perfectly for hours without errors.

The problem was to switch to Esenthel 2.0, apparently the command "createTry" not working properly, or have conflicts with the player physics.

Even "create" command not show the error, but it simply crash the program.

I'm not sure if it is a bug, or I have something misconfigured or poorly programmed. I make 2 programs that simulate the problem to see if anyone else has the same error, or is it just me.

Esenthel 1.0: Main.cpp in tutorial with Microsoft Visual C++ 2010
Esenthel 2.0: a folder with the proyect.

http://www.mediafire.com/?zp3lacc7d256jyo

Both are identical. The first I had no problem running hours and the second fail, sometimes takes 5 or 10 minutes before the error, sometimes a few seconds. (If you increase the complexity of the actor that is generated, or the number of these, get error more often.)

You can see these programs running:

ESENTHEL 1.0:

[Image: TestEE1_zpsff626850.jpg]

ESENTHEL 2.0:

[Image: TestEE2_zpsa58dd4c0.jpg]

Version 1.0 shows that the failed attempts counter "createTry" increases from time to time, while version 2.0 to run into the same situation just get error.

I have all updated drivers and the latest versions of Esenthel 1.0 and 2.0

I would like to continue programming in Esenthel 2.0 because it is faster than the 1.0 (on certain things much faster).

Thank you and congratulations for this excellent engine.
04-24-2013 03:38 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Problem with actors and threads, Esenthel 2.0
Hello and welcome to the forum!

Many thanks for providing detailed info about the issue.

I've made some physics methods multi-thread safe, and your code will work ok in next release.
04-25-2013 03:50 PM
Find all posts by this user Quote this message in a reply
Patalarc Offline
Member

Post: #3
RE: Problem with actors and threads, Esenthel 2.0
That's great! I'm happy to read that, now I can move to 2.0 without problems. Yay!
04-26-2013 04:32 AM
Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #4
RE: Problem with actors and threads, Esenthel 2.0
This is interesting. I've had some trouble before with physx and mutli threading. Are these changes specific to physx 3.x or will it also affect 2.x as well?
04-26-2013 11:42 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: Problem with actors and threads, Esenthel 2.0
The safety will be included for all physics engines.
However only PhysX 3 is built to support multi-threading.
04-27-2013 11:36 AM
Find all posts by this user Quote this message in a reply
Post Reply