EO Jump System(ANY VERSION!)

Okay, I built this inside of Eclipse Final Frontier, but it doesnt use direct X so should work on any version of EO(Crystal Shire and Mirage Source 4 variations as well)

Now before we get started I WILL Note, that this is not perfect… took me a long time to develop this cause I had no Idea what I was doing but managed to figure it out xD Anyone experienced here probably could have done this on their own, but I haven’t seen anything posted before 🙂

Client Side:

Find your PlayerRec type and add this at the bottom:

'Jumping
IsJumping As Long
IsFalling As Long
JumpY As Long 

Find Call ProcessMovement and put this RIGHT below that line

If Player(I).IsJumping = 1 Then
                        If GetPlayerMap(I) = GetPlayerMap(MyIndex) Then
                            Call ProcessJumping(I)
                        End If
                    Else
                        Player(I).JumpY = 0
                    End If

Find Sub ProcessMovement and right above the sub add this:

Sub ProcessJumping(ByVal Index As Long)
    If Player(Index).IsJumping = 1 And Player(Index).IsFalling = 0 Then
        If (Player(Index).JumpY >= 32) Then
            Player(Index).JumpY = 32
            Player(Index).IsFalling = 1
        Else
            Player(Index).JumpY = Player(Index).JumpY + 4
            Player(Index).YOffset = Player(Index).YOffset - 4
        End If
    ElseIf Player(Index).IsFalling = 1 Then
        If (Player(Index).JumpY <= 0) Then
            Player(Index).JumpY = 0
            Player(Index).IsFalling = 0
            Player(Index).IsJumping = 0
            Player(Index).YOffset = 0
        Else
            Player(Index).JumpY = Player(Index).JumpY - 4
            Player(Index).YOffset = Player(Index).YOffset + 4
        End If
    End If
End Sub

Above Sub SendPlayerMove add this:

]Public Sub SendPlayerJump()
Dim buffer As clsBuffer

Set buffer = New clsBuffer
buffer.WriteLong CPlayerJump
buffer.WriteLong MyIndex
buffer.WriteLong Player(MyIndex).IsJumping
SendData buffer.ToArray()
Set buffer = Nothing
End Sub

Put SPlayerJump and CPlayerJump right below SPlayerMove and CPlayerMove…

Find HandleDataSub(SPlayerMove) = GetAddress(AddressOf HandlePlayerMove)

and add this under it:

HandleDataSub(SPlayerJump) = GetAddress(AddressOf HandlePlayerJump)

at the bottom of modHandleData put this:


Private Sub HandlePlayerJump(ByVal Index As Long, ByRef data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim I As Long
Dim buffer As clsBuffer

    Set buffer = New clsBuffer
    buffer.WriteBytes data()
    I = buffer.ReadLong
    Player(I).IsJumping = buffer.ReadLong

End Sub

THIS PART IS A LITTLE TRICKY! you can set a button to call this, or use vbkey to call it, doesnt matter how you do it… just find a method of how u want to call the jump and put this code in it:


Player(MyIndex).IsJumping = 1
        SendPlayerJump

THATS IT FOR CLIENT SIDE!

Server Side:

Go ahead and add the Enum’s back just the same way(SPlayerMove and CPlayerMove remember?)

Find HandleDataSub(CPlayerMove) = GetAddress(AddressOf HandlePlayerMove)

and add this under:


HandleDataSub(CPlayerJump) = GetAddress(AddressOf HandlePlayerJump)

Put this at the bottom of modHandleData:


Sub HandlePlayerJump(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim I As Long
    Dim buffer As clsBuffer

    Set buffer = New clsBuffer
    buffer.WriteBytes Data()

    I = buffer.ReadLong
    Player(I).IsJumping = buffer.ReadLong

    SendPlayerJump I

End Sub

Find Sub SendPlayerMove and add this above:


Sub SendPlayerJump(ByVal index As Long)    Dim buffer As clsBuffer

    Set buffer = New clsBuffer
    buffer.WriteLong SPlayerJump
    buffer.WriteLong index
    buffer.WriteLong Player(index).IsJumping

    SendDataToMapBut index, GetPlayerMap(index), buffer.ToArray()
    Set buffer = Nothing
End Sub

and last: Put this at the bottom of PlayerRec:

'Jumping
    IsJumping As Long

This by itself just makes the player jump… If you want this jump to interact with the world in various ways, just do call checks for

If Player(index).IsJumping = True -> In order to allow that interaction. This will force the player to be in jumping in order to do the interaction 🙂 Any questions I’d be happy to answer. any support needed I’ll do my best to give!

Mind showing some screenshot on how player jump? i don’t quite get this system

this script  is simular

to project vertigo hmmmm

It might be best to store all those player values in the TempPlayerRec. 😉 Other than that, good!

Its a client sided animation, the only reason theres interaction with the server is to tell other people that you jumped… YOffset is used to determine stuff with moving between the tiles so your not just teleporting around the tiles… (YOffset is used for pixel movement between tiles in various directions) and so its the server telling the client to animate the yOffset moving up and down with a lack of walking animation to appear jumping.

Best methods for making a jump system (probably only way I dont know) is to make the appearance of jumping that while the player is jumping a variable is active that other things in the engine can interact with that variable to give basicly the feel of the character ACTUALLY jumping.

@ModMatt, thats why its not TempPlayerRec cause its client side stuff… if u used the server end to keep track then it would be heavy on the network…

@Zopto, I havent looked in project vertigo xD I just made this on my own referencing how playermovement worked…

@Kazuto, This systems appearance is like the character(without animation) slides straight up exactly one tile… although it is buggy looking if you try moving at the same time(unless going left or right then  it looks perfect… could use with some conditioning for moving up or down to fix the buggy look but this is all i needed to at least create a jump system for a buddy) After the player moves straight up, 1 tile space, it moves back down. The character itself isnt actually moving, its just the picture for his character moving up in correlation to where hes actually standing to appear jumping(Uses gameloop as the timer for moving)

Any other questions or comments community?

It’s odd that someone would come around and shed some light on this kind of feature out of the clear blue. Especially since you’ve never really heard of Vertigo (let alone looked at its source). It took years for this to happen, and before you it was someone else, and before them it was me. Before me it wasn’t really anyone (everyone used to just care about SadScript, not source edits– you can thank Robin for that change in mindset).

Nice work!

@MrMiguu Lol I have always wanted a jump system since the elysium diamond days, and a good friend working on a mario fan game explained how it is done(at least his method for doing it in eclipse stable) and I just kinda took that idea and went from there on EO(took some learning how the engine actually worked, as far as the networking went cause it was a difficult concept for me to understand)

At any rate though xD Id finally made a Jump system, even though it isnt perfect and figured HEY Ill make a tutorial to tell everyone how to add it(granted they may want to improve on it) so at least its not some super huge mystery anymore 🙂 And Ive never relied on scripts xD always hated them.

FIX’

Server - ModEnumerations

Add


CPlayerJump

below CPlayerMove.

and… Add


SPlayerJump

below SPlayerMove in ModEnu…too

FIX’

Server - ModEnumerations

Add


CPlayerJump

below CPlayerMove.

and… Add


SPlayerJump

below SPlayerMove in ModEnu…too

Thanks for pointing out i forgot the enum in this post.

On a side note to anyone else, doing it in a temprec on server side would be better ONLY for anyone wanting to work this with the directional block system(say duplicating directional block into a jump block system separately) because the client will do hundreds of checks a second on the tile which will actually packet spam the server… however alot of this would need changed from something visual to something more permanent(which would be less glitchy looking overall anyway)

Log in to reply