Jump to content

[Solved]Syncing player movement based on RenderTickEvents with ServerTickEvents


gpouliot

Recommended Posts

I'm looking for ideas on what direction I should take, not necessarily a specific answer.

 

Long story short:

 

I'm managing building pre-recorded structures during server tick events and doing pre-recorded player movements during render tick events (to get smooth motion).  Although I can mostly get things synced up and consistent, the player movements are dependent on performance and get out of sync with structure building if conditions change (like when I try to record things with video capture software).

 

Any thoughts on how best to get the camera (player) from point A to point B in a specific amount of server ticks while still having it be smooth?

 

Long story long:

 

I made a mod which lets me record block placement and then playback the recordings.  I can adjust the playback speed, number of copies, location etc.  The playback process is handled during SeverTickEvents.  In addition to this, I am able to move the camera (the player) to and between set locations during RenderTickEvents .  The idea is to build structures while the camera moves around to set locations.

 

The problem is that while structure building is not dependent on performance (it's pretty consistent because it's based on server ticks) the player movement is based on performance.  I figured that I could manage with this because the results were "consistent" (given the same conditions).  However, the moment I tried to start recording the results using video capture software, the player movements and structure building quickly got out of sync.

 

Possible Fixes:

 

- I was thinking that I could time player movements based on server ticks (ex. Move player from A to B in 20 ticks) but keep track of the average number of render ticks per per server tick (based on current performance) and update the players location exactly 3 times per server tick (to accommodate 60fps recording).  For example, if there was 30 render ticks during the last server tick, I would update the player's location every 10 render ticks during the next server tick.  I'm not really sure if I can do this smoothly without judder and inconsistent movements.

 

- A more extreme solution (which I hope I don't have to implement) would be to try and render everything offline like some recording mods do.  I hope that there's an easier solution.

 

Any thoughts?  Am I making things more complicated than it should be?

Link to comment
Share on other sites

It's turns out that using the render tick events actually works really well for me.  For a workable mod that is supposed to be played by people, not so much.  For my video capture purposes, it works great.  In fact, it's better now.  I can individually build blocks at 120 (or more) individual block placements per second instead of just 20...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello all! I'm currently trying to make the Biomes o' Plenty mod (1.12.2 version) compatible with my shaderpack (BSL v8.5). Even after I've already inserted a "shaders" folder with a correctly-formatted blocks.PROPERTIES file within the assets folder of the .jar, it still does not wave the textures from the mod. I definitely thought this was going to work since I noticed the 1.19.2 version of the mod laid it out exactly like that and it worked perfectly when my PC was able to run 1.19.2 Forge... ^^;;; Could there be some missing link I'm not getting at here?
    • After much experimentation I finally realised why this doesn't work and how to fix it. The critical component to understand here, is that ItemCraftedEvent is called before the crafting ingredients are purged from the crafting slots; this all happens in ResultSlot.java's onTake method: We can see here the first line fires checkTakeAchievements, this is what fires the ItemCraftedEvent (after a few method calls). Then we can see the purge behaviour. I worked around this by creating a CarverItem class, which uses hasCraftingRemainingItem and getCraftingRemainingItem to hook into ResultSlot.onTake: Now, I reconstruct my ItemCraftedEvent handler, and using some smart tags (which I omit for brevity), I handle two cases: 1. When crafting a carved item, I damage the tool used in the recipe 2. When crafting a carving tool from a repair recipe, I manually purge the input tools as with the new CarverItem class, as otherwise items would be duplicated   This has now greatly improved implementation, beyond my expectations, for the standard crafting table and the user's inventory crafting grid. A user can now click or shift-click 'carve' items, with no duplication or issues that I have spotted so far.  
    • Hi, I'm having issues launching my Forge 1.20.1 installation (47.2.0). I keep getting error code 1, and all the logs abruptly pause with the game attempting to open GL 4.6. Latest Crash: https://pastebin.com/zsP5Wipk Debug (No idea what the real name is) Log: https://pastebin.com/CzvqhNq0   Thanks for the help!
    • In the most up to date version of Allthemods 6 (v1.9.2) the stoned bee is not able to be interacted with apart from putting it into an empty bee jar. I can't breed the bee or put it into my aviary breeder. When I try to put it into the breeder it says import unsuccessful. The stoned bee is one of the most important bees for advancing in the mod so it is rather unfortunate that it is not working as intended.
    • Everytime I try to run the Forge 1.20.1 - 47.1.0 Installer, only appears an a black window and then closes. I don't appear the installing menu anymore.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.