When New is called:
animate(src, pixel_x = pixel_x + vel_x*lifetime, pixel_y = pixel_y + vel_y*lifetime, time = lifetime*0.5)
When the projectile is updated:
pixel_x_float += vel_x
pixel_y_float += vel_y
var/current_loc_x = x + floor(pixel_x_float / TILE_SIZE)
var/current_loc_y = y + floor(pixel_y_float / TILE_SIZE)
if(last_loc_x != current_loc_x || last_loc_x != current_loc_y)
current_loc = locate(current_loc_x,current_loc_y,z)
var/turf/new_turf = current_loc
var/turf/old_turf = previous_loc
if(!previous_loc || !current_loc)
if(vel_y > 0)
else if(vel_y < 0)
if(vel_x > 0)
else if(vel_x < 0)
for(var/atom/A in new_turf.contents)
if(A == owner)
if(A.density || is_mob(A))
previous_loc = current_loc
The terrible "master controller"
set background = TRUE
active_subsystems = new(SS_ORDER_SIZE)
for(var/S in subtypesof(/datum/subsystem))
var/datum/subsystem/new_subsystem = new S
active_subsystems[new_subsystem.priority] = new_subsystem
for(var/datum/subsystem/S in active_subsystems)
if(!S.tick_rate || S.next_run <= ticks)
S.next_run = ticks + S.tick_rate
curtime += TICK_LAG
ticks += 1
So I attempted to make pixel-based projectiles but I'm having serious trouble getting them to work. They work perfectly on my end, however clients connected to my server cannot see the bullets for some reason.
The server's FPS is 60. The client's FPS is also 60.
When spawned, the following happens:
1. The icon itself is changed so that the bullet points in the direction it is traveling.
2. Animate is called. pixel_x is set to the x value of it's normalized velocity times it's lifetime in deciseconds, and pixel_y is set to the y value of it's normalized velocity times it's lifetime in deciseconds.
3. A Master Controller sends a signal to the bullet every tenth of a second to calculate it's collisons. The bullet's visible animation does not change during this.
Again, this works perfectly on my end however all clients cannot see the bullets most of the time. Usually they claim that the bullet appears several tiles in front of them, despite them having full visibility of where the bullet spawned and where the bullet. I can see other people's created bullets quite well as well.
So what is happening here? Connection issues? Bad code? Is there another method I should be using?