For anyone using Chickynoid and is utilizing it for NPCs, I figured I’d share a small snippet of advice that made network/bandwidth efficiency better for me by another 73%
Simple, and yet a monumental difference. Making use of the default var waitTime and yielding their thinking to be slower:
By default bots have their thinking speed equivalent to that of a connected player. Didn’t think much of it until I figured that NPCs/bots don’t need to have their thinking to be on par with players. So placing a yield before running any of the bots thinking is very much recommended. Depends on your game’s combat fluidity of course, but 0.05-0.10 in most cases should suffice. Even with the slower thinking, they still target, path, feint, parry, dodge, etc. just the same as before.
The results on a live server with 113 spawned NPCs spread throughout the map:
While typing this, it just dawned to me that you could have them sleep and not use any thinking power until another enemy npc/player walks into their node area So there’s even more networking efficiency in that as well. Hope this helps anyone!
I guess this method would only work if you update health state directly on the simulation right? if you do it with the SetStateValue it will only update it for the server, or is that suppossed to work too? since it ain’t working for me
Anything updated within the state on the server is automatically synced with the client. I’d have to ask how you’re trying to retrieve the state on the client? If you’re wanting the player to get their own state value changes, you want to make use of lastNetworkState. This can be grabbed from the localChickynoid of the ChickynoidClient.
You’re absolutely welcome! Been answering questions through my DMs as well I don’t mind giving assistance when I have the free time to do so. Plus, I see it as giving back my appreciation for the work you’ve put into Chickynoid
A popular question I’ve been receiving is how to make bots move to locations, so I’ll quickly address it so others have the knowledge.
Within your BotThink, you want to ensure the server is kept up-to-date and the npc’s commands are being handled. You want to do this after your bot is done doing it’s routine processing.
This is what your event should look like, again at the very end of your BotThink function:
--[[routine BotThink functionality above. this includes your waypoint handler,
which should be storing the computed pathing inside the npc's simulation state record
via state.Waypoints and updating state.CurrentWaypoint for what the current waypoint
they're on is]]
local simulation = npcRecord.chickynoid.simulation
local state = simulation.state
local event = {}
event.t = Enums.EventType.Command
event.command = {}
event.command.l = npcRecord.frame
event.command.x = 0
event.command.y = 0
event.command.z = 0
event.command.serverTime = tick()
event.command.deltaTime = deltaTime
if (npcRecord.chickynoid) then
npcRecord.chickynoid:HandleEvent(ServerChickynoid, event)
end
if state.Waypoints[state.CurrentWaypoint] then
local waypointDirection = CFrame.lookAt(state.pos, state.Waypoints[state.CurrentWaypoint].Position) -- we need a direction vector, so let's convert our vectors into CFrame's and use lookAt
local goalPosition = state.Waypoints[state.CurrentWaypoint].Position-waypointDirection.Position -- we now need the X/Z axis of the goal so we can determine what keys(AKA, the X/Z commands of the bot) to fire
if (state.pos-state.Waypoints[state.CurrentWaypoint].Position).Magnitude > 3 then
npcRecord.waitTime = 0.01 -- they're currently pathing, so let's increase their processing speeds. anything less is unnecessary and anything more creates choppiness
event.command.x = goalPosition.X -- force a X/Z command on the bot. this is the exact functionality as if a player were to press their keys to move towards a desired position
event.command.z = goalPosition.Z
end
end
Hope this is of help to anyone else questioning on how to make a bot move
You don’t have to imagine? That’s what the snippet is for. It’s what I use for pathfinding on my Chickynoids. You just have to create a simple waypoint handler that stores the computed path inside of the Chickynoid’s state and progresses their CurrentWaypoint. Can be set up in a few minutes if you gloss over the wiki for ComputeAsync.
He said he’s slowly working on a proper documentations. If you want to use it right now you have to read the code from an uncopylocked place. And also it’s not really easy to use it
Anyone know an easy way to keep character values synced between client and server?
I know weapons already do this in their state table, but storing the stamina of a player inside a weapon seems rather inefficient and hacky. I could totally work with that, but I just want to see if there’s a better way.
So I wrote some test code to see how a value would replicate to the client, It basically just puts the hitpoints value and places it on simulation, just to test how it works. But sometimes it seems to take literally 10 seconds for it to replicate to the client, Also outside studio it doesnt even replicate at all, I have no idea why this happens.
Also yes I am aware putting this code on a movetype is prob not the appropiate way of doing it, and stuff put inside movetypes should also be simulated by the client
This was previously answer already in an above post:
It looks “delayed” because resimulation is being skipped, when resimulation is skipped then simulation.state is not updated. You’ll notice it updates as you move a certain distance. Why? Because of the following resimulation criteria(located in Chickynoid>Client>ClientChickynoid:
Rather than peering over the examples Chickynoid offers, it’s advised to study and understand the core functionality first. Figure out what each function does and why it does it.
Thanks for the info, Also as much as I would like to learn everything about chickynoid that is impossible for me, I would prob go insane if I tried learning it just from reading the source code (im bad at understanding code)
I just wanna say that chickynoid is one of the best resources I have ever seen on the devforum, I’ve been using it for 10 months now and it has changed the way I make games.
It solves so many hassles like making players unable to move, a simple thing like this is very hard to accomplish on Roblox smoothly because setting a player’s WalkSpeed to 0 relies on the client receiving that signal in time and not moving, and also, they can just exploit and keep moving, anchoring them can lead them to just hanging on the air. And on chickynoid doing this is so easy.
Chickynoid also is well made and has lots of events and stuff in mind planned for developers to be able to build on top of chickynoid without forking the code too much, such as its MoveTypes, Mods and GenerateCommand modules and more. I was literally able to add running in 5 mins by just putting this into the MoveTypeWalk ActiveThink script
Chickynoid has some godlike networking handling, I’ve joined a lot of games and they use so much power and bandwidth, meanwhile chickynoid literally does more stuff on the server yet runs faster. The serialization tactics use to minimize bandwidth are well taught off.
Also, chickynoid forced me into learning what a state machine is, which has solved my 70% of my problems as I can now just set a player’s state from anywhere bc it automatically syncs to client, and also handle rollbacks with no problems with state machines.
Thank you, Chicken man person, for making this resource just because your kid was flying by holding the x button in his client, this is the best thing ever.