sirarandor / lux-terra

An infinite sandbox game in Godot.
0 stars 0 forks source link

Can this work for Godot 4+ games with multiplayer and open world chunks? #1

Closed WithinAmnesia closed 6 months ago

WithinAmnesia commented 6 months ago

I'm trying to find a way to seamless load and unload chunks for a 2D multiplayer game project to make an open world with a working server using Godot 4.2.1.NET.

How can this work for multiplayer and what is needed for this to potentially work? What options can be used for chunk loading and unloading seamlessly in Godot 4.2.1.NET? Please give feedback.

https://jonathaneeckhout.itch.io/jdungeon For the goal right now it is easy to play this but imagine it has seamless chunk loading and unloading. As instead of the black world boundary a new chunk loads in seamlessly. What are your suggestions and thoughts?

Update: https://github.com/WithinAmnesia/ARPG/tree/ARPG-Infinite-Worlds Here is the 128x128 with 32x32 pixel tile chunk to test.

My initial testing seems to feel even faster combat with the 128x128 chunk. This 128x128 chunk has the same amount of entities as the 256x256 chunk. For I moved all of the entities over into the 128x128 chunk. This 128x128 chunk is a good test for using the Infinite-Worlds using the BinarySerializer for Godot 4.2+ from Theraot: https://gist.github.com/theraot/31515e28e2d8bfea33f6c6d5bcd852f6 . There needs to be some testing how to make the chunks seamlessly load and unload. https://gamedev.stackexchange.com/questions/209002/looking-for-help-godot-4-multiplayer-seamless-open-world-chunks

Test chunks link: https://github.com/WithinAmnesia/ARPG/discussions/15

I'm working on so candidates for the Godot 4+ Multiplayer Seamless Chunk System. I am looking through these ~500+ Github Godot .zip projects and seeing candidates to start to build up from. So far I have a few good candidates for Seamless Chunk System. https://github.com/DennisSmuda/godot-chunking-system [2D Chunk Generator] https://github.com/dllta/ChunkLoader [2D Chunk System] https://github.com/michasng/voxel_game/tree/main [3D Voxel Generator] https://github.com/pinkavat/GroveGenChunks [3D Seamless Chunks]

So I will soon need some more testing too lol and all feedback is welcome.

sirarandor commented 6 months ago

While I had at one point gotten the main TileMap of the world to sync across multiplayer, generate new tiles and sync them across all clients, the system quickly becomes large and unwieldy as the map went beyond 1,000,000 tiles. This resulted in slowing down Godot's performance substantially and requiring a great deal of RAM.

I'd heavily recommend storing chunks as files and only loading them when needed, and having the server or client pre-generate chunk files.

WithinAmnesia commented 6 months ago

You've done this?

WithinAmnesia commented 6 months ago

Mate I've been searching across github for so long and asking so many questions. Okay I got a lot of questions.

Okay so Can we figure out how to combine the best of the JDungeon demo stuff with your experience in multiplayer seamless chunk systems?

WithinAmnesia commented 6 months ago

While I had at one point gotten the main TileMap of the world to sync across multiplayer, generate new tiles and sync them across all clients, the system quickly becomes large and unwieldy as the map went beyond 1,000,000 tiles. This resulted in slowing down Godot's performance substantially and requiring a great deal of RAM.

I'd heavily recommend storing chunks as files and only loading them when needed, and having the server or client pre-generate chunk files.

What about 128x128 32x32 pixel tile chunks? How can we do this with the ARPG demo that has been adjusted for multiplayer seamless chunk loading and unloading? this one: "Update: https://github.com/WithinAmnesia/ARPG/tree/ARPG-Infinite-Worlds Here is the 128x128 with 32x32 pixel tile chunk to test."? How to start: Run 3-4 instances in the debug -> run multiple instances. Then run the first instance as Gateway. The second instance should run as Server. The third instance as Client. Make an account then log in. The fourth and more instances can be for client multi-boxing testing and work the same as the third instance.

WithinAmnesia commented 6 months ago

"I'd heavily recommend storing chunks as files and only loading them when needed, and having the server or client pre-generate chunk files." How do we do this? I have been recommended to store the chunks as .tscn like the ARPG demo is a 128x128 with 32x32 pixel chunk? How can we get the .tscn scenes as chunks and have the server be connected where the entities load and upload with the chunks that seamlessly load and unload with them?

sirarandor commented 6 months ago

There were plans for correct Chunk filing (ref: Minecraft's way of handling chunk files) on paper, but I had lost the interest at that point. Programming for multiplayer is repetitive at best and downright mentally harmful at worst. However, With .NET libraries you can read/write to files that let you store binary data.

I haven't taken a look at the JDungeon demo, and my system was by no means "seamless", as it suffered from tiles being dropped seemingly at random, and issues with chunk (0,0) not loading for clients.

WithinAmnesia commented 6 months ago

There were plans for correct Chunk filing (ref: Minecraft's way of handling chunk files) on paper, but I had lost the interest at that point. Programming for multiplayer is repetitive at best and downright mentally harmful at worst. However, With .NET libraries you can read/write to files that let you store binary data.

I haven't taken a look at the JDungeon demo, and my system was by no means "seamless", as it suffered from tiles being dropped seemingly at random, and issues with chunk (0,0) not loading for clients.

That's okay like we just have big chunks as scenes so it can be really manageable chunks like minecraft.

Binary! 1 sec I got a thing "BinarySerializer for Godot 4.2+ from Theraot: https://gist.github.com/theraot/31515e28e2d8bfea33f6c6d5bcd852f6 ." from Theraot is like a code piece for compressing and decompressing files / data back and from from server to client. It might help? With the binary stuff?

WithinAmnesia commented 6 months ago

I haven't taken a look at the JDungeon demo, and my system was by no means "seamless", as it suffered from tiles being dropped seemingly at random, and issues with chunk (0,0) not loading for clients. candidates for Seamless Chunk System. https://github.com/DennisSmuda/godot-chunking-system [2D Chunk Generator] https://github.com/dllta/ChunkLoader [2D Chunk System] These two are working like the simple one with just the coloured squares is good enough like the chunks don't have to be small they can kinda large so the transition is easier to load in and like maybe only 4 chunks at a time would be loaded at the corners was recommended by Theraot and others in the Godot community.

sirarandor commented 6 months ago

Interesting. My system didn't send scenes, it just sent Dictionary {Vector2 : int} as the chunk data.

WithinAmnesia commented 6 months ago

Interesting. My system didn't send scenes, it just sent Dictionary {Vector2 : int} as the chunk data.

What do you think? Can we do scenes? It would kind of be like mine craft's individual chunk data. If so we can get all the ARPG / JDungeon demos as scenes / chunks and load and unload them seamlessly hopefully. All we need is up to 4 of the 128x128 32x32 pixel tile chunk scenes loaded at one time (as in 4 at the corners would be the biggest test) at one time for the client and server to get along that its a great success.

sirarandor commented 6 months ago

I have absolutely no idea. Currently I am learning Wave Function Collapse for generating levels in my project Malun. The process you are suggesting could probably work, but I am unfortunately not in a position to help you write it.

And I wish I could share what I did, but it seems I have severely messed up luxterra's GitHub project.

WithinAmnesia commented 6 months ago

I have absolutely no idea. Currently I am learning Wave Function Collapse for generating levels in my project Malun. The process you are suggesting could probably work, but I am unfortunately not in a position to help you write it.

And I wish I could share what I did, but it seems I have severely messed up luxterra's GitHub project.

Oh older versions! Are they there to help? https://github.com/sirarandor/lux-terra/commits/dev/

WithinAmnesia commented 6 months ago

Also can I ask you questions and get some guidance?

sirarandor commented 6 months ago

If you wish to sort through the old versions that's perfectly fine, I can also go through some old local files to see if I have anything worth noting.

You can ask questions as well, but my response time varies and they may be completely incorrect.

sirarandor commented 6 months ago

I am by no means a good programmer, much less a passable game developer.

WithinAmnesia commented 6 months ago

Interesting. My system didn't send scenes, it just sent Dictionary {Vector2 : int} as the chunk data.

How can I swap this for scenes?

sirarandor commented 6 months ago

I just kept everything in the same scene and added onto the ever-growing TileMap.

WithinAmnesia commented 6 months ago

I am by no means a good programmer, much less a passable game developer.

Mate you are really good like what you did with multiplayer is like insane there sooooo many projects on here mate that are not even close to what you did.

WithinAmnesia commented 6 months ago

I have searched high and low for multiplayer chunk systems for Godot and like literally I'm up to 500+ and this project has a working multiplayer test. Like literally less than 1 in 100 projects like even come come close to this.

WithinAmnesia commented 6 months ago

I am mainly trying to find people like your yourself who are really skilled and like know how to solve these kinds of puzzles. I wish to do the work I just need some guidance too.

WithinAmnesia commented 6 months ago

I just kept everything in the same scene and added onto the ever-growing TileMap.

Yes but you did that in Multiplayer. That is really not easy to find.

sirarandor commented 6 months ago

You should absolutely check out the PirateSoftware Discord server, it's full of a lot of helpful people that make games together.

WithinAmnesia commented 6 months ago

What are your thoughts on loading multiple scene side by side to make chunks?

WithinAmnesia commented 6 months ago

You should absolutely check out the PirateSoftware Discord server, it's full of a lot of helpful people that make games together.

Really, that's really helpful to hear. Strangely I never heard that one and I have been asking around. How can I join this and look for help?

sirarandor commented 6 months ago

What are your thoughts on loading multiple scene side by side to make chunks?

Terrifying. You'd have to correctly access each scene as Nodes whenever you wanted to do navigation, placing or breaking, or anything.

sirarandor commented 6 months ago

https://discord.com/invite/piratesoftware

Make sure to go to Channels & Roles to get yourself the right role in order to access the #godot channel.

WithinAmnesia commented 6 months ago

What are your thoughts on loading multiple scene side by side to make chunks?

Terrifying. You'd have to correctly access each scene as Nodes whenever you wanted to do navigation, placing or breaking, or anything.

Wait you know a lot of things. My mind is really curious now. What do you know? Like so you can see in your mind's eye a path to explore on how to solve this really big puzzle? You can feel the challenge right? As like master artisan working on masterpiece? As like this is really rare mate.

sirarandor commented 6 months ago

Wait you know a lot of things. My mind is really curious now. What do you know? Like so you can see in your mind's eye a path to explore on how to solve this really big puzzle? you can feel the challenge right like master artesian working on masterpiece? like this is really rare mate.

I know that in my head I see a very scary looking scene that has a few hundred Chunk[number] Nodes that your script would have to manage accessing using String manipulation in your C# file.

WithinAmnesia commented 6 months ago

Wait you know a lot of things. My mind is really curious now. What do you know? Like so you can see in your mind's eye a path to explore on how to solve this really big puzzle? you can feel the challenge right like master artesian working on masterpiece? like this is really rare mate.

I know that in my head I see a very scary looking scene that has a few hundred Chunk[number] Nodes that your script would have to manage accessing using String manipulation in your C# file.

Wait you know these things though? So as long as I don't over stress you or anything like that you can look at things and see what should done? This is really rare mate like I've been asking around so much high and low like every possible forum, thread and like tracking people down like and you just know these things like you can clearly see them in your mind. So I feel I have to like not waste this opportunity to learn. I have so many questions. I should be aiming to be good to talk with though.

WithinAmnesia commented 6 months ago

https://discord.com/invite/piratesoftware

Make sure to go to Channels & Roles to get yourself the right role in order to access the #godot channel.

Okay Godot time. Okay I got it.

WithinAmnesia commented 6 months ago

Wait you know a lot of things. My mind is really curious now. What do you know? Like so you can see in your mind's eye a path to explore on how to solve this really big puzzle? you can feel the challenge right like master artesian working on masterpiece? like this is really rare mate.

I know that in my head I see a very scary looking scene that has a few hundred Chunk[number] Nodes that your script would have to manage accessing using String manipulation in your C# file.

Okay how can i ask this question to get help for people to give guidance on what needs to be done to make this?

How should I describe this and question should my question look like?

sirarandor commented 6 months ago

Wait you know these things though? So as long as I don't over stress you or anything like that you can look at things and see what should done? This is really rare mate like I've been asking around so much high and low like every possible forum, thread and like tracking people down like and you just know these things like you can clearly see them in your mind. So I feel I have to like not waste this opportunity to learn. I have so many questions. I should be aiming to be good to talk with though.

You're perfectly alright my friend. A lot of my visualization comes from practice. I've been programming for a while so I know the basic steps an idea needs in order to work. Even still I write everything down on paper in order to fully understand the logic behind anything I do.

WithinAmnesia commented 6 months ago

Should my question look like: Godot 4+ Multiplayer Seamless Chunk Scenes System

Wait you know these things though? So as long as I don't over stress you or anything like that you can look at things and see what should done? This is really rare mate like I've been asking around so much high and low like every possible forum, thread and like tracking people down like and you just know these things like you can clearly see them in your mind. So I feel I have to like not waste this opportunity to learn. I have so many questions. I should be aiming to be good to talk with though.

You're perfectly alright my friend. A lot of my visualization comes from practice. I've been programming for a while so I know the basic steps an idea needs in order to work. Even still I write everything down on paper in order to fully understand the logic behind anything I do.

You are a master coder? Mate that is super rare to find. II have so many questions.

sirarandor commented 6 months ago

How should I describe this and question should my question look like?

I don't know the entire scope of your project so I'm not sure how to direct, that's something you'll need to work out on your end.

sirarandor commented 6 months ago

You are a master coder? Mate that is super rare to find. II have so many questions.

Heh, I am by no means a master coder.

WithinAmnesia commented 6 months ago

How should I describe this and question should my question look like?

I don't know the entire scope of your project so I'm not sure how to direct, that's something you'll need to work out on your end.

Oh okay the core of my question is how do we get the JDungeon stuff that runs on a scene for a chunk to work like individual chunks that can be seamlessly interconnected and load and unload like in minecraft chunk data?

sirarandor commented 6 months ago

Oh okay the core of my question is how do we get the JDungeon stuff that runs on a scene for a chunk to work like individual chunks that can be seamlessly interconnected and load and unload like in minecraft chunk data?

You'll probably want to include some background to why you want the chunk loading done, showing how you're making a 2D multiplayer survival game, etc. but that sounds fine.

WithinAmnesia commented 6 months ago

Okay so I was at the pirate software discord with godot and it was mixed results. The people knew things but they didn't want to look at the project and asked strange questions or like they'd rather ask 10 questions then test the demo and like take 2 seconds to look at the files and ask like why I am building games not like what should be done to solve x? Its good but like probably needs specialized experts who work with chunks. I didn't learn much and I was told maybe do an array of 2D tiles but like when I showed them the synchronizer files that handles the chunk stuff they like idk lost motivation? They are were really caught up in like server security at one point and monetization prioritizes idk. There are really helpful people there but its discord so bit by bit.

WithinAmnesia commented 6 months ago

https://www.reddit.com/r/godot/comments/y955vs/i_made_an_opensource_minecraft_classiccompatible/

sirarandor commented 6 months ago

Okay so I was at the pirate software discord with godot and it was mixed results. The people knew things but they didn't want to look at the project and asked strange questions or like they'd rather ask 10 questions then test the demo and like take 2 seconds to look at the files and ask like why I am building games not like what should be done to solve x? Its good but like probably needs specialized experts who work with chunks. I didn't learn much and I was told maybe do an array of 2D tiles but like when I showed them the synchronizer files that handles the chunk stuff they like idk lost motivation? They are were really caught up in like server security at one point and monetization prioritizes idk. There are really helpful people there but its discord so bit by bit.

Yeah, the server is very security focused and no one wants to run something that could be potentially harmful. A lot of scams will ask people to download and test a game but it'll instead be a virus, so they're probably asking you things just to make sure you're not trying to scam them.

sirarandor commented 6 months ago

https://www.reddit.com/r/godot/comments/y955vs/i_made_an_opensource_minecraft_classiccompatible/

Oh that's very interesting.

WithinAmnesia commented 6 months ago

https://gitlab.com/tpart/godotcraft-classic

WithinAmnesia commented 6 months ago

https://www.reddit.com/r/godot/comments/y955vs/i_made_an_opensource_minecraft_classiccompatible/

Oh that's very interesting.

It works with multiplayer

https://www.reddit.com/r/godot/comments/y955vs/i_made_an_opensource_minecraft_classiccompatible/ https://gitlab.com/tpart/classy https://gitlab.com/tpart/godotcraft-classic https://gitlab.com/nokoe/classicl-server

sirarandor commented 6 months ago

It works with multiplayer

https://www.reddit.com/r/godot/comments/y955vs/i_made_an_opensource_minecraft_classiccompatible/ https://gitlab.com/tpart/classy https://gitlab.com/tpart/godotcraft-classic https://gitlab.com/nokoe/classicl-server

That looks awesome!

WithinAmnesia commented 6 months ago

I really hope it works well. I'm just starting to test it now lol.

WithinAmnesia commented 6 months ago

Its 3.XX hmmm I'm going to have to contact the dev and loook at other minecraft godot projects.

WithinAmnesia commented 6 months ago

I am doing a from scratch build now for the multiplayer chunk system. What should I do for the server and the data and chunk storage? https://github.com/WithinAmnesia/ARPG/discussions/16

sirarandor commented 6 months ago

I am doing a from scratch build now for the multiplayer chunk system. What should I do for the server and the data and chunk storage? WithinAmnesia/ARPG#16

You will probably want to plan out a process for generating, storing and syncing chunks across all clients. The more simple you can make whatever variable or struct you use for Chunks the better, as you're going to be using it a lot.

WithinAmnesia commented 6 months ago

Update: I am doing a from scratch build now for the multiplayer chunk system. What should I do for the server and the data and chunk storage? I have a few leads and some more thoughts and resources can be found here: https://github.com/WithinAmnesia/ARPG/discussions/16 <Start fresh thread. https://github.com/WithinAmnesia/ARPG/discussions/15 <Previous start thread. It was suggested I build a from scratch Multiplayer seamless chunk system that eventually be put together where it can handle 2K-16K+ players on the same server. What should be done for a web deployment to also run on a browser? I was suggested to try and do a chunk storage system similar to Minecraft or Terraria where each chunk is stored individually and accessed by the server in communication with the player clients. What should be done to solve this chunk puzzle? All feedback is welcome.

WithinAmnesia commented 6 months ago

I am doing a from scratch build now for the multiplayer chunk system. What should I do for the server and the data and chunk storage? WithinAmnesia/ARPG#16

You will probably want to plan out a process for generating, storing and syncing chunks across all clients. The more simple you can make whatever variable or struct you use for Chunks the better, as you're going to be using it a lot.

https://github.com/WithinAmnesia/ARPG/discussions/16#discussioncomment-8513009 "Leads and Suggestions: https://github.com/Solicey/minecraft-made-with-godot/issues/1 (Multiplayer Minecraft clone written in C# with Godot 4.2.1.NET) ... https://github.com/xellu/xelcraft/issues/6 (Multiplayer Planned Minecraft clone written in C# with Godot 4.2.1.NET) ... https://github.com/hakanero/minecraft-clone/issues/1 (Minecraft clone written in C# and GDscript with Godot 4.2.1.NET) ... https://github.com/pvini07BR/mijocraft/issues/2 (GDScript Multiplayer Minecraft in Godot 3.XX) ... https://github.com/fanherbaty/crustycraft/issues/1 (2D Minecraft with cave levels in Godot 4.2.1.NET+) ... https://www.youtube.com/watch?v=LEZGrHyWNmQ + https://astruggletosurvivedevblog.blogspot.com/ (C# software engineer seamless large tile / chunk map that can possibly do multiplayer and browser support game) ... https://github.com/sirarandor/lux-terra/issues/1 (Multiplayer expanding tile / chunk game with fog of war)"