Chickynoid, server authoritative character replacement

There are basic guns included, They are weapon mods, I believe if you download the default chickynoid placefile you spawn in with a sniper rifle, Press Q to fire, you can also give yourself a submachine gun.

Ah, ok I will check it out then, thanks!

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:
image

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:
image

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 :sweat_smile: So there’s even more networking efficiency in that as well. Hope this helps anyone!

8 Likes

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.

ChickynoidClient.localChickynoid.lastNetworkState
2 Likes

Lemme just say I appreciate you. Thankyou for giving solid help!

1 Like

You’re absolutely welcome! Been answering questions through my DMs as well :sweat_smile: 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 :slightly_smiling_face:

1 Like

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 :slightly_smiling_face:

3 Likes

thanks for the insights. surely it’ll come in handy.

1 Like

imagine if Chickynoids had pathfinding, it would revolutionize chickynoid society as a whole.

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.

2 Likes

yeah so turns out chickynoid already does the thing I wanted to do yet no one told me.

if anyone else wants characters to face the direction you are looking at paste this on the nicerhumanoid mod thing
image

1 Like

Hello,excuse me if my question is dumb but I don’t see any tutorial is there one as I want to use chickynoid for my npc

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

1 Like

Yeah I’m just lost because I don’t know what to make /how to make.

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.

You can add extra data to the simulation state with movetypes.

1 Like

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:

Use lastNetworkState instead as it is always updated on what the server sends to the client.

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.

1 Like

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)

1 Like