#Calculating amount of bytes data is prior to using :Fire(...) with Packet.

1 messages ยท Page 1 of 1 (latest)

gilded grail
#

I'm simply curious on if there is any means to calculating how many bytes would be the result of data prior to invoking :Fire(...) to be capable of splitting my data across multiple :Fire(...) invokes effectively.

This is mainly down to batching together what would be individual server requests for a placement system to fire all at once when the binding for the "object place" is no longer held for improved network performance over using :Fire(...) every frame while the binding for the "object place" is held.

As a result; the short question here would be: How do I calculate the BufferSize for data before invoking :Fire(...) on the client?

#

Calculating amount of bytes data is prior to using :Fire(...) with Packet.

plush skiff
#

you can get the packet profiler to measure

#

the final value will be dependant on raknet and roblox buffer compression

gilded grail
#

Aha, I see, that's good to know ๐Ÿ‘

#

I'm curious how this would be used with a dynamic set of data since inherently the nature of a placement system (at least within my game) you can either place a singular item at once or multiple items that you have selected and "moved" meaning it can range heavily.

Alongside this all these come into account with the "batching together" system I mentioned above to improve networking performance which further adds more of a dynamic nature.

As for the format of what is sent to the server via. packet; here's that format if that could possibly help get some sense of direction in where I should move forward with my goal ๐Ÿ™

plush skiff
#

exists

gilded grail
#

Afterall, being able to determine the byte size of the buffer before firing :Fire() with packet to split across multiple :Fire() invokes would significantly help the stability and prevent players from placing so many items at once where the server blocks it due to the 8,000 byte limit

plush skiff
#

it literally does what we are talking rn

gilded grail
plush skiff
#

then

gilded grail
#

Are you aware of a game called "Miners Haven"?

#

A sandbox tycoon game, my game is that same genre with a very similar placement system.

plush skiff
#

you should not need networking for that

#

only syncing

gilded grail
#

How would the client send to the server that objects are being placed?

plush skiff
#

you could make a deterministic factory code that runs both on server and client

#

just like the tower defense game suphi made

#

(not saying use that code)

#

sending data for every object that is produced by a machine will most likely cap your game for network limits

gilded grail
#

Aha, I see; I'll have to look into that instead then, thankfully I'm early into a rewrite for my games codebase so it shouldn't be too big of a hassle to convert over ๐Ÿ™ƒ

plush skiff
#

these guys have mastered this genre

#

they use a snapshot system

#

with deterministic game loop

#

late joined players will get the snapshot and continue execution actions

gilded grail
#

Factorio is smthn I've had in the back of my head for the last 7 years of me developing this game; I've never thought to look into if they've wrote anything regarding how they operate internally

plush skiff
gilded grail
#

"7 years"

#

Started in 2018, hiatus from mid-2018 to mid-2020

#

Paid ALPHA in October 2020

#

It's been held down due to me building on my 2018 codebase with multiple rewrite attempts which ended up flawed over the years, the game currently isn't to the standard of such a long development time as much as I hate to admit ๐Ÿ’”

#

But tbf in 2018 I was 11 years old, that might have a hand in it

plush skiff
#

making a factorio game that is incredibly optimized is a huge skill

#

obv

#

are you sending data for every spawned object in the game?

gilded grail
#

The last 3 months have been heavily focused on research and a proper rewrite that I want out to the live game alongside some feature overhauls but yeah

plush skiff
#

what I told you is the way

#

make a tick system

#

have a delay for each placement so every client can replicate it in time

#

if they can't send a full game state snapshot

#

and let them continue on the next tick

gilded grail
plush skiff
#

a machine should know when to spit an item

#

also wdym mouse target

gilded grail
# plush skiff make a tick system

I've been using a tick system in the live game for about 2 years now exclusively for placed item functionality, I never expanded it everywhere due to the spaghetti code that is the game currently ๐Ÿ’”

I'll certainly take the knowledge shared from here today and move forward for a far more stable infrastructure for the future ๐Ÿ’ฏ

gilded grail
plush skiff
gilded grail
#

Plane being the grid plane that items can be placed upon

plush skiff
#

of some sort

plush skiff
#

there is a way to do it without buildtime but it's far more complex

gilded grail
plush skiff
#

I've written one for my tower defense game

#

but it was shit ton of pain

gilded grail
#

That's why I mention "Miners Haven" as that's the closest and most popular example I can give regarding this system ๐Ÿ™

plush skiff
#

don't know how scalable their game is

gilded grail
#

The miners haven open source is one that no one should learn from, I know that very well ๐Ÿ˜…

#

Afterall they've been working on a update for the last 4 years that rewrites the entire game, that of which at one point was a candidate to join the team on earlier this year; unfortunately didn't make the cut but it is what it is ๐Ÿ™ƒ

plush skiff
#

I wanna take a look

gilded grail
#

Considering it's fundamentally built on a mix of code throughout the years of 2015 - 2018 mostly

plush skiff
#

link would be appreciated

gilded grail
#

The 2019 changes being 4 new items, nothing changed to the actual fundamental code

#

There's that, just thought for the disclamer before providing the link ๐Ÿ‘

plush skiff
#

holy shit

#

I feel like hopes and dreams holds this game together

#

Ive never seen this done this way

#

holy

gilded grail
#

Haha!

#

I unfortunately spent so much time with that in 2020 developing Miners Haven mods; I understand it inside and out ๐Ÿ’”

#

9/10 torture experience, I don't recommend

plush skiff
#

this game is cooked 11/10

#

rewriting would be faster

gilded grail
#

The 2015 - 2018 shows for it ๐Ÿ™ƒ

#

Thankfully, my game does not use this at all

#

Cause this open source released in late-ish 2019 where as my initial first developments was 2018

plush skiff
#

yeah this game is so far from scalable

#

probably what you wrote is better

gilded grail
#

For sure, I'll need to redesign what I've done so far anyways for the approach you've mentioned here; especially since I do intend to scale this game quite large with more than just the core item types (Mines, Furnaces and Upgraders) that Miners Haven and other games like tend to have

plush skiff
#

just warning you

#

no physics + bulk move + deterministic approach will make you the best factorio game on roblox

#

you could have hundreds of factories like that

gilded grail
#

I assume you refer to that for ores within the game?

plush skiff
#

even jumps don't need physics

gilded grail
#

Aha, great to know; some custom solution regarding how ores behave will be used, it's been on my mind and I attempted it a few months back but didn't get too far with that ๐Ÿ™

plush skiff
#

just use math or precalculate the route and move them to there

#

this is not going to be easy

#

just letting you know

#

I would honestly build on what you have if you want to release asap

#

saying this cuz you want to rewrite

gilded grail
#

I don't expect it to be, I'm happy to further this discussion within DMs if you'd like cause afterall this discussion has been far more insightful than other devs of the same genre have given

plush skiff
plush skiff
#

I'm honestly just telling you the best way I know

#

I learned this from factorio blog

#

how their systems worked

gilded grail
#

I'd rather not call it a day, I want something far greater than "it works" as that has genuinely been the biggest slip up I've made with the live games codebase pre-rewrite

gilded grail
plush skiff
#

I used to be just game dev not roblox dev

gilded grail
#

As unfortunate as it is, that's how it comes across

plush skiff
#

true

#

people need to research and inspire from other professional games

#

instead of doing what comes to their mind first

gilded grail
#

Roblox dev is just smthn I do in my freetime, these days I am in the process of a game design college course (and will move onto game development course next year from September hopefully)

gilded grail
#

I don't intend to stay to Roblox forever unless huge opportunities arise

plush skiff
#

it is important to understand going out of roblox is higher risk higher reward

gilded grail
# plush skiff people need to research and inspire from other professional games

Absolutely, that's one thing that's given me an upper hand over the other Sandbox Tycoon games thankfully with the few things I've done right for UME (the acronym for my game, Universal Miners Eternity) such as an implementation for items to use more than just 1 part for "hitboxes" which are used for placement collision and item selection systems in these sorts of games

gilded grail
gilded grail
plush skiff
gilded grail
#

I just done it cause it makes more unique item shapes possible without hitboxes taking too much space or leaving intersectable parts of item models entirely (e.g. U shaped hitboxes)

plush skiff
steady tendon
#
plush skiff
#

this was not what they needed

steady tendon
#

yea i didnt bother reading much