i have tried to do "hurt damage" animation with animation player to change material color... not work realy, all enemies get the animation, maybe you do a tutorial about this? maybe i didnt have understand how to synchronize correctly... but hp bar own hp and attack and movement worked fine... i am confused
In case you are watching this in 2024 or later (godot version 4.X or higher), here is the code updated: @tool extends StaticBody3D @export var SIZE: int = 64 @export var NOISE_AMPLITUDE = 16 @export var noise: FastNoiseLite = FastNoiseLite.new() func _ready(): generate_mesh() func generate_mesh(): print("generating mesh") var plane_mesh = PlaneMesh.new() plane_mesh.size = Vector2(SIZE,SIZE) plane_mesh.subdivide_depth = SIZE-1 plane_mesh.subdivide_width = SIZE-1 var surface_tool = SurfaceTool.new() surface_tool.create_from(plane_mesh, 0) var data = surface_tool.commit_to_arrays() var vertices = data[ArrayMesh.ARRAY_VERTEX] for i in vertices.size(): var vertex = vertices[i] vertices[i].y = noise.get_noise_2d(vertex.x, vertex.z) * NOISE_AMPLITUDE data[ArrayMesh.ARRAY_VERTEX] = vertices var array_mesh = ArrayMesh.new() array_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, data) surface_tool.create_from(array_mesh, 0) surface_tool.generate_normals() $MeshInstance3D.mesh = surface_tool.commit() $CollisionShape3D.shape = array_mesh.create_trimesh_shape()
this line: var image:Image = load(ProjectSettings.get_setting("shader_globals/heightmap").value).get_image() gave me this error: Attempt to call function 'get_image' in base 'null instance' on a null instance. does get_setting work differently now?
I heard ENetMultiplayer is not valid for WebGL games. Is this relevant when using WebSocketMultiplayerPeer or is that whole different approach and topic?
That's awesome man. I'm really glad this helped out. I don't make tutorials anymore, but I've learned a lot since making this. Let me know if you run into any other hurdles. I might be able to give some tips.
@@ditzyninja For context, Im using this framework as collision for my raycast based driving system. The major hurdle I'm running into currently is whenever the collision plane regenerates the raycast slips through for a frame making the driving feel jittery and unpredictable at times. If you found a fix to that or had a similar problem a general tip would be great. If not that's fine Im still extremely grateful for the tutorial!
Great tutorial. It's been super helpful so far. One note for anyone else walking through it, I had to put the rpc arguments for the player character in quotes. For example, I had to change @rpc(authority, call_local, reliable, 1) to @rpc("authority","call_local","reliable",1)
You'll have to forward a port on the router of the network the godot server is on. Then the client needs to connect to the router's public IP. The port forwarding can sometimes be done automatically by the program. I made a video on it: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-3e2RI60-bHg.html
How'd you know I had this exact problem XD Thanks. I appreciate that you don't just I assume I know everything and just say port forwarding and instead explain that and then show an example, all in like 3 miniutes
I have followed your tutorial and then I implemented it into your earlier tutorial with the balls moving around, but now my players aren't spawning :( I don't know what I have done wrong
I would love if you make a tutorial using godotsteam -> loby creation etc <3 and how to test the gam elocally on 1 pc instead of needing mutiple steam accounts for development
this. was troubleshooting for 3 days, opening ports, ipv4, ipv6, but this made it work. at least in one of 2 networks it did. only change i made is to run it in a thread, so the game doesnt freeze for 2 seconds.
well i gave it my best attempt to translate this to 4.0 but i dont know how to code the set get :( i have working code for HP from another game but i need more than the @export on it :(
@tool instead of tool (at the very top of the script) @export var generate_mesh: bool: set(val): generate_mesh() I'm not sure the variable and function name can be the same in Godot 4. I usually call the variable something like "generate_mesh_button"
If any of yall are getting an error like I did just move the camera and synchronizer lines at 3:15 to a delta function instead of the _ready one besides that great vid and it helped me honestly a lot
Actually, a lot of routers don't have UPNP enabled from the start. sunrise router for example. So thanks, but i can't do this for my game since i don't have UPNP enabled on my router :(((
2:55 this is confusing for me! Okay so connect() is a signal thing so when the signal is emitted, multiplayer_peer can pick up on it. What you want multiplayer_peer to do is outlined in the lambda function. Is this right?
That's pretty much it. The multiplayer_peer picks up on new players connecting, then emits the peer_connected signal. Any function connected to the multiplayer_peer signal will run every time it is emitted. We could have just as easily created a function in the main script called "handle_peer_connected", put the code from the lambda function in it instead, then connected it like this: multiplayer_peer.peer_connected.connect(handle_peer_connected) When connecting functions to a signal, make sure not to add to the () end, so multiplayer_peer.peer_connected.connect(handle_peer_connected()) wouldn't work.
okay meant to send this to someone else and re-reading this I just realized it sounds so sarcastic but I didn't mean to come off like that. Genuinely thank you
Thank you for a really great, in depth tutorial. Can you please answer a question for me? Once this is done and you place the player in the scene, how do you get the player character to face the direction you want? You can't rotate the player character or the controls get weird. Thanks again.
No problem. Glad you found it helpful. How do they get weird? It sounds like you might be rotating around both the y-axis and x-axis on the player character. Or possibly the camera's y rotation has been changed. This should always be 0. Only the x rotation should change on the camera, and only the y rotation should change on the player character.
@@ditzyninja Sorry, that wasn't helpful... When you place the player in the scene and then rotate it left because you want him to start facing left, after starting the game, you try and walk, but forward is to the left now. Straight would be right. I cannot figure out how to get past this.
@@GaryParkin All good. What you're describing would happen if the camera was rotated so it's z-axis points left, but not the player character. Does this happen when you add the player to another scene, or in the player scene itself? Also could you copy and paste your movement code here?