Git Product home page Git Product logo

godotaddonpack's Introduction

Kehom's Godot Addon Pack

This repository contains not only a collection of Godot addons, it's also a demo project using those "plugins". All of them are pure GDScript, yet there is a C++ module version of this pack that can be found here.

The addons in this pack require Godot v3.2+ to work.

Regarding Godot 4: I'm currently porting the relevant addons as a GDExtension. However that system still needs some polishing, which might delay an initial release of the extension.

The following addons are part of this pack:

  • DebugHelpers: Some scripts to aid with testing/debugging.
  • General: Contains a few "general use" scripts.
  • Network: Automates most of the networked multiplayer synchronization process, through snapshots. The addon sort of "forces" the creation of an authoritative server system.
  • Nodes: Some Godot scenes with attached scripts that are meant to be used by attaching instances within other scenes.
  • Smooth: Largely based on Lawnjelly's Smoothing Addon, automates interpolation calculation of child nodes.
  • UI: Custom user interface Control nodes.
  • Database: An in game database system based on Godot Resource. It contains an editor plugin for easier editing of the data.
  • DataAsset: A resource meant to hold data. A plugin editor is provided to help edit the properties, including support for custom scripted resources and some more advanced array editing.

Installation

Normally speaking, installing an addon into a Godot project consists of copying the addon directory into the project's "addons" subdirectory. As an example, suppose you have a project under the mygame directory and want to install the Network addon. The process here would be to just copy the contents of the network directory (from this repository) into the mygame/addons/network.

Some addons here may have internal dependencies, like the Network addon. In this specific case, it requires the encdecbuffer.gd, which is inside the general/data directory (in this repository).

Finally, on some cases it may be necessary to activate the addon from the project settings (Plugins tab). Such is the case for the Network addon. Bellow is an slightly more detailed list of what is provided and on each case there will be enough information related to what must be copied in order to be used as well as the activation requirement or not.

Some addons might add a few additional settings into the ProjectSettings window. In that case a new category (Keh Addons) is added and, under it, an entry for the addon, containing its settings.

Tutorial

On my web page kehomsforge.com there is a set of tutorials for each of the addons in this pack. Each page corresponds to one addon and contains two major sections, one explaining the basics of using the addon while the other explains a little bit of how the addon internally works.

The Addons

Bellow is a slightly more detailed list of the addons, including information regarding if the addon (or "sub-addon") has interdependency, needs activation and if it adds additional settings.

Debug Helpers

Needs Activation
yes*

This addon is meant to bring a few additional tools to help debug projects.

* Activating this plugin only adds the scripts into the auto-load list (with default name OverlayDebugInfo and DebugLine3D). Alternatively you can manually add the desired script(s) to your auto-load list, meaning that you can set your preferred name to access the functionality.

overlayinfo.gd

Interdependency Extra Settings
none no

I find myself constantly creating temporary UI controls (Label) to dump text into screen (specially when trying to debug networked values), which becomes rather tedious after some time. This script offers means to quickly add text into the screen, including timed labels that will be removed after a specified amount of seconds.

line3d.gd

Interdependency Extra Settings
none no

This little script is meant to make things easier to draw lines in 3D. Using the default add_line() function will draw a line that will last for a single frame. There is the option to add lines that will last for the specified amount of seconds (add_timed_line()).

General

As mentioned this addon is meant to contain some "general use" scripts.

data/encdecbuffer.gd

Interdependency Needs Activation Extra Settings
none no no

Implements a class (EncDecBuffer) that wraps a PoolByteArray and provides means to add or extract data into the wrapped array. One of the features is that it allows "short integers" (8 or 16 bits) to be encoded/decoded. The main reason for this buffer to exist is to strip out variant headers (4 bytes per property) from the encoded data, mostly for packing properties to be sent through networks. Although this can be useful for other things, like binary save files.

data/quantize.gd

Interdependency Needs Activation Extra Settings
none no no

Provides means to quantize floating point numbers as well as compress rotation quaternions using the smallest three method. The entire functionality is provided through static functions, meaning that it's not necessary to create instances of the class (Quantize). Although the returned quantized data are still using the full GDScript variant data, the resulting integers can be packed into others through bit masking. Also, this data can be directly used with the encdecbuffer.gd script, meaning the two complement each other rather well.

Network

Interdependency Needs Activation Extra Settings
data/encdecbuffer.gd, data/quantize.gd* yes yes

This addon was born in order to help create authoritative servers that send replication data to clients through snapshots and events. Most of the process is automated and the internal design is meant to be as "less intrusive as possible". The idea is to not completely change node hierarchy and have minimal impact on game logic code.

* The data/quantize.gd will be required if analog input quantization is enabled within the project settings window.

I now have a tutorial on how to create dedicated servers, which does use this addon to perform synchronization.

Nodes

The contents of this addon are meant to be Godot scenes with attached scripts that are meant to be used by simply creating an instance of the scene wherever desired.

Cam3d

Interdependency Needs Activation Extra Settings
none no no

Wraps the Camera (3D) node to facilitate with certain tasks. Features:

  • Follows the parent node from a configurable distance.
  • Orientation axes can be individually locked/unlocked. A locked axis can still be (manually) changed, it only prevents the parent (automatically) affecting the camera.
  • Shaking using simplex noise in order to "improve the feeling". The shake behavior can be configured (translation, orientation and so on).
  • The movement can be smoothed and it also can contain lag.
  • "Collision detection". There are some options to try to change the behavior if some object is in between the camera and the parent node.

Smooth

Interdependency Needs Activation Extra Settings
none yes no

As mentioned, this addon is largely based on Lawnjelly's work. The addon in this pack is meant to automatically interpolate the transform of the parent node, rather than provide a property to indicate the target object.

UI

Interdependency may vary according to the implemented control (to that end each control will have this information bellow).\

Needs Activation
yes

The idea here is to provide custom user interface controls in order to increase the offer given by Godot. Activating this addon will make all of the installed controls available for use.

CustomControlBase

Interdependency Extra Settings
none no

This is a base class meant to serve as a starting point for custom Controls implemented with pure GDScript. The idea of this class is to deal with the theme system in a way that will allow easier overriding of style options from the Inspector, much like any other core Control.

FancyLineEdit

Interdependency Extra Settings
none no

Implements most of the functionality of the LineEditControl but provides means to "register" rules that will affect how the entered text is rendered. As an example, ":)" can be set to render an image rather than the two characters. Images will be automatically scaled in order to fit the input box, based on the font height. The main idea of this control is to be used as input for consoles and/or chat boxes.

Inventory

Attention: If you already use this plugin before this commit (10b9c0080937037abc9ad4537ac26aaa0be4937d), updating will result in a one time script error, when loading the project, telling that the InventorySlot identifier isn't valid. Don't worry because the compatibility was not broken and everything will work correctly and further project loads will not result in this error.

Interdependency Extra Settings
none yes

Two new Control widgets, InventoryBag and InventorySpecialSlots are used to allow the creation of several styles of inventories. Some of the features:

  • Bags automatically handle multiple slots and items. The amount of columns and rows can be specified from the Inspector.
  • Items can span across multiple rows and columns.
  • Special slots can be linked in order to easily manage "two handed weapons".
  • Special slots use internal filters to automatically allow or deny specified items.
  • A completely custom drag & drop system in order to allow for a finer control over when and how to start/end the process.
  • Items can have sockets.
  • Items on a bag can be automatically sorted.
  • Saving/loading inventory state into/from JSON data (binary support is in the TODO).
  • Inventory bag can be expanded or shrinked without affecting item placement.
  • Special slots can override maximum stack sizes to create specialized storing systems.

TabularBox

Interdependency Extra Settings
CustomControlBase no

This Control brings tabular data viewing and editing capabilities. To increase its flexibility, it relies on Data Sources, which are resources implemented by users in order to provide the data to be rendered. When editing, the widget will directly interact with the assigned data source. This means that the actual data storage is entirely up to the project needs. A relatively simple data source is provided out of the box.

There are also column types that allow advanced means to show/edit the data within the TabularBox control. Creating custom ones is relatively simple.

ExpandablePanel

Interdependency Extra Settings
CustomControlBase no

Add a panel that can expand or shrink in order to reveal/hide its contents. Each child node becomes a "page" allowing the expanding/shrinking to deal with multiple different types of contents. Expanding and/or shrinking can be animated and even have curve resources affecting the behavior of the animation.

Each page gets a "button" to toggle its content. The associated icon used within that button can be configured for each available page within the expandable panel.

SpinSlider

Interdependency Extra Settings
CustomControlBase no

Implements a control similar to SpinBox but if a well defined value range is defined then the spin buttons will be hidden while a slider will be shown.

Database

Interdependency Needs Activation Extra Settings
UI/TabularBox yes no

This addon uses Godot Resource to implement a database system. A database can contain multiple tables. A table can reference another one if so desired. For easier creation/editing/management of the database, an editor plugin that uses TabularBox is part of this addon.

DataAsset

Interdependency Needs Activation Extra Settings
UI/SpinSlider yes no

Resources meant to hold data can be very useful. Yet editing properties through the Inspector panel might be very limiting on many occasions. This plugin is meant to make this kind of editing at least less clunky.

AudioMaster

Interdependency Needs Activation Extra Settings
none yes* no

This addon is meant to provide means to easily playback audio without having to worry about node lifetime. A few additional features are added, which makes cross-fading between audio tracks rather simple.

The specific demo for this addon uses assets:

* Activating this plugin only adds the AudioMaster script into the auto-load list. Alternatively you can manually add the desired script(s) to your auto-load list, meaning that you can set your preferred name more easily in order to access the functionality.

godotaddonpack's People

Contributors

fairhat avatar kehom avatar yuraj11 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

godotaddonpack's Issues

[Network] set_custom_vec2 is not synced if Vector2.x or y is 0

Noticed a bug where a custom vec2 action is not synced if x or y is 0

the vector2 is set on the client but either not sent to the server or the server is decoding it incorrectly.

Steps to reproduce:

  • Set a custom Vector2 action
  • Change the x value of the Vector2 every physics step but keep y at 0
  • Input will be out of sync

Add a license

The repository currently doesn't seem to contain any license. Could you add one, please? See Choose a License for more information ๐Ÿ™‚

For reference, most open source Godot add-ons use the MIT license.

Network: Assign Inputs to player nodes

How do you assign the inputs to the player nodes on the server side?

Your example is a bit too complex to understand where you actually bind these things together.

Also: It would be nice if you would share a demo where the server does not participate actively in the game (has no player that he controls) since in server authoritative games the server usually is just a spectator.

[Network] - Snapshot Rate

Allow clients to specify the rate in which snapshots will be sent, which could be at a lower pace than that of the simulation itself.

Network: Reparenting spawned nodes

I'm new to godot, so of course I do the sensible thing and jump right into making a persistent network game!

I'm making a sci-fi ship-crew game where players are person-like avatars (Kinematic) inside a ship (Ridgedbody). The server is always running so players and ships will be spawning/despawning as they log in and out. There will be an arbitrary number of ships and players.

Ideally I would like the player avatar to be a child node of the ship, however the register_spawner function seems to requires a hard-coded node to spawn in.

If I have a PlayerCharacter spawn node, will the network addon allow me to reparent without the system breaking? Or is there a better way for me to go about this?

[Inventory] Invalid call when using add_item() function for the InventoryBag node

While I tried to follow some of your Inventory addon tutorials I stumbled upon some issues, I managed to rewrite the "_generate_item()" function as "_get_item(id, category)" so that its being used to load valid (I think?) item entries that gets added to a dictionary variable, now when I use this "_get_item(id, category)" function to add a item to the InventoryBag node I get this error: Invalid call. Nonexistant function 'disabled_slots_occupied' in base 'Nil'.

When I use the "add items" code example and try to add the item that way I get the same error.

Debugger output:

0 - res://addons/keh_ui/inventory/bag.gd:948 - at function: _get_colliding_data
1 - res://addons/keh_ui/inventory/bag.gd:1029 - at function: _find_fitting_spot
2 - res://addons/keh_ui/inventory/bag.gd:164 - at function: add_item 
3 - res://System/Inventory/Init.gd:19 - at function: add_items
4 - res://System/Inventory/Init.gd:14 - at function: ready 

Node2D, InvDemo.gd script: https://ghostbin.com/paste/km8Ek

Node, Init.gd script: https://ghostbin.com/paste/8yRFk

[Network] Server rewind

This is more of a question and possibly feature request:

In FPS type games it's common that the Server goes back in time (for a maximum of N ticks) to check if someone's bullet hit another player (if a client says he hit someone but the server did not see it on his tick, due to network delay).

Most FPS games favor the shooter (which means you can run around the corner and get hit like a second afterwards because the player shooting you had a latency of ~500ms), while others favor the one running away.

Is it currently possible to implement something like this with this library?
I know that Godot does not allow rewinding a scene and doing so would cause a lot of other problems (all clients would rewind their states too during that tick)

However it'd be already "good enough" to get history data for that action:

  • Where did the shooter aim at ? (at the tick we acknowledged the shot)
  • Where was the player that got shot? (at the (tick + travel time of the bullet))

If i was able to know this i could reconstruct an invisible bullet + hitbox of the player and use smth like raycasting to check it.

Edit: Assuming i have Aim and position of all players stored in previous state snapshots(!)

[Smooth2D] Rotation of Sprites

Question:

Is it possible to smooth the rotation (and just the rotation) of a Sprite with the Smooth Addon?
As far as i can see it is only possible to sync the whole Transform.

We could extend the Plugin to be able to selectively update transform properties (position, rotation, scale) and select the Node that is referenced (instead of taking the parent).
This would allow to create invisible entities that are changed and bind the visuals (which might have different anchor points).

For example:
A Sprite with an Anchor point (Changeable with V Key) outside the sprite boundaries
A Node2D (lets call it SpriteRotation) which represents the data that we want to bind
Binding rotation of Node2D to the Sprite would result in the sprite being rotated correctly

Right now making the Smooth2D a child of SpriteRotation and the Sprite a child of Smooth2D
So: SpriteRotation -> Smooth2D -> Sprite
Would make the Sprite rotate different than what one would want to accomplish

Suggestion:
Smooth2D Configuration (in the Editor)
From Node: Any Node2D (currently the parent)
To Node: Any Node2D (currently the child of Smooth2D)
Properties: Array<(PropertyName, PropertyType)>

So we could configure it to take any Node2D as a reference and apply the Properties to any Node (given that both have the property and the type is the same on both)

PR possible? I could give it a try

Edit: I can see that you decided against linking the nodes manually. Maybe they could just be initially selected as a trade off?
If you don't want this to be part of the Addon to keep it simple, i'd create a fork of it

Network: Create Feature Roadmap/Wishlist

Hey me again,

could we set up on the projects tab a feature roadmap or wishlist?
I'd like to contribute to this project because i want to use it on my own game.

[EncDecBuffer] Support for string

Is there any reason why EncDecBuffer does not support strings by default? I have come up with this:

static func write_string_utf8(encdecbuffer: EncDecBuffer, string: String) -> void:
	var bytes := string.to_utf8()
	encdecbuffer.write_uint(bytes.size())
	for i in bytes.size():
		encdecbuffer.write_byte(bytes[i])


static func read_string_utf8(encdecbuffer: EncDecBuffer) -> String:
	var bytes := PoolByteArray()
	var size := encdecbuffer.read_uint()
	for i in size:
		bytes.append(encdecbuffer.read_byte())
	return bytes.get_string_from_utf8()

(I am not using strings in snapshots but in custom player_data properties to optimize and send things like player name, skin etc. to be send in one packet)

[Network] Abstract data layer

It would be great if one could simply swap data layer - let's say you want to use steam networking API layer for sending and receiving packets.
Currently everything is based on rpc calls but it would be good to use some abstract layer between sending and receiving data in network.

For example there's readP2PPacket and sendP2PPacket in steam library:
https://gramps.github.io/GodotSteam/functions-module.html

At one point I will need this feature so it's possible I will take look on this future and create PR.

[Inventory] A signal when a Item got switched with another Item.

It seems your Inventory addon is missing facilities to check if a item got swapped by another item, I need this form of check since with my current implementation of the shop menu that disables certain bags so that the player cannot get free items gets bypassed when the player is dragging a item and swapping it with another item. Trying to use the signal "item_clicked" on my end only registers right clicks and not left clicks so I cannot really use that one for saving item datacode and making sure the bags stays disabled on the shop menu.

Network: Input is just pressed

Hey,

is it possible to get a just_pressed function for input events?
For example in a 2d platformer game there's no need to continously trigger jump events even if the player keeps holding the jump key down.

thx for the addon btw, looks great so far!

[Network] get_node: Node not found: @@8 when connecting to server

Or: croxis needs to commit more often so breaks are easier to revert!

I did... something which is causing errors to be thrown and I am not sure where to start looking to fix it. I used the dedicated server tutorial as the template.

E 0:00:32.735 get_node: Node not found: @@8. <C++ Error> Condition "!node" is true. Returned: __null <C++ Source> scene/main/node.cpp:1381 @ get_node()

E 0:00:32.735 _process_get_node: Failed to get path from RPC: @@8. <C++ Source> core/io/multiplayer_api.cpp:256 @ _process_get_node()

E 0:00:32.735 _process_packet: Invalid packet received. Requested node was not found. <C++ Error> Condition "node == __null" is true. <C++ Source> core/io/multiplayer_api.cpp:204 @ _process_packet()

When I spinup the server node @@8 does exist with the player_1 node under it. On the client side player_1 is under node @@14

[UI - Inventory] Infinite Scrolling or (grow as needed) Inventory Bag

Hi, i just recently discovered your addon pack while looking for an grid-based inventory system. and it matches all i need!, thanks you very much!.

So, for trying to implement an sort of S.T.A.L.K.E.R-like inventory system where the grid is infinite as long the weight capacity limit is not reached, i cannot find an way to grow the grid as needed (like grow the grid after 90% of the grid was used in items), tried using scrolling bars and some hackery but with no luck. do you have an better idea or code how could be achieved?

As well would be nice of selecting the item by dragging them until drop to an special slot and not just clicking it once and then clicking it again to putting in an special slot.

Thanks.

[Inventory] - Need assistance with manipulating mouse for manual drag & drop operations.

I have written a crude script for a manual drag & drop operation and I managed so far to access the currently held Item of the cursor but right now I'm stuck with my implementation. The reason I want to do the manual drag & drop operation is that I want to implement a S.T.A.L.K.E.R like shop system which your addon almost provides everything for it, the shop system in the before mentioned game has 4 elements where items appear under certain conditions.

With this call I can get the "drag" operation going:

{InventoryNode}.pick_item_from(Column, Row, -1) 
ItemDragged = InvEvent

Then with the following call I get a stack overflow (1024) error which it seems the add_item() part gets stuck in a loop and gets called multiple times yet when I do a basic print() call then the print() function only gets called once per mouse click which is odd.

	match (event.get_class()):
		"InputEventMouseButton":
			#Drop the item.
			if Input.is_action_just_pressed("mouse_left") && ItemDragged:

				if Bag._shared_data.is_dragging():
#					print(ItemDragged.get("item_data"))
#					var NewItem = ItemDragged.get("item_data")
#					emit_signal("Self_AddItem", NewItem)
#					print("True:", Bag)
					pass

I did read your blog documentation page but I couldn't see a signal function or anything similar which lets me retrieve and manipulate the mouse during the "dragging" part so that it behaves almost same as if the Inventory mouse setting is not in "none" mode. I apologize in advance if I have missed something.

InventoryManager_DragnDrop.txt

Opening GitHub Discussions

github has a newish feature called discussions, basically an embedded forum. I feel a bit awkward opening an issue when I mostly have questions or need clarification on something.

Network: Despawned Nodes respawn on Clients

After the latest update (i believe) i noticed a strange bug on my demo project:
If a player disconnects, the despawning on the server works perfectly, however on clients the node is despawned, and on the next tick respawned (and it stays there forever).

Is this the only way despawning players on the clients should be done:
func on_player_left(pid: int) -> void: network.snapshot_data.despawn_node(NetPlayer, pid)

NetPlayer is my SnapEntity Object and i'm directly assigning the pid of the player to the node (players only have one controllable character)

Network: Server tickrate

is it possible to send the tickrate of the server without having to change the physics fps ?
Because i'd like to still run on 60fps on server but sync with clients on a different ticks/second

Network: null NetPlayerNode on server when client calls network.notify_ready

In case it is relevant: Because I am exporting to HTML5 for the client I replaced enet with websocket (would love webrtc instead but I have yet to figure out how to get that bundle of joy implemented, but I digress.)

Client calls network.join_server() at the end of the ready function of the initial scene.
Client listens for "join_accepted" before calling network.notify_ready()
But no snapshots propagate to client, regular godot rpc calls do work however.

Relevant code snips from gameworld.gd

func _on_server_join() -> void:
    if (!network.has_authority()):
        debug("Notifying server that I am ready")
        network.notify_ready()

# Called when the node enters the scene tree for the first time.
func _ready():
    var is_client: bool = false
    
    if OS.get_name() == 'HTML5':
        is_client = true
    if Array(OS.get_cmdline_args()).has("-c"):
        is_client = true
    
    if is_client:
        print("Debug Gameworld: Is_client")
        _setup_network_input()
        network.connect("join_accepted", self, "_on_server_join")
        network.join_server('127.0.0.1', gamestate.server_info.port)
        var lobbyUI = load("res://lobby.tscn")
        var lobby_node = lobbyUI.instance()
        $HUD.add_child(lobby_node)
    else:
        print("Debug Gameworld: Is_server")
        network.create_server(gamestate.server_info.port, gamestate.server_info.name, gamestate.server_info.max_players)
        $HUD/PanelServerInfo.hide()    
    
    # Spawn the ship
    if (!get_tree().is_network_server()):
        #rpc_id(1, "spawn_player_ship", gamestate.ship_name)
        print('Debug Gameworld: I am a client attempting to call server spawning player info')

In network.gd I threw in some debug print statements. The remote_player dict is empty so nothing is set to ready.

# Server will only send snapshot data to a client when this function is called
# by that peer.
remote func server_client_is_ready() -> void:
    assert(has_authority())
    # Retrieve the unique ID of the player that called this
    var pid: int = get_tree().get_rpc_sender_id()
    var player: NetPlayerNode = player_data.remote_player.get(pid)
    print("Debug Network: server_client_is_ready " + str(pid) + " " + str(player_data.remote_player) + " " + str(player))
    if (player):       
        player.set_ready(true)
        print("player ready")

[DB] Problem with database tables when saved as resources

Ok, so when you create a table you have 2 options: save it as "embedded" or save it as a resource in your db's folder
so i used the latter and created a table. then i removed the table i created with the little minus icon here:
image
and when i added the same table back (by dragging it from the filesystem) it showed up in the editor but when i ran the code and printed the list of tables it wasnt there.
so basically the bug is that if you save a table as a resource it stops working if you remove it and add it back again
the embedded ones work fine though so there's a workaround
(btw i really appreciate your addons ty ๐Ÿ‘‰ ๐Ÿ‘ˆ )

[Network] Non player entity snapshot correction

I am working on moveable platform in 2D which has constant velocity and uses StaticBody. The issue is that corrections keep incrementing even though I applied new corrected position. I am running this code on both server and client.

The logic is following:

func _ready() -> void:
 uid = name.hash()
 network.snapshot_data.add_pre_spawned_node(MovingPlatformSnapshot, uid, self)
 # load platform points


func _physics_process(delta: float) -> void:
 ####
 if correction_needed:
  position = correction.position
  next_stop_index = correction.next_stop_index
  ...
  for _i in network.snapshot_data.get_prediction_count(uid, MovingPlatformSnapshot):
   update_platform(delta)
 #### 
update_platform(delta)
network.snapshot_entity(MovingPlatformSnapshot.new(uid, 0).from_node(self))


func update_platform(delta: float) -> void:
    # velocity is constant calculated from next_stop_index which is next point where should platform stop but it is same on server and client
    position += velocity * delta

MovingPlatformSnapshot contains position and next_stop_index

The position in corrected always differ in very similar numbers like 3 pixels difference. Also I have observed same issue with your demo project - glowprojectile.gd it keeps correcting. Maybe there's something missing in the addon like we needed for player entities (correct_in_snapshot) ? I don't even use anything advanced with physics it's just simple position and once it is corrected it should be sync with server.

Mega Demo / Network: Predicting inputs jittering

In your mega demo i noticed that jumping (and predicting it) works fine as long as no other button is pressed.

However if you jump while moving with 2 keys (lets say W and D) the prediction seems to cause jittering.
In my own game prototype i can see that replaying is triggered many times when the server has to process many inputs while it is only called 1-2 times when i only press jump (and nothing else)
Could this be related to move_and_slide?

You can see it in the attached video:
Addons (DEBUG) 09.07.2020 14_12_59.mp4.zip

Resource Leak Investigation

Hello everyone.

I'm opening this issue to let you know that I'm aware of a problem with resource leaks, more specifically with the Inventory, Network and DebugHelper plugins.

Specifically for the Network and the DebugHelpers the error message will appear only if at least one of those plugins is enabled. I have tested forcefully freeing the two automatically created singletons at the plugin's _exit_tree() function and the error message went away. I will further investigate to identify if this is a problem with the code or a bug in the EditorPlugin.add_autoload_singleton() function.

As for the Inventory, the problem is a bit more complicated. On my preliminary tests it seems the root cause of the problem is in any script class that static types "itself", something like this:

extends whatever_that_is_a_reference
class_name some_class

func some_func(some_arg: some_class)....

Just having a script with code like this will result in resource leak error message.

Based on this information, I'm not sure about the severity of the problem on the Inventory plugin, however it's probably harmless on the Network and the DebugHelpers plugins, as the problem seems to be that the singletons are not freed in time during the exit process.

[Network] execute remote players' actions on client with no authority

Hello,

Say you have an action registered:

network.register_action("attack", false)

in the physics_process() of the player script, the code input = network.get_input(_uid) is only executed on the local machine and on the server:

network.gd:

func get_input(player_id: int) -> InputData:
	var is_authority: bool = has_authority()

	if (!is_id_local(player_id) && !is_authority):
		return null
	
	var pnode: NetPlayerNode = player_data.get_pnode(player_id)
	var retval: InputData = pnode.get_input(_update_control.sig) if pnode else null
	
	return retval

meaning a remote player scene will not be able to check and execute the input.is_pressed("attack") to play, for example, an attack animation.

For now, the attack animation is played if the player is local and on the machine that has authority, but a client that doesn't have authority will not be able to execute actions of other players.

How would you go about synchronizing the actions of all players on all machines?
Same question goes for an NPC entity.

Would the solution be to put new booleans in the snapshot script extending SnapEntityBase, and set them as action = true when receiving a new action from the snapshot ?

Thanks for the addons and for your help.

[Network] Player custom property

Is it possible to retrieve custom property for all players? Does server sync custom properties of all players? Because I can't get this working. I have something like this:

network.player_data.add_custom_property("character_skin", "default", NetCustomProperty.ReplicationMode.ServerBroadcast)

in game menu I am setting the property type as string:

network.player_data.local_player.set_custom_property("character_skin", skin)

in player script I have this:

func _physics_process(delta: float) -> void:
if corrected_state != null:
 if !initialized:
  var skin = network.player_data.get_pnode(meta_uid).get_custom_property("character_skin")
  # set skin
  initialized = true

I can set skin as another variable for syncing in snapshot class but I don't want to do this because it doesn't make sense to sync skin everytime but only once.

some ideas for the database addon

  1. add a column of type "color" to the database, godot has that built in very nicely
  2. add an option to sort rows by a column (for example if i have a table called "hats" with a column that stores the hats' color and i want to see all the red hats or all the hats of type "rare" etc)
  3. maybe add an option for storing long strings? right now it just stores them as one line, but if i want to store a paragraph for example its hard to read it as one line
    (wasn't sure if this is the right place for posting this so correct me if im wrong)

[Network] WebSockets - No check if available

No check is done if WebSockets module has been installed.

SCRIPT ERROR: GDScript::reload: Parse Error: The identifier "WebSocketServer" isn't a valid type (not a script or class), or couldn't be found on base "self". At: res://addons/keh_network/network.gd:403. ERROR: reload: Method failed. Returning: ERR_PARSE_ERROR At: modules/gdscript/gdscript.cpp:599. ERROR: start: Script does not inherit a Node: res://addons/keh_network/network.gd At: main/main.cpp:1763.

I have module_websocket_enabled = "no" in my godot build.

The only way I can think to fix would be checking if ClassDB.can_instance() the WebSocketServer prior to attempting to ref it.

Not a major issue if no clean fix can be found.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.