Chickytools [Deprecated at the momment],A tool based inventory system for chickynoid!

I do have mesh collisions, yeah. But implementing terrain collisions is a very tricky problem, and MrChickenRocket’s solution of generating chunk-based terrain collisions with marching cubes on the fly is really clever and not something I would have gone out of my way to do.

When I implemented my server authority stuff, I put in a lot of pain to make sure you can’t create exploits by messing with deltatimes in the packets and whatnot. It turned out to be extremely frustrating to validate the claimed deltatimes by packets, you would need some sort of server-side clock to track passage of time and if a client is sending too many remotes with large deltatimes that exceed the server clock, you have to trim the deltatimes to ensure no time warp exploits. Because of latency and ping spikes, you need to have a decent amount of padding to this checker too, or face the risk of stuttery movements on a bad connection.

1 Like

I am sorry if I sound like a complete idiot while speaking since if I am honest I do not know extensively how does server authoritative movement works, But shouldn’t making fake data for the server to recieve have no effect?, I mean the server is the one who controls the simulation and the client just has a fake one that really doesnt matters if it is wrong since its constantly getting corrected?

I’m talking about the step or deltaTime or whatever you choose to call it, basically how much time has passed since the last frame of inputs. At 60fps, there is approximately 16.67 ms of deltaTime between frames, though this varies quite a bit since Roblox’s framerate limiter is not perfect. This is the one piece of information that is critical to ensuring the client and server simulations are in sync. The naive approach is to simply include the client deltaTime in each packet. But, doing so means the client can lie about deltaTime, for example doubling the time to effectively create 2x time warp.

If you try to fix this by keeping track of time only on the server, you run into the issue of packets arriving at inconsistent delay (thanks roblox, really love these ordered reliable packets), which means the server simulation will deviate from what the client saw if there is a ping spike for example.

1 Like

Still dont understand what you just said.

But hey its kinda confirmed that we will get UDP similar remotes that are not ordered or reliable so faster packets for everyone!

Unfortunately due to limitations of roblox itself its practically impossible to make a good OOP system with metatables.

My original workarround was this:

function CTool:__SetOwner(Player)
	if CTool.InventoryRecords[Player.UserId] then
		self.Owner = Player
		CTool.InventoryRecords[Player.UserId].Backpack[self.ID] = self
		-- Run exclusive code to the Local Player
		if Player == LocalPlayer then
			CTool.OnCToolOwnershipToLocalPlayer:Fire(self)
		end
	else
		error("Inventory not found")
	end
end
-- Sets a CTool's Owner to the given Player
function CTool:SetOwner(Player)
	local ClassMetatable = getmetatable(self)
	while ClassMetatable do
		if ClassMetatable and rawget(ClassMetatable, '__SetOwner') then
			ClassMetatable.__SetOwner(self, Player)
		end
		ClassMetatable = getmetatable(ClassMetatable)
	end
end

But even if I use this gross workarround theres another thing, if the conditions of one function are not met it will still run the next one after it meaning you have to add the checks of the previous function to the new one manually so pretty much theres no way to make this fast and pretty.

If only there was a way to add code into a function so it would run the original code and then the class’s code so I guess im going back to making custom functions for the classes that get called from the top function or using events that trigger the class’s functions.

I just dont think roblox is designed for custom OOP sometimes, anyways yeah hope you guys are not too annoyed that the next update is taken long but here’s the confirmed things for the next patch.

  • No more garbage data being sent to the server by errasing it from the command before sending it.
  • Getting rid of the garbage workarround for implementing OOP classes
  • Documentation for using the resource!
  • Moving code into a function or something called replicator which basically just handles some networking and basic behavior.

Update V1.2.0

Sorry this update took a month to make, I lost my motivation since I had come into a pretty hard to solve roadblock, but found out that OOP on roblox has its limitations mainly with functon inheritance so I resorted to using events, With all that said heres the update.

  • CTools now use FastSignals in order to attach code to the Equip and Unequip function and SetOwner,etc.
  • Backpacks now get cleared on death by deffault, and an event has been added (“OnBeforeBackpackClear”) in order to run any code before the backpack gets cleared.
  • You no longer need to clone the Enums module from the CTool placefile since they are now loaded via mods.
  • New network event has been added to the Enums list called “ClearBackpack” which sends a request to the client to clear their client sided backpack for replication purposes.
  • The deffault Input handler now supports Icons, via the CTool.Icon property
  • The placefile for the project now uses the newest chickynoid placefile.
  • InventoryRecords do no longer exist and instead the inventory is stored on a chickynoid playerRecord.

Report to me any bugs please as I always mess something up even when I test things as much as possible.

How do I make a tool with this? Don’t really get it

1 Like

Ok so the way it works is like this, Once you setup the mod, You basically use :GetMod() to access the mods contents on the “ClientInventory” mod, Then you will go to it’s Objects Table where all object classes get stored, In this case CTool

So you do

local ServerInventory = ServerMods:GetMod("servermods","ServerInventory")
local CTool = ServerInventory.Objects.CTool

Then once that’s done you can create a new CTool by doing

local NewCTool = CTool.new()

Then hook up a function to the Equipped Event so you can trigger something upon being equipped

NewCTool.Equipped:Connect(function(State)
		if State == true then
			
		else

		end
end)

Keep In mind the event returns true upon being Equipped, and false when unequipped

Once that’s done you can set it’s owner by doing

NewCTool:SetOwner(Player, Replicate)

I gave dev’s as much freedom so you can even choose to not replicate the Ownership to the player if you want to for whatever reason.

I still don’t get it, I copied these 2 module scripts and renamed them, which didn’t really add a new tool
image

I see the default CTool but there is no obvious/intuitive way to replicate the example you have, the boiler plate code you gave me don’t know where to put it either, my background with chickynoid is watching the seminar and having a surface level look over the code nothing much if that helps.

1 Like

I dont really understand your issue here, Be more specific.

Also do not rename the modules as I am sure that would break the system.

And make sure you also installed the Server and Client script from the mod’s place file since its forked to process custom commands.

Feel free to keep replying, I love replying to comments it makes my day.

1 Like

My issue is that I don’t know how to add a tool can you explain in detail?

EDIT: I assumed this worked like the normal way a roblox backpack works (because of the similarities) but it doesn’t, which is whats confusing me about this

1 Like

What do you exactly mean by adding a tool?

I mean its literally on the first reply
local NewCTool = CTool.new()

Be aware that this uses Object Orientated Programming.

Here is something I tried: I put this in a module script, in my mods

local module = {}
-- Services
local ReplicatedFirst = game:GetService("ReplicatedFirst")
-- Mods
local ServerMods = require(ReplicatedFirst.Packages.Chickynoid.Server.ServerMods)

local ServerInventory = ServerMods:GetMod("servermods","ServerInventory")
local CTool = ServerInventory.Objects.CTool


local NewCTool = CTool.new()

NewCTool.Equipped:Connect(function(State)
	if State == true then

	else

	end
end)

return module

Good now just do NewCTool:SetOwner(Player, Replicate), also do not put the code inside a module siince its not gonna run, you need to use a server script or put it inside a module’s function and then call it from somewhere else.

and it will appear on the player’s inventory.

However a better aproach is to create a new class using the classes folder and putting there a new module script with the functions a class would need, that way you can just call the class’s constructor function and make it automatically hook your functions to the tool upon being created

I left a WIP class in there called sword so you can take a look at how it works, again ask me any other questions.

Oh I see, thought the module scripts got ran automatically like in the knit framework

1 Like

i’m new to chickynoid, can you help me a little bit on how i can add a model to the tool or if you are going to make a function for that ?

1 Like

Ok I think I see where you are comming from, you dont understand how this works entirely, so I will explain it to you

theres the main modules which are directly chickynoid mods, Client and Server Inventory modules, These modules have a function called self:Setup(), this function will get called upon calling Chickynoid:Setup(), To make sure your mods get Setup you must register them first, refer to this example script for my game

local ServerStorage = game:GetService("ServerStorage")

local ServerScriptService = game:GetService("ServerScriptService")

local ReplicatedFirst = game:GetService("ReplicatedFirst")

local Packages = ReplicatedFirst.Packages

local Chickynoid = require(Packages.Chickynoid).ChickynoidServer

local ServerMods = require(Packages.Chickynoid.Server.ServerMods)

Chickynoid:RecreateCollisions(workspace:FindFirstChild("GameArea"))

ServerMods:RegisterMod("servermods", ServerScriptService.Examples.ServerMods.UseNicerHumanoid)

ServerMods:RegisterMods("characters", ReplicatedFirst.Examples.Characters)

--ServerMods:RegisterMod("servermods", ServerScriptService.Examples.ServerMods.Health)

ServerMods:RegisterMod("servermods", ServerScriptService.Examples.MyMods.TMG)

ServerMods:RegisterMod("servermods", ServerScriptService.Examples.MyMods.ServerInventory)

ServerMods:RegisterMod("servermods", ServerScriptService.Examples.MyMods.ServerCommands)

Chickynoid:Setup()

In the Setup function you put whatever code you want to run, in order for your mod to work properly, also you can assign mods a priority to choose which run first and so on.

Inside the mod there is a CTool module, this means theres an object class created, this module contains a setup function too which is called by the Setup function of the Inventory mod

Theres a constructor function for creating your CTools, then you can also hook up code to the events of a CTool.

If you wanna create a class use the sword class as a base and make sure to hook up any code for your class into the Equipped event so it makes your Ctool do something upon being equipped

Keep in mind theres both a client and server sided version of the module

Theres also more to cover such as processing commands, handling events and blah blah blah.

1 Like

I am not going to make a function for this since there’s thousands of different ways of attaching a model into a player’s hand.

However ill tell you a pretty good way of doing this yourself

You can use a motor6D to attach a model’s primary part into an arm, using an attachment to define the Motor6D’s position.

-- Welder script
local Rig = workspace.DevStuff.idk
local RightArm = Rig["Right Arm"]
local RightHandGrip = RightArm.RightHandAttachment

local Sledgehammer = Rig.Sledgehammer
local SledgehammerHandle = Sledgehammer.PrimaryPart

local Motor6D = Instance.new("Motor6D")
Motor6D.Parent = RightArm

print(RightHandGrip.CFrame)
print(Motor6D.C0)

Motor6D.C0 = RightHandGrip.CFrame

Motor6D.Part0 = RightArm
Motor6D.Part1 = SledgehammerHandle

image

Best part is that not only does it stays on the position of the hand, you can also animate it since its a Motor6D and not a weld!

Also make sure to do this on the client as characters are only seen on player’s clients and they do not exist on the server so you will manually have to replicate the effects.

Hey guys I have not released more features since I wanted to do a sword tool to include it with the resource so developers can see what this mod can do, but I couldn’t get it to work since recently I discovered that chickynoid cannot play 2 animations at once, so I worked all week with the help of @PixBlook I was able to make this cool fork that solves all of these issues:
Chickynoid “CharacterModel” fork for playing multiple animations at once! - Resources / Community Resources - DevForum | Roblox

Hey guys, Have not released an update for this resource in a while but after having a little talk with an user, I will work on writing some basic documentation for this resource so people can understand how it works quickly.

Also heres a cool game ive been working on that actually was the reason I even wrote this resource:
Untitled Network Test [Networking update soon!] - Roblox