About Store Forum Documentation Contact
Donations:
345$/mo



Post Reply 
Movement code bug on AMD?
Author Message
Zervox Offline
Silver Supporter

Post: #1
Movement code bug on AMD?
Code:
if(action)
      {
         if(Kb.b(KB_W) || Kb.b(KB_S) || Kb.b(KB_A) || Kb.b(KB_D) || Kb.b(KB_Q) || Kb.b(KB_E))actionBreak();
      }

      if(!action)
      {
        
         // turn & move
         input.move.z=(Kb.b(KB_A)-Kb.b(KB_D)) * angle.x;
         input.move.y=Kb.b(KB_SPACE)-Kb.b(KB_LSHIFT);
        
         // dodge, crouch, walk, jump
         input.crouch= Kb.b (KB_LSHIFT);
         input.walk  = !Kb.b (KB_LCTRL );
         input.jump  =(Kb.bp(KB_SPACE ) ? 6 : 0);

         // mouse turn
         flt max = DegToRad(600)*Time.d();
         angle.x += (Kb.b(KB_A)-Kb.b(KB_D)) * max; //Mid(Ms.d().x*1.7, -max, max);
        
              if(angle.x >= DegToRad( 90)) angle.x = DegToRad( 90);
         else if(angle.x <= DegToRad(-90)) angle.x = DegToRad(-90);
        
         Vec tempPos = Players[0].pos();
         Players[0].pos(tempPos);
      }

this code was used in an example by Tottel, when we were going to test it, we found that there is another bug which might be for AMD cpus only, this failed to make the character move on two of my AMD computers .
but the character on my Intel CPU HTPC, and it ran on Tottel's computer and aceio76's computer all Intels.

I tried the standard movement code in Esenthel and it worked perfectly.
using the code above would result in allowing my AMD computer to only turn but not move.

all computers were using Windows 64bit.

movement is ok in EE1.0 C++ but not in EE2.0 EsenthelScript

input.move.z, is getting the correct value as to that it should move, but it doesn't, which makes me think there is an issue with the controller object.
(This post was last modified: 09-01-2013 02:18 AM by Zervox.)
09-01-2013 01:48 AM
Find all posts by this user Quote this message in a reply
krokodilcapa Offline
Member

Post: #2
RE: Movement code bug on AMD?
Hi Zervox! I tried this code, I also have AMD (X2 4200+) and I've got the same result. And I also use Windows 7, but 32bit. So +1 for its AMD only bug.
09-01-2013 08:59 PM
Find all posts by this user Quote this message in a reply
shadow Offline
Member

Post: #3
RE: Movement code bug on AMD?
Code:
input.move.z=(Kb.b(KB_A)-Kb.b(KB_D)) * angle.x;
maybe your code is wrong?
the result is stored as VecI (integer)

Did you try to debug and check what step gets wrong/different results?
09-01-2013 10:40 PM
Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #4
RE: Movement code bug on AMD?
(09-01-2013 10:40 PM)shadow Wrote:  
Code:
input.move.z=(Kb.b(KB_A)-Kb.b(KB_D)) * angle.x;
maybe your code is wrong?
the result is stored as VecI (integer)

I don't believe that code is wrong (it's always possible though). I simply multiply with the angle because I'm making a side-view game. My character goes left- and right, and the movement keys need to be inverted when the character turns. That is all that the angle does (positive or negative).
Even if you multiply the move.z with 100, it doesn't matter, since it's the player speed that defines the speed of the character, not this input.
09-02-2013 01:39 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: Movement code bug on AMD?
You should try to make sure that move.z is -1, 0, or +1
09-02-2013 11:42 PM
Find all posts by this user Quote this message in a reply
Zervox Offline
Silver Supporter

Post: #6
RE: Movement code bug on AMD?
Already did test that, it doesn't move even if move is -1,or 1 with the code above. The thing is this only happens on AMD processors on EE2.0 it seems.
09-03-2013 05:30 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
RE: Movement code bug on AMD?
Code:
Vec tempPos = Players[0].pos();
          Players[0].pos(tempPos);
Why are you doing this?

If the default game.chr movement code works ok, but yours doesn't, did you try debugging exactly which step goes wrong? (different results)
09-03-2013 06:42 AM
Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #8
RE: Movement code bug on AMD?
(09-03-2013 06:42 AM)Esenthel Wrote:  
Code:
Vec tempPos = Players[0].pos();
          Players[0].pos(tempPos);
Why are you doing this?

If the default game.chr movement code works ok, but yours doesn't, did you try debugging exactly which step goes wrong? (different results)

Code:
// Lock player so he can't go sideways
Vec tempPos = Players[0].pos();
tempPos.z = -1;
Players[0].pos(tempPos);

That's what it originally was. It's a side-view game, so I'm locking the character on the depth axis. I guess Zervox left it out for testing.
09-03-2013 10:29 AM
Find all posts by this user Quote this message in a reply
Zervox Offline
Silver Supporter

Post: #9
RE: Movement code bug on AMD?
The question here isn't why something is done a certain way, the question is why the code behind this is getting different results while running on AMD or Intel, this is a runtime issue. the same compiled .exe using the movement code above will allow people to move on Intel but not on AMD(from the ones tested so far atleast), again this only happens when using EE2.0 code editor for compilation. Also note once again, it doesn't matter which computer cpu compiles it to a binary, it only matters which cpu is running it.

If this is an issue with Intel or AMD I really don't know, but in any case having this issue might potentially let a person do a ton of code only to find out later his project is completely broken on the other vendor brand. That is what worries me(the VERY different behavior, moving vs not moving).
(This post was last modified: 09-03-2013 02:38 PM by Zervox.)
09-03-2013 02:37 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #10
RE: Movement code bug on AMD?
This could be just rounding issue, for example what if values like 0.4999 or 0.5 could be rounded to 0 on one platform and to 1 on another, I'm not saying that this actually happens, but I guess different FPU's can have slightly different results.
You should do debugging, and see at which step you're getting different results smile
09-04-2013 01:02 AM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #11
RE: Movement code bug on AMD?
Let me see if I can summarize this:

Taking the same code above:
- When code is compiled on the EE1.0 headers+libs
Code:
Movement functions as expected on Intel PC
Movement functions as expected on AMD PC
- When code is compiled on EE2.0 code editor
Code:
The movement works as expected on Intel PC
The movement fails to work when run on an AMD PC

Please note the code is the same throughout all testing.

Zervox, can you please confirm this is what is happening?
(This post was last modified: 09-04-2013 02:55 PM by aceio76.)
09-04-2013 02:52 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Zervox Offline
Silver Supporter

Post: #12
RE: Movement code bug on AMD?
Yes, this is what is happening.
09-04-2013 05:53 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #13
RE: Movement code bug on AMD?
EE 2.0 uses PhysX 3 which has background processing of the physics simulation.
Perhaps you're having problem because Intel/Amd some of those cpu's finish simulating quicker than the other cpu, and the code is not compatible to work with background processing, for example the manual assignment of the player position each frame.
09-05-2013 09:34 PM
Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #14
RE: Movement code bug on AMD?
To the people who tested it:

Which CPU do you have AND what was your FPS?

I've noticed that if I have my FPS above 60, I can't move at all anymore. And this is on an Intel.
09-06-2013 10:47 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #15
RE: Movement code bug on AMD?
Hi Tottel, please check my previous post as I think it caught the issue.
Please focus on PhysX 3 being processed in background thread, and if you manually set the position each frame, then its velocities will be ignored, because they will get overridden by the position adjustment. Controller operates only on velocities. Please look into PhysX 3 documentation about background physics processing and manipulating positions/velocities in the meantime.
This problem is called "race condition" and it's not related to the type of the CPU intel/amd.
Solution is to not adjust the position each frame, but if you want to limit the movement in one plane, then just call Actor.freezePosZ or similar.
09-06-2013 11:00 AM
Find all posts by this user Quote this message in a reply
Post Reply