I'm quite fond of letting the player build stuff in byond games but to be honest it usually muddies the map and it looks horrible after a while due to the players. So I'm looking to implement a house system where players can build to their liking inside the houses while leaving the outside world clean in a sense. I can do this but I'm a novice coder so I'm sure the way I do it will be inefficient, so I'm looking for advice on how I should tackle this.
I was thinking just make one 1000x1000 map and make a bunch of identical houses. Seems tedious, I'd have to set up warpers for each house as well. Should I just make the outside of the house just one object if I were to go this route?
Or I could instance one house whenever needed. Seems like the best option. Is there a better way to go about this?
You can create a custom map by one of the following libraries then save/load the map:
http://www.byond.com/developer/LummoxJR/SwapMaps http://www.byond.com/developer/Forum_account/MapInstancing Make a template map on a Z layer and copy that default layout with one of those map libraries. Have a datum reference on the client (or its mob) referring to the new map location once loaded (load when the client tries to access their house; remove the map once the client logs off. In between, the client will have the Z location of their house set to a variable. Try not to save the player or any other /mob if they are inside the house - unless you want to for some reason - but do note their last location). Possibly even Export() the file if you plan to have multiple servers hosted? (Though you can always implement this later) If you plan to have furniture or other display items, it may be a good idea to have one general datum for these Display items and pass on the argument to create that item to its specifics. Reduces the number of different objects you have to manually program in. Ex: obj/Items |
You can then only load the house when they need access to it.
You would never want to make identical houses manually, you would best leave this work to a datum than handles each one in the same way - using the swap map to free up when not in use.