Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Developer want PhysicsBody to be synced #50

Open
Ismoh opened this issue May 11, 2022 · 3 comments
Open

Developer want PhysicsBody to be synced #50

Ismoh opened this issue May 11, 2022 · 3 comments
Labels
enhancement New feature or request. This will increase MINOR version number, when merged into develop. good_first_issue Good for newcomers help_wanted Extra attention is needed

Comments

@Ismoh
Copy link
Owner

Ismoh commented May 11, 2022

In #27 I started to make PhysicsBodies to be synced on clients, but it looks like it is a lot of work.
I've done it by adding changed xml files to the mod.

I already started to implement lua code to automatically convert PhysicsBodies to Entities again.

It is wasting my time atm, that's why I dont continue in #27 on it.

See EntityUtils.modifyPhysicsEntities()

@Ismoh Ismoh added enhancement New feature or request. This will increase MINOR version number, when merged into develop. help_wanted Extra attention is needed good_first_issue Good for newcomers labels May 11, 2022
@Ismoh
Copy link
Owner Author

Ismoh commented Jun 26, 2022

More or less done in #48. Can be polish/tweaked here some day in the future.

@Ismoh Ismoh added this to the Synchronisation milestone Sep 2, 2022
@Ismoh Ismoh added this to NoitaMP Nov 22, 2022
@Ismoh Ismoh moved this to 📋 Backlog in NoitaMP Nov 22, 2022
@Ismoh
Copy link
Owner Author

Ismoh commented Nov 22, 2022

Remove xml files and do it with nxml changes on runtime. Make sure this is really necessary!

@Ismoh
Copy link
Owner Author

Ismoh commented Dec 29, 2022

Use the attachment to work with physic bodies!
physics.zip

Evaisa: it is extremely simple to implement, basically am just doing
local x, y, r, vx, vy, av = physics.bodyGetTransform(physbody2Comp)
steamutils.sendData({type = "position_update", x = x, y = y, r = r, vx = vx, vy = vy, av = av }, steamutils.messageTypes.OtherPlayers, lobby )

and then on the data receive end
if(data.type == "position_update")then
    if (golfPlayerEntities[tostring(user)])then
        local client = golfPlayerEntities[tostring(user)]
        local physbodyComp = EntityGetFirstComponentIncludingDisabled(client, "PhysicsBody2Component")
        physics.bodySetTransform(physbodyComp, data.x, data.y, data.r, data.vx, data.vy, data.av)
        
    end
end
[11:31]Evaisa: if you have mingw32 installed you can compile it with
mingw32-make windows32
but there is also a precompiled version in the zip

Credits to BlueAmulet, dextercd and Evaisa!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request. This will increase MINOR version number, when merged into develop. good_first_issue Good for newcomers help_wanted Extra attention is needed
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant