Jump to content

Recommended Posts

Posted

I read the forge tutorial and I wanted to ask some precisations.
Until now I only worked with bukkit/spigot (so plugins) and I tought that the network design was that the server had all the game-logic and the client was only there as an input-output device with almost no game logic included.
Then I saw the forge tutorials and mods, where most of the code (including the game logic) is shared between client and server and the sided things are generally a few classes.
How could this work? Shouldn't this design have bugs caused by different choises taken from server and client? Where can I find some clear code or documentation that explains this?
Another question: is the vanilla minecraft networking designed like the mods too (with the shared game logic)?

Posted

If you have the same code on both client and server, why would they make 'different choices'? Code is code, it doesn't think it just does exactly what you tell it to do.

But yes the idea is to move all of your major logic to the server and make the client a 'dumb client'. This just makes good design sense because it lowers the complexity of the client. Thus lowering potential desync/processing/error issues.

But it does introduce lag, and this is why some logic is good on the client. If the client can predict what the server is going to do then it can start doing that before the server has told it to. Or better yet the server can be less accurate in the information it sends to the client and the client can interpolate between the data. For example entity movement. Instead of sending one packet per tick per entity to every client. The server can send "this entity is moving this direction" when the movement starts and a "the entity is now at x,y,z" every, 20 ticks. That's instantly 1/20th of the bandwidth/processing time used.

 

It's a balance between end user experience and performance. And there are many schools of thought onto which side is more important.

 

As for Vanilla code, Vanilla code is horrible. Its all client side because the client and server were written separately for the bulk of the early development. The dumb-client approach wasn't even thought about until about MC 1.3, and there is so much code debut that you can't really get out of it. So we work with what we have.

 

 

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

Thank you for the answer!
 

  Quote

If you have the same code on both client and server, why would they make 'different choices'? Code is code, it doesn't think it just does exactly what you tell it to do

Expand  

I meant that in a big project there could be some hard-to-see bugs caused by non-synchronized variables (in a big project it isn't that far-fetched to forget a variable) or packets that arrive some ticks after they were ment to be received (due to the connection). That could cause bugs even if the code is the same, right?
 

  Quote

But yes the idea is to move all of your major logic to the server and make the client a 'dumb client'

Expand  

I can't seem to find really much examples of that, looking at open-source mods (like AE2) I see just the minimal code in the sided part of the code, am I misunderstanding something?

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I can't figure out if you're looking for help trying to steal someone elses work, or cheat at the game....
    • Title: Why Is It So Hard to Rename and Restructure Mods Like Xray or AntiXray? 🤔 Post text: Hey everyone! I’ve been digging into Minecraft modding for a while and have one big question that I can’t figure out on my own. Maybe someone with more experience could help or give me some advice. Here’s the issue: When I take a “normal” Minecraft mod — for example, one that just adds some blocks or new items — I can easily change its structure, package names, or even rebrand it entirely. It’s straightforward. But as soon as I try this with cheat-type mods like XrayMod or AntiXray, everything falls apart. Even if I just rename the classes, refactor the packages, or hide its identity somehow, the mod either breaks or stops working properly. XrayMod in particular is proving to be a nightmare to modify without losing its core function. So my question is — why is this so much harder with cheat mods like Xray? Is there something fundamentally different about how they’re coded, loaded, or protected that prevents simple renaming or restructuring? And if so, how can I actually learn to understand someone else’s cheat mod enough to safely refactor it without breaking the core features? I’ve already been spending over two months trying to figure this out and haven’t gotten anywhere. It feels like there must be some trick or knowledge I’m missing. Would really appreciate any thoughts, tips, or references — maybe there are guides or techniques for understanding cheat-mod internals? Or if you’ve successfully “disguised” a cheat mod like Xray before, I’d love to hear how you did it. Thanks in advance for any help or discussion. ✌️
    • just started making cinamatic contect check it out on my channel or check out my facebook page    Humbug City Minecraft Youtube https://www.youtube.com/watch?v=v2N6OveKwno https://www.facebook.com/profile.php?id=61575866982337  
    • Where did you get the schematic? Source/Link? And do use an own modpack or a pre-configured from curseforge? If yes, which one On a later time, I can make some tests on my own - but I need the schematic and the modpack name
  • Topics

×
×
  • Create New...

Important Information

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