Here's progress on the game
Here's some of my construct 3 tricks I use to make this work
launch the uh quad issue performance under tech demo in construct 3 and run it and compare it with this cdn.discordapp.com/attachments/312194372001202177/587028875696144427/quadisperf.c3p
the second one will run out of memory before it runs out of CPU
and have gazillions of objects
I discovered i could do this when i was getting a really high engine% on cpu usage in strawberrypunch and i started some optimisations like
i coded a render culling thing that would check where objects are in 3D space and see if the camera can see them and if not the delete all of the rendering and make the "object" containing the variables stop ticking engine stuff like quads and whatever
my first try was i made them stop moving
even though their 3D variables still ticked a lot
and then i was like
wait a minute
what if i just use some object that doesn't have stuff that the engine ticks on every frame
and empty arrays and binary data works great
bonus for empty array for being able to self reference data in the array
bonus for binary data to be able to self stuff that you want to serialize
keep in mind the "self" thing that'S gonna become really important
that'S like my shittyest trick so put your seat-belt on
uh
i could cite lots and lots of testing with this project
to test what kind of variables are referenced the fastest
or just tell you the gist of it
arrays are complete ass
6 times slower than for each
for each is very slow
self is pretty fast
global is fast
global static is the fastest
global constant ?
bleh
i always mix up those two words
that might not seem important yet
it will be in a minute
do you know how booleans work in the engine ?
They're like either 1 for true or 0 for false
but
they suck
because
you can't toggle them without picking
so they'Re garbage
you can make your own booleans with get bit set bit
get bit set bit is better than using a number
for reason we'll see later but
what's important is the 1 and 0 part
you can for example, in a single line of code, increase the falling speed if your velocity is over 0
by doing set falling speed to self.fallingspeed + gravity + self.fallingspeed > 0 * gravity
where self.fallingspeed > 0
will return either 0 or 1
so gravity will be double or not
you can get pretty complicated with that it's really useful
also
you can call functions without for each
by calling them with a return value
do you know that ?
like
in the event sheet
there is function call
to be able to call for each object without using a for each loop
you can create a function with a return value
and then call it in the expression system thingy
this might seem dumb
but it'S really really important
because you can use the function to change other expression inside the thingy
like in this collision detection code
where it calls a functions that alters self.vx that is used in the operation later on
so that if it collides with a wall while walking self.vx will be set to 0
and stop going forwards
but if you'Re hit
self.vx will be set to -self.vx
and you will bounce off the wall
and the function is not called at all if there is no collision detected
so saves overhead
this kind of reveals the biggest part
making code without picking
this is why you need to know the speed of references
it changes how you write it
where it can end the code prematurely and set it to self or 0
so it dosent have to call functions
and it dosen'T do picking
because picking is a huge overhead inside the engine
well
every time you pick it calls functions to the engine
for every instance
so when you have a shitton of them like i do it'S a big deal
so
I make those overly complicated expressions to set variables
using all of the operators to the max and the boolean comparator thing and calling functions while seting the value
but you have to balance engine overhead to "set a variable" with "expensive references"
like if in a calculation you need to divide the same value 20 times
it'S faster to add a variable
calculate it once with self and set it once
and then use it to call self once instead of multiple self to calculate the result multiple times
if that makes sense
oh also in that code snippet my collision detection is in a dictionary
and it creates unique keys using a X & "x" & Y & "y" & Z string
to see if that voxel is occupied
and it checks of 0 instead of checking for all of the other possible results
and the results are in the function for the type of collision
so i can add and remove collisions in 3D space at runtime in the level so that'S cool
doing it with a dictionary beats an array because most of the array is filled with empty space
and both of those beat an octree because it only need to check for one collision on each axis
whereas with the octree sometimes it would be 7 or 8
or much much much worse in the shadow's case it could do 50
ouch
because it needed to raycast down until it found something
also for rendering it's kinda complicated
it takes into account how many numbers you can cram inside construct 3 's 64 bit numbers
and how the data is networked
so positions are 16int or unit i dont remember
but can go up to 32000 ish
so 5 digits
and so it goes by first priority, what is the distance from the cell to the camera
then if it's the same cell, what's the Z value divided by the z side of the tiles
and then if also the same it goes by calculating the Y position
of the screen
isometrick-y
so it's a more refined way of doing it ?
and there will be two digits left
for a dot and a decimal
for zordering my sprites on
so that the clothes are over the skin and so on
all super fancy like
no picking because they're in a container
the set animation has getbit into it
so that it plays a different animation if the bit is true or false
without any new code to switch it
and the letters hold the data for the colors and the variants
and the animation name
so my whole game is super duper fancy like
with my own collision detection and physics and shit
kind of hacking my way around the picking
cool stuff
it uses the multiplayer plugin with binary data to do whatever the fuck i want
interest management and whatever people claim you can'T do
and the host can control all of the AI too so that'S cool
to sync like 400 objects it uses 30 kbps ?
it will probably increase later when i need to sync more data but that sounds realy good to me
so
here you go
that was big secrets
Support me on Patreon if you want more and/or help with those until someone takes all of this information and makes an actual tutorial you can use instead of me regurgitating it all at once