Zylann / voxelgame

Voxel world prototype made with Godot Engine
Other
513 stars 84 forks source link

How to make the top down 2D multiplayer branch for Godot 4.2.1.NET+ Compatibility and browers? #101

Open WithinAmnesia opened 4 months ago

WithinAmnesia commented 4 months ago

How do we make the top down 2D multiplayer branch / version of this that can run on Godot 4.2.1.NET+ Compatibility and for online web / browser game hosting (so pretty much anything everything can play this power multiplayer seamless chunk system?

WithinAmnesia commented 4 months ago

Requirements: A hand made and dynamic main over world map 100 areas combined with 1,024 x 1,024 tile map for an at least tile map size of 104,857,600 tiles with 16 x 16 pixel tiles at least. Perhaps double that with subterranean and interiors included to the total amount of tiles for a multiplayer seamless chunk system. The intended client / player / population / server size is to be ~2K to ~16K+ clients on one server. How can we convert the Blockygame multiplayer seamless chunk system for this forever free open source forever free goal?

WithinAmnesia commented 4 months ago

My first thoughts are to get just to the basics and start from a stripped down 2D array. Yet I have to do this properly to keep the dynamic multiplayer seamless chunk system intact and future proof for 2.5D and 3D games; when they are ready to be made in subsequent order. I must seek guidance to do this properly and make a beautiful work for the community to be empowered with too for making massive multiplayer games. I call this whole open source forever free community dynamic multiplayer seamless chunk system Infinite Worlds.

Zylann commented 4 months ago

How do we make the top down 2D multiplayer branch / version of this that can run on Godot 4.2.1.NET+ Compatibility and for online web / browser game hosting

Sorry I don't have time to deal with all this, this is just a demo mimicking Minecraft to test the voxel engine. You'll have to learn doing your project combining different sources. This is not on topic of this repo.

WithinAmnesia commented 4 months ago

That is perfectly good too. I am just expressing and gathering my thoughts and looking for feedback. Thank you so much already. I have so much to do and I am very grateful for all the amazing things that are here for everyone forever free. It feels so amazing this opportunity exists in the first place. Thank you so much for caring too and I think I can find a way so the work is done properly and the community and everyone can benefit. I have to ask my friends and the skilled people about this endeavour. I am just happy that this has a future. Any feedback is welcome. Also I really like your moth avatar it is great!

WithinAmnesia commented 4 months ago

image I figured out flat world generation. voxelgame_flat_world_generation.zip

WithinAmnesia commented 4 months ago

Compatibility mode works in 3D multiplayer! M M O A R P G  V 000 001-5 Open-World Seamless Chunks System Compatibility Mode Works In 3D Multiplayer! Excellent! This means most anything can run this even web browsers.

WithinAmnesia commented 4 months ago

I just got the Godot_Voxel with BlockyGame to generate a flat world for testing in multiplayer: https://github.com/WithinAmnesia/ARPG/discussions/16#discussioncomment-8550111 The code for the flat world generator makes ~3 layers of grass (instead of just 1) and it might be a bit buggy but it works. Although I should have a simpler one like fill all with grass for example but I was not sure how to code that. So I just made iterations and slowly got it to work for multiplayer). Each chunk is 16x16x16 blocks so I have to optimize that into 2D better. It works, it's just now I'm trying to figure out how to make it 2D and not 3D but its progress. I'm not sure how to start the 2D. There are some examples of minecraft in 2D with 2D arrays but I'm not sure how to get the 2D mode going and how to keep the chunk system together. It took a while to get the blocks to be flat and the code was a case of trial and error switching things on and off and adjusting values testing in multiplayer.

I am trying to not be bound to the special Godot_Voxel engine module / the special Godot Voxel engine so this solution can be used in regular Godot Engine 4.2.1.NET+ editors so everyone can use this solution to solve this big community puzzle.

The big thing now is trying to get the 3D chunks into 2D chunks and its is proven to work in Compatibility mode even in 3D so it should work great in 2D. I have some examples that might help for a start but I'm not sure its super amazing at everything but they might help a bit to get a foothold of what to do next: https://github.com/pvini07BR/mijocraft/issues/2 (2D GDScript Multiplayer Minecraft in Godot 3.XX) https://github.com/pvini07BR/mijocraft/issues/3 https://github.com/pvini07BR/mijocraft/issues/4 ... https://github.com/sirarandor/lux-terra/issues/1 (2D Multiplayer expanding tile / chunk game with fog of war) ... https://github.com/KoBeWi/The-Soulhunter/issues/2 (2D Godot 3.XX multiplayer chunk game) ... https://github.com/fanherbaty/crustycraft/issues/1 (2D Minecraft with cave levels in Godot 4.2.1.NET+)

Where should the next step go? What are your thoughts and suggestions? Should I just keep tinkering away with the 4 2D multiplayer Dodot game demos and keep trying new things until something works with the 2D port of the multiplayer chunk system with Godot_Voxel? All feedback is welcome.

WithinAmnesia commented 4 months ago

Hey how can we get these world generator systems to produce vector2i data instead of like 3D meshes? https://github.com/Zylann/godot_voxel/blob/30b8d6307e3159d5118c7dc7db2fa4f2bd21e6f9/streams/region/voxel_stream_region_files.cpp How do we get the world generator to make 2D tiles and not 3D meshes? All the 2D chunk games use lots of vector2i data going on and the player and camera work with 2D array / tiles and vector2i data is all over the 2D projects code.

How do we go like: 'region_size->Vector2i and also 'y' -> '1' conversions and change the player into a 2D character and camera should work?

What needs to turn the chunk stream systems data from 3D meshes into 2D 'vector2i' to make the world generator make 2D chunks that work with 2D modes / characters / cameras and possibly tilesets / tilemaps?

WithinAmnesia commented 4 months ago

Hold the phone / hold your horses for Alfonso / Theraot is super smart: "This idea came to me: You might actually want to keep 3D chunks. Except do not translate them to meshes from voxel, but instead translate them to multi-layer TileMaps (that is, use the verticality of the voxel to define layers of tiles that would be above the ground).

Here is the thing, Zylann has code that does meshing of the voxels, see https://github.com/Zylann/godot_voxel/blob/master/meshers/cubes/voxel_mesher_cubes.cpp it creates ArrayMesh, and to do so it has to iterate over the voxels, and create buffers with the vertex data. That is not what you would do for 2D. You still need to iterate over the voxels, but instead of ArrayMesh you would be making TileMaps, and setting the tiles according to the voxels.

In fact, I'm wondering if this is worth the trouble. You might, for example, set an orthographic camera on a zenithal view (top down), and perhaps use billboarding or 3D sprites and you might have something close to 2D. Or even something like what they did for Zelda a Link Between Worlds where characters are skewed:" ZeldaCameraTrick "

"Ya that could work? WE could just use 3D and be a bit clever with a set camera angle. Yeah I just like the pixels because it's easy to make a lot of assets and like hey maybe this is the way because it's technically 3D but it is very cheap to run so as long as it runs on the web. As like hey if Old School RuneScape can run on like early 2000's PCs with dial up on a browser and that was chunks and 3D, so maybe we can just say good enough and use a hybrid 2D/3D thing? It would simplify a lot of things. I was thinking of that Zelda a link between worlds thing too lol. Also it would be BIG future proofing for 2.5D and 3D lol. Want to try this 3D but looks 2D approach and see where it leads? If we can pull it off it would be really good. I'll give the idea to the Zylann thread too. It's worth investigating." -Matthew / WithinAmnesia.

Okay we are all caught up. This thread / forum / email telephone marathon is not easy to keep on top of so everyone is on the same page. But it's worth it.

WithinAmnesia commented 4 months ago

https://www.deviantart.com/withinamnesia/art/3D-Player-Sprite-844324596 + https://www.deviantart.com/withinamnesia/art/B-o-S-3D-Pre-Alpha-843444461 I did this kind of 2D/3D hybrid in a very community upgraded RPGMaker MV in 2020. B o S  3D Pre-Alpha 2020 + 3D Player Sprite 2020

WithinAmnesia commented 4 months ago

How can the generator code be written to only produce dirt at 1 block flat in all directions? I got the script working but its buggy and has issues. the current world generator code looks okay in game but generated ~3 blocks high grass and it has trouble generating after a while and it makes bugs in the debugger window for the editor lol. How should be properly done so there are no bugs and it runs smooth and infinitely generates smooth running 1 block thick dirt chunks in compatibly mode?

Here is the gist of the 'generator_test.gd': https://gist.github.com/WithinAmnesia/025f8d1ae7b674fc2c2d4381e9e45c8b

I had to just turn off a lot of the BlockyGame generator like the trees but I used lots of # but I did not know what oi was doing 100% so I flew at it to get a working prototype good enough for rough testing which I did but it has bugs and runs not great play I feel there is a like one or two lines / parts of code that could generate 1 thick block of dirt in all x and z axis and have all the 2-16 above blocks be air filled. I think the air fill already works its just how to generate 1 block this of dirt is all on the 0 y / lowest block of the 1 chunk thick later. So its flat and using 1 thick blocks for infinite worlds. What are your thoughts and suggestions? What should be done here too? All feedback is welcome.

WithinAmnesia commented 4 months ago

I got the 1 thick block chunk generator to work but the multiplayer does not work for some reason or if it does only client 1 (host) and client 4 work as they join the world. I stuck with 3 layers of dirt and said good enough. It might be handy for water and things later. I'm not sure why the multiplayer did not work but hey I can live with a 3 block high flat chunk generator. image As seen here: https://github.com/Zylann/voxelgame/issues/102#issuecomment-1960645814