Skip to content

Instantly share code, notes, and snippets.

View yoloroy's full-sized avatar

yoloroy

View GitHub Profile
@lavish10
lavish10 / workflows.yml
Created May 8, 2020 07:07
Github Actions workflow for Gradle build and deploy
# This workflow will build a Java project with Gradle and deploy it on server
# deploy.sh will take the given parameters and perform the necessary operations, deploy.sh runs `docker-compose pull` and `docker-compose up -d`
name: Java CI with Gradle
on:
push:
branches: [ master ]
def full_copy(l):
return [full_copy(i) if type(i) is list else i for i in list(l)]
if __name__ == '__main__':
t1 = [1, [2], [[3]]]
t2 = full_copy(t1)
t2[1].append(0)
t1[2][0].append(5)
print(t1, t2, sep='\n')
@qingwei91
qingwei91 / multiplayer-game-networking1.md
Last active May 21, 2025 17:31
How does Multiplayer Game sync their state? Part-1

The problem in multiplayer game

In multiplayer game, one of the most complex issue is to keep all player's state in sync with server state. There are a few good articles around this topic on the internet. However, some details are missing here and there, which may be confusing for beginners in field of game programming, I hope I can clear things up in this article.

I'll present a few techniques commonly used in this problem space.

Before we jump into the problem, let's have an overview on how multiplayer game generally works.

Typically, a game program needs to simulate

@ProGM
ProGM / DraggablePoint.cs
Last active September 8, 2025 14:27
A Unity Editor extension to generate draggable points for vector3 serialized attributes.
using System;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class DraggablePoint : PropertyAttribute {}
#if UNITY_EDITOR
@alphamu
alphamu / Android - DIP to PX or PX to DIP
Last active February 24, 2020 16:32
Android - DIP to PX or PX to DIP
public static int dpToPx(Context context, int dp) {
Resources r = context.getResources();
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics());
return (int) px;
}
public static int pxToDp(Context context, int px) {
final float scale = context.getResources().getDisplayMetrics().density;
int dp = (int) (px * scale + 0.5f);
return dp;