What is involved in making a mod single and multi player compatible?

Discussion in 'Bukkit Project and Community Feedback' started by Keybounce, Apr 12, 2012.

  1. Offline

    Keybounce

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    What is involved in making a single mode compatible for both single player and multiplayer?

    From what I understand, any server mod that introduces new blocks, items or entities has to have a client-side mod as well -- for the graphics if nothing else. For any user interactions / controlling. ETc.

    So what does it take to make that same mod compatible in single player?

    If my goal is to say, "I have a world that I sometimes play solo, and sometimes with a friend", and I want to play solo without the ... issues (cough boats cough animal pens cough) ... involved with multiplayer, then I want the mod to work in both cases.

    Most existing mods are only made for one or the other, and do not work on both. Even when they do, the server-side mod/plugin is different (Enchantview is the only such dual mod I know of).

    So how feasable in general is it to make a mod for both forms? Do I need to abandon the idea of playing solo to add in a new block mod?

    (Shelf; 9 to 1 storage for redstone etc.; water physics)
  2. Offline

    TheTrixsta

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    The server simply gets the resources of the game and puts them on the players client
  3. Offline

    Keybounce

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Well, it has to be more than that. Consider a mod that creates a new block -- if I have the single player mod, and try to craft it, the server DC's me. If it's a container, the server has to store the contained data.

    The behavior of boats indicates that some significant differences exist.
    The existence of some things checked and updated server side (example: powered minecart when a track goes outside of the visible range of any single client but with multiple people is entirely loaded on the server).
  4. Offline

    mushroomhostage

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Actually most SMP client/server mods are also compatible with SSP, all you need is the client component. In fact, testing in SSP is a common step for isolating bugs. You're right, the interaction is a lot more complex than the server doing everything and merely telling the client what to display.. but that's the direction Minecraft is moving in, for good reason. As of now, many calculations occur on the client either in addition to or instead of the server. When in multiplayer mode, the client handles it all, but when in multiplayer, it defers to the server (for some things).

    It is instructive to look at the source of a client/server mod to see the differences. The client is often littered with "if (!world.isRemote())" statements to avoid performing actions in multiplayer meant for single player. For example, opening a GUI or dropping an entity. If the checks are missing, the action would be performed twice in SMP (but work correctly in SSP).

    Much of the code is the same on the client and server, by the way. It's possible to factor most of it out cleanly. If you want to read through the code to learn about client/server mods and how they're written I suggest https://github.com/cpw/ironchest/tree/master/IronChests2
  5. Offline

    WMisiedjan

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Soon my friend, This will all be over.

    Minecraft's whole system is going to be based on the Multiplayer server. That means that you're normal single player world will soon have features like: Play with a friend. So a friend can join your world.

    You're single player worlds will basically be multiplayer worlds.

    What does that mean?
    That means that a new stash of plugins will be available soon. Minecraft is trying to close the bridge between single and mutli-player experience.

    This post has been edited 1 time. It was last edited by WMisiedjan May 30, 2012.
  6. Online

    ShootToMaim

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    ModLoaderMP. Duh. :D
  7. Offline

    ibab

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Still doesn't make the plugins multiplayer compatible if the plugin is not created to work in multiplayer.
  8. Online

    ShootToMaim

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I mean, that's one of the things that is needed.
    :3.
  9. Offline

    tips48

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Quite possibly not..If the mod is in the scope of Bukkit then it could easily be ported using Bukkit.

    Granted, most mods now days add stuff like custom items/blocks/entities, so...:p
    ShootToMaim likes this.

Share This Page