Sandbox Tycoon Grid Placement

Hiya! I’m glitchifyed and I’ve made this sandbox tycoon placement module for those who don’t want to modify Tunicus’ original placement module themselves.

This module works great for sandbox tycoons, which is a genre which originated from the hit tycoon game, Miner’s Haven! The Miner’s Haven open source has a placement module that behaves very similarly to this one.

Please be aware this is an updated version of Tunicus’ placement module that he made open source back in 2017. It has been ‘modernised’ with more features, such as:

Here are the modifications I have made to the module:

  • Objects with customisable adjustable heights (hydraulics)
  • Objects that can be placed on top of (platforms)
  • You can place on top of multiple of these platforms at once
  • Hydraulic items can have legs that automatically size themselves to stand on the ground
  • The grid texture now has an option to fade in/out and has a custom colour
  • There are customisable SelectionBoxes that will go on any item you’re currently placing and obstacles while you’re placing
  • A setting to hold the place button down to continue placing
  • An option to stop items from wobbling around when moving the mouse while placing
  • An option to hide CoreGui while placing
  • Easily customisable keybinds that also support Xbox controls

Settings:
// PLACEMENT SETTINGS

bool INTERPOLATION -- whether placement smoothing is enabled
bool WOBBLE_ITEMS -- whether items wobble when moving (does nothing if interpolation is false)
float INTERPOLATION_DAMP -- how fast smoothing is, make it a value [0, 1]
float ROTATION_SPEED -- rotation tween speed in seconds
float PLACEMENT_COOLDOWN -- how quickly the user can place (minimum time in seconds between placing items)
bool HOLD_TO_PLACE -- if the user can hold the place key to place

// PLACEMENT COLORS, TRANSPARENCY, FADING

Color3 COLLISION_COLOR3 -- color of the hitbox when object collides
float COLLISION_TRANSPARENCY -- transparency of the hitbox when object collides
Color3 NORMAL_COLOR3 -- color of the hitbox
float NORMAL_TRANSPARENCY -- transparency of the hitbox
Color3 LOAD_COLOR3 -- color of the hitbox when loading
float LOAD_TRANSPARENCY -- transparency of the hitbox when loading
float HIT_BOX_FADE_TIME -- primarypart/selection box fade time in seconds. set to 0 to instantly change/appear

// SELECTION BOXES

float SELECTION_BOX_TRANSPARENCY -- selection box transparency. set to 1 for no selection boxes
Color3 SELECTION_BOX_COLOR3 -- selection box color. set to nil for a custom color system (you have to code that yourself)
float SELECTION_BOX_PLACING_THICKNESS -- selection box thickness on objects the user is placing
float SELECTION_BOX_OBSTACLE_THICKNESS -- selection box thickness on obstacles

// GRID SETTINGS

string GRID_TEXTURE -- texture of the grid space, set to nil if you don't want a visible grid
Color3 GRID_COLOR3 -- color of the grid texture
float GRID_TRANSPARENCY -- the transparency of the grid while placing
float GRID_FADE_TIME -- the amount of seconds that the grid takes to fade. set to 0 to instantly appear
bool TEXTURE_ON_PLATFORMS = true -- if the grid texture is also put on platforms

// CONTROLS

bool OVERRIDE_CONTROLS -- whether the keybinds below work or not
int INPUT_PRIORITY -- input priority of default controls
list PLACE_KEYBINDS -- placement keybinds (pc, xbox)
list ROTATE_KEYBINDS -- rotate keybinds (pc, xbox)
list HYDRAULIC_UP_KEYBINDS -- hydraulic up keybinds (pc, xbox)
list HYDRAULIC_DOWN_KEYBINDS -- hydraulic down keybinds (pc, xbox)
list CANCEL_KEYBINDS -- cancel placement keybinds (pc, xbox)

// CORE GUI

list CORE_GUI_DISABLE -- core gui to disable when placing

License:
This module is under the MIT license which means you are allowed to freely use this for commericial and private use, modify it, and distribute it as you please.

Credits/attributions:
You don’t have to credit I or Tunicus, but credit would be greatly appreciated. We both put many many hours into this just to give it away to the community for free.
Also, here’s the link to the original module that I’ve modified: Placement Handler V2

Possibilities for the future:

  • Multiple hitboxes per object when placing
  • Wall/ceiling placement
  • Withdrawal/moving system
  • Inventory system
  • Shop system
  • Tutorial post on the forums going in depth on how to use the module
  • Video tutorial on how to use the module

You can add the module to your inventory here:
Roblox module (doesn’t have server-sided placement protection)

You may use this test place to see how the module works:
Github page (rbxl place file with server-sided placement protection)

Also, the module script itself doesn’t handle the actual placement of the models, only the placement preview of the models. I have however provided a .rbxl file in the Github that contains an example of server-sided placement code that does actually place the models down.

I have also made a module that allows you to calculate numbers past the limits of Roblox numbers. If you are interested, see this post on the Dev Forum here: UltiNum v1.0 Extended Number Module

July 2024 status update:
I have been at work creating the next iteration of this module. This new module is going to take some time, but it’s already at a great start! It’s going to feature improved platform placement, optimised collision detection, more settings, and even multi-hitbox placement!
Multi-hitbox placement will allow you to specify multiple hitboxes inside a single item, which can prove incredibly useful!

Disclaimer: This new module is going to be a lot more difficult to use in a project, due to the very nature of how I’m writing it. It is not made to handhold people, but rather it’s going to be more for power-users who want to customise the placement visuals and such withouit having to directly modify the module. This includes the hitbox visuals, leaving displaying collisions between items entirely up to the developer!
The new module will still continue to pivot the models during placement and smooth them, with all-new smoothing types such as elasticity!
I will personally make sure it is as accessible as possible, so much so that I am planning on providing even VR devices a great experience.

24 Likes

This is great, thank you for sharing.

Do you have plans to add more features in the future?
Like for example being able to place objects on other surfaces like walls and ceilings and being able to select and move/delete already placed objects?

I’m mostly wondering because this seems to be a good module to start with and if you have those features planned already then it would be superfluous for me to also try and implement then.
Thanks!

1 Like

I have considered this, but I primarily made this modifcation for sandbox tycoons and tried to stay within the scope set by Tunicus when he originally made the module. I may add more features to the module over time, however I do have to revise for exams at the moment so new features may not come out for a while.

A feature I have been thinking about is allowing items to have multiple hitboxes, although it would be quite difficult to do, since I’d have to rewrite a lot of the platform code on the client and on the server (the server code is on github).

I do want to add features that the community wants as long as they won’t take me too long. I primarily made this because there aren’t many alternatives out there, and as far as I know, this is the only open source placement system that allows the user to place on multiple platforms.

I’ve always wanted a more recent version of this module but I noticed nobody had seemed to make anything public so I thought I may as well do it myself.

I also have a module for an extended number system that I’ve been thinking of making open source. I would like to know if people are interested in that one.

Moving and deleting an already placed object is very easy and that’s more on the sandbox tycoon stuff rather than the placement module itself. They are both really simple to accomplish: deleting/withdrawing is just destroying the object and possibly adding it to an inventory, moving is just deleting/withdrawing and then initiating placement.

Thanks for the feedback. I’ll be sure to consider it in the future.

1 Like

Older edits aside, the issues previously documented in this post have been resolved! If you experience any more bugs, please message me on the DevForum. I should get back to you within at least a week or so.

1 Like

Any updates on this? Would love to see an option to disable platforms and hydraulics

1 Like

Oh, it’s going to take a loooong time. I’m working on making it the best module it possibly can be, which involves first making an entire game just to make sure it works flawlessly.

Understandable. Is there an easy way to disable hydraulics/platforms? This version has a lot of nice features the original doesn’t have but I’m not interested in hydraulics/platforms and I’m not sure how to easily remove it.

You may be able to get away with just not using the features at all, but I don’t quite remember.

Yeah that was my thought as well, just want to be sure exploiters can’t mess with anything and re-enable it somehow

If you just take a look at the code on the server example code provided you should just be able to hard code placement heights to 0 or just remove them from the remote event entirely.

1 Like

It seems like the placement interpolation and wobbling is affected by FPS (and with the new FPS settings it’s easy to notice), how would one go about fixing that so any FPS has the same visuals.

I attempted to fix it myself with delta in render() but it only made things worse

Oh, yes! That’s a side-effect of the tunicus system that I hadn’t thought about at the time of writing the module. The new module is not affected by the FPS. I may go through and fix up the delta time issue if necessary at some point in this module too.

1 Like