Medieval Dreams

Started by William, July 12, 2023, 20:29:04

Previous topic - Next topic

Midimaster

hääää? are you kidding?

Quote... do you know are there functions for 3d text or dialogue for messages and names in openb3d or bmx? ....


Are you able to scroll?

The answer to this question is what I wrote in my last post on 2nd of Oct.
...back from Portugal

William

#46
i had thought this is a problem with openb3d but that perhaps it is execution of what the code is telling b3d to do.
it is not always the same each execution of client, sometimes the player falls through terrain at certain coordinate degrees of  entities.

terrain is at 0 Y axis but that,  player entity pivot is sometimes of Y axis coordinate degrees between after the entity is moved why is there variance not between when entitycollided and entity jumps and lands back on terrain (entityisonground=true and therefor not moved any further if entitycollided(terrain, pivot) = true.) (jumps: player moved +positive degrees in Y axis). i believe i need to develop code to compensate of the entity playerisonground=true case clause player not above terrain/on terrain below terrain, seems i may need to know manual collision and i shall post code i have in the appropriate section.

in bad english: player "falls" and player is moved to under the terrain but not on every execution of application client. sometimes playerisonground is set to false when it should be true
joy in who i am. personal discovery. original of myself. live longer, do more.

William

i found a culprit. collision isnt always detected and in the case that it does not detect collision the else statement its set to false. but is there any way to detect distance from the nearest points between two entity's surfaces?
joy in who i am. personal discovery. original of myself. live longer, do more.

William

just wanted to say that i am not entirely certain i've done the threading of the openb3d copy entity command safely or that openb3d can become safely threaded. well, it does not result in a crash (yet) but that though i close the thread it does output segmentation fault on app termination.
joy in who i am. personal discovery. original of myself. live longer, do more.

William

Just thought: perhaps maybe that it only appears the player falls through the terrain due to the position of the model and the pivot. not sure how to correct this as pivot is not visable to try to position them correctly.. though perhaps it is not the model for it does not happen consistently, occasionally a player can walk to the edge of the corner and occasionally the player falls through.
joy in who i am. personal discovery. original of myself. live longer, do more.

angros47

Quote from: William on November 13, 2023, 01:07:51is there any way to detect distance from the nearest points between two entity's surfaces?

Yes, you can use a pick (LinePick or EntityPick, for example), and then use PickedTime that returns the distance of the last pick operation.

Midimaster

Normally, the pivot would always stays (glides) on the ground, while only the mesh jumps or does strange movements. In this configuration the mesh always needs to return to Y=0, because this is the "inside" base of the pivot. So no need to check mesh against terrain. Or?

...back from Portugal

William

but how then, does the pivot stay under meshes like rocks or other objects the player may have jumped on a top of?

idk.. i dont like that style. i may, i am to consider it.
joy in who i am. personal discovery. original of myself. live longer, do more.

Midimaster

Good question...

The pivot controls floor altitude and it's related Y-collisions. So I would guess, the pivot needs to rise to the top level of a rock, when a rock appears.

But it is a simple rising, not a jump or a somersault. Like an elevator. And inside the elevator, the player performs a jumping action. And returns to "inside-0"
...back from Portugal

William

#54
i checked, blender says model coordinates are 0,0,0. player occasionally falls under the terrain while walking on top of it, pivot and entity coordinates match mostly,  one is -0 degrees.

this is the code:

If  PlayerTime<MilliSecs() And PlayerIsOnGround=False'And YAcceleration<>0
PlayerTime = MilliSecs()+ MOTION

YAcceleration = YAcceleration - GRAVITY

MoveEntity me.Pivot, 0,YAcceleration,0
'Print EntityY(Pivot)
If EntityY(me.Pivot)<0
'  auto floor collision or:
'PositionEntity me.Pivot, EntityX(me.Pivot), 1 , EntityZ(me.Pivot)
YAcceleration=0
EndIf
EndIf

Local pX:Int = EntityX(me.pivot)
Local pY:Int = EntityY(me.pivot)
Local pZ:Int = EntityZ(me.pivot)


Local WhoCollided:TEntity = EntityCollided(me.pivot,GroupEnvironment)
If WhoCollided=terrain
     'Print "Entity has collided with the terrain"
PlayerIsOnGround = True
ElseIf EntityY(me.pivot) > ( TerrainY(terrain, pX, pY, pZ))
PlayerIsOnGround = False
'Print "player isnt colliding with anything"
EndIf

i think it is a openb3d fault.
joy in who i am. personal discovery. original of myself. live longer, do more.

Midimaster

#55
The use of INTEGERs is definitely wrong, if you want to find the correct TerrainY!


This code would simplify the calculations:

(not tested)
Global YAcceleration:Float
Global PlayerIsOnGround:Int
....
Repeat
    CheckPlayerAltitude
Until...


Function CheckPlayerAltitude()
        Global PlayerTime:Int        
        If  PlayerTime > MilliSecs() Then Return

        PlayerTime     = MilliSecs() + MOTION
        YAcceleration  = YAcceleration - GRAVITY

        Local pX:Float = EntityX(Me.Pivot)
        Local pY:Float = EntityY(Me.Pivot)
        Local pZ:Float = EntityZ(Me.Pivot)
        Local pT:Float = TerrainY(Terrain, pX, pY, pZ)

        If (pY+YAcceleration) < (pT + 1.01)
            YAcceleration    = pY-(pT+1.01)
            PlayerIsOnGround = True
        Else
            PlayerIsOnGround = False
        EndIf
        MoveEntity Me.Pivot, 0, YAcceleration, 0
End Function

If you still need PlayerIsOnGround outside this function, you can keep it, but the functions itself would not longer need it.
...back from Portugal

William

#56
okay midimaster i should look into using your alternative.

well, i thought that perhaps the entity type were the culprit that perhaps the entity type used for collision were not the pivot. no, turns out its the if statement if entity Y is less than 0 then set entity y acceleration to 0 and move entity and the check that the entity collided with the terrain becomes false and the player is moved below terrain.

that was the culprit :)  during collision sometimes the player is at less than 0 before positioned. something like that.

edit: setting yacceleration to 0 triggered a cascade effect i believe. i still am uncertain it has been corrected.
joy in who i am. personal discovery. original of myself. live longer, do more.