Skip to content

Instantly share code, notes, and snippets.

Avatar

Jummit Jummit

View GitHub Profile
@Jummit
Jummit / local_networking.gd
Last active Feb 13, 2021
server and client on the same machine using custom_multiplayer
View local_networking.gd
extends Node
# this script is attached to the main scene
var server_api := MultiplayerAPI.new()
var client_api := MultiplayerAPI.new()
# The actual main scene of the game. It is instanced in the script.
export var game_scene : PackedScene
@Jummit
Jummit / project_structure.md
Last active Nov 28, 2020
Godot Project Structure Guideline
View project_structure.md
@Jummit
Jummit / mesh_join_duplicates.gd
Created Nov 3, 2020
Join duplicate vertices of a mesh in Godot
View mesh_join_duplicates.gd
static func _join_duplicates(mesh : Mesh) -> Dictionary:
var data_tool := MeshDataTool.new()
if not data_tool.create_from_surface(_deindex(mesh), 0) == OK:
return {}
var old_vertex_ids := {}
var ordered_vertices := []
for vertex_id in data_tool.get_vertex_count():
var vertex := data_tool.get_vertex(vertex_id)
old_vertex_ids[vertex] = vertex_id
@Jummit
Jummit / server_list.gd
Created Sep 12, 2020
Using custom multiplayer to connect to a dedicated server and register a hosted server
View server_list.gd
extends Node
# registered as an autload on both
# the dedicated server and on the player
var MY_IP
var MY_PORT
var is_player
const DEDICATED_SERVER_PORT = 1234