Posted September 23, 201213 yr Hi, I'm dAkshEN3. Some of you might recognise me from the BC forums. I created Advanced Power Systems and am currently in the process of updating it for the new MC and Forge. This also means I need to add multiplayer, which is where my problem arises: I have no idea how the packets and such work to make GUIs and TileEntities and things work in multiplayer. I'm not really looking for a tutorial or an example, I can handle the coding myself, I just need help understanding the theory and the process as I've never ventured into multiplayer game programming before. "The hypothesis of God gives an incomparably absolute opportunity to understand everything and know absolutely nothing. Give man an extremely simplified system of the world and explain every phenomenon away on the basis of that system." - Arkady/Boris Strugatsky Creator of Advanced Power Systems for BuildCraft
September 24, 201213 yr I would recommend looking at cpw's IronChests and CompactSolars mods as examples: https://github.com/cpw In essence though: GUI: You have a container on the server side, a GUI on the client side, they talk, plenty of examples in vanilla as to how, but usually it just works. TileEntities: You use the getDescriptionPacket call or whatever it was to send information to a TileEntity, you want to minimize the size and how often these occur, 'emulate' things on the client if possible, the lower network usage then the better.
September 24, 201213 yr Author Ok, is there any circumstance where a TileEntity would need to send packets to the server? "The hypothesis of God gives an incomparably absolute opportunity to understand everything and know absolutely nothing. Give man an extremely simplified system of the world and explain every phenomenon away on the basis of that system." - Arkady/Boris Strugatsky Creator of Advanced Power Systems for BuildCraft
September 24, 201213 yr Ok, is there any circumstance where a TileEntity would need to send packets to the server? yes when you edit something on the client per say a setting in a GUI you would need to tell the server that setting changed. For example TheCowGod's Locked doors and chest have player list to access. Every time someone add/remove a user to the block it send a packet to the server telling it to remove/add the player from its list as well. https://github.com/TheCowGod/GreaterSecurity <- your welcome to use this as an example for making packets for both client and server. http://i577.photobucket.com/albums/ss215/bobstrong/ModBannerMed.png[/img]
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.