Snappit is a grid plot placement class that makes having a grid based plot placement system in your game literally so easy and straightforward!
It currently still a work in progress BUT it is almost done here is what it supports/upcoming features.
Grid
Configurable gridSize
Point Visualization
Collisions
Automatic Building Size to Grid Dimensions Size
Plots
Plot Claiming
Plot UnClaiming
Plot Removal
Plot Saving
Plot Loading
Plot Rotation Consistency
Placement
Enter Building Mode
Exit Building Mode
Place
Delete
Rotate
Lerp or Snap Movement (haha)
BoundingBoxVisual
HighlightVisual
Customization
validPlacementColors
invalidPlacementColors
Lerp smooth factor
Is there any requirement or knowledge needed?
Nope! I’ve made this module as easy and straight-foward as possible to setup, the only thing you’ll be setting up is your games building data which will have the information about your building pieces
Quick Code Snippets
Setting up global grid info (runs only once)
local buildingPieces = (<buildingPieces path>)
local buildingData = (<buildingData path>)
local Snappit = require(<snappit path>)
local setupInfo = {
plotSize = 64,
gridSize = 15,
buildingPieces = buildingPieces,
buildingData = buildingData,
key_1 = "Structure",
key_2 = "Occupied"
}
Snappit.init(setupInfo)
Setting up individual plot info
local Snappit = require(<snappit path>)
local part = workspace.Plot
local plotInfo = {
plot = part,
canVisualize = true,
}
local plot = Snappit.new(plotInfo)
Setting the plot's owner
plot:SetOwner(<player>)
(You call these from the client)
Entering Build Mode
local Snappit = require(<snappit path>)
Snappit.EnterBuildingMode()
Exit Building Mode
local Snappit = require(<snappit path>)
Snappit.ExitBuildingMode()
Rotate
local Snappit = require(<snappit path>)
Snappit.Rotate()
Change Building Piece
local Snappit = require(<snappit path>)
Snappit.ChangeBuildingPiece(<pieceName>)
Testing with different grid sizes
12x12
5x5
50x50
This will be very useful for me
This won’t be that useful for me
0voters
Snappit will probably be out soon but this was pretty much a preview of what it’ll offer, still in the proccess of being made
Also thank you liam (@LiamSternenstei1) for inspiring me to create Snappit
it looks so cool and easy, i hope you are having much fun programming it, and i have a suggestion that you could add idk how it really works and if its possible.
it would probably make it for developers using “Snappit” easier if theres a ez way to deactivate functions or restrict functions for non-devs
By that i mean a way that you can for example say that only devs are allowed to claim plots,
or that Plot Removal is Deactivated and all that
if you mean by Plot Removal what i think
but it already looks very good, keep up the good work!
Edit: also a good thing could maybe be that u can deactivate the placement bubbles, if i can call it like that, so the green dots on the plate, so again like a ez way to say that its on or off, and also maybe a ez way to add a decal on it, so that u can add without needing to programm anything just put in a id of a decal somewhere in the code and then it shows that decal on the floor, that would make it easier for people to change the grid-decal.
So plot removal is basically when a player leaves, the plot will be wiped of all the buildings on it and reset for the next player to be able to claim it!
Yes, actually your able to disable the grid points in the grid setup info!
And the dev-only plots is a great idea aswell as the decal; will for sure implement those after I get all the basics done!
Placement is finally finished and it works flawlessly, I’ve created a simple function in the class that you run to place your currently selected object!
local Snappit = require(<snappit path>)
Snappit.Place()
Features
Secure Placement (server calculates XY position client sent and reconsturcts cframe on it own)
Client Prediction (the client assumes the server will let it build, so there is instant feedback for the client when they build)
Collisions (the placement will detect if other buildings are being occupied by grid points)
Misc
There are two new parameters the grid setup info will take which are key_1 and key_2 basically these are what the dictionary keys will be named for a point on the grid you choose to build on, key_1 is for the XY point that is always closest to your mouse when you place and key_2 is for the other occupied XY points that werent the closest when you placed but still are occupied by the building structure (hopefullly that makes sense)
local setupInfo = {
plotSize = 64,
gridSize = 15,
buildingPieces = buildingPieces,
buildingData = buildingData,
key_1 = "Structure",
key_2 = "Occupied"
}
Snappit.init(setupInfo)
-- Example of a 1x2 structure (if it was placed)
local Grid = {}
Grid["1,1"]["Structure"] = {}
Grid["1,2"]["Occupied"] = true
YEAH PROBABLY HAHA, dude the class is actually almost done; just doing some minor improvements and im gonna release it soon on #resources:community-resources
IM SUPER EXCITED
i also even created the documentation last night you can have a quick peek
That word arbitrary threw me off, if I understand correctly you mean like if you place something let’s say at x = 1, y = 1 and the plot is rotated 90 on the Y, if you load onto a plot that is rotated 180, will it still be at where x = 1, y = 1, was relative to the plot?
Yes actually, it works with any Y rotation and keeps where you placed it relative to the grid point!
Maybe? I made a place to show it off a while ago. I also mean if you can rotate the plot by something like 30 degrees and you can still place stuff properly.
i got another idea
So basicly what you made should help people to easily have a placement system/plots in their game, however what if players want to make it so that u can upgrade ur plot with ingame cash or something?
it would maybe be a good idea, to make a way that devs can turn on and off the plot upgrading system (after u made one), just like the grid points, but that its all free or like that and that u then can put the price yourself and the stat u need or something like that, its of course just a idea, but it would be nice to have that too, i thank you very much for working on Snappit cuz it will help me, and probably alot of other players too, its always nice to see people like you who love to make things for free just so others can make what they want without much that they need to know!
Although, I’ve actually realized that rotating may need some addtional support if the grid isnt rotated exactly 0, 90 or 180 degrees though, when I was working on the rotation stuff I didnt think people would really need to rotated the grid by any degrees that wasnt 0, 90, 180
edit: LOL it actually supports both when the plot is rotated and when your rotating the building piece!
Yeah see upgrading plots is actually where it actually gets difficult because right now when you setup the global setup info you have to pass in a grid size and a plot size, and those are static and will be used for every plot in the game that gets initialized when you use the .new function, It would be super hard to implement but I dont think it would be impossible though.
Wait when you say upgrade the plot do you mean make the size of the plot able to be bigger or make it so that there is more grid points?
Yes, i mean it that the plot size gets bigger, so like that theres a giant space for example and then a small starter plot which new players get, and when players buy new plots then they can build on the terrain where before was nothing but before they dont buy it they cant build on it, just like in “Retail tycoon 2” or however it was called
Edit: which also gives me another idea, it might sound much that im requesting but pls always remember that you dont have to make it, but it of course makes me very happy to be able to easily just have it, and much other people too.
so like a floor that u can place basicly what u need is another folder (idk if it works like this but its a idea how it can work) and the folder will be called something like “Placeable Floors” u can place these objects/Floors too, but other objects can be placed ontop of these objects/floors
Yes I think I know what you mean yeah this could definitely be done but I’ll see what I can do when the basic features are finalized!
Oh yes I know what your talking about and basically you mean a layering system where there is basically multiple levels to the grid system!
Yeah pretty advanced but II’ll consider it depending on how many people find this class useful, I actually envisioned it being used for just simple stuff but sometimes you gotta adapt!