TeamHypersomnia / Hypersomnia

Multiplayer top-down shooter made from scratch in C++. Play in your Browser! https://hypersomnia.io Made in 🇵🇱
https://hypersomnia.io/
GNU Affero General Public License v3.0
1.08k stars 47 forks source link

Separating engine #285

Closed lolriven closed 2 months ago

lolriven commented 2 months ago

Hello. Would it be possible to separate the map editor and the physics engine from the gameplay logic? This would allow the map editor and physics to essentially bind to any unique logic.

An example would be, we have a very simple snake game, with its own snake logic while the map could be built with the editor and physics could be applied as an engine with callbacks or message que. The snake would then use collision callbacks or messages to react to the environment?

It is an over simplified example but this would be too large of a task to do?

geneotech commented 2 months ago

Hey there! You'll be happy to hear I plan to introduce scripting using luau - the exact same Lua dialect used by Roblox. I first want to make it possible to create exciting multiplayer game modes, since it is so easy to write networked logic under my architecture - literally everything is synchronized as long as it's deterministic, so scripts will be as well. Scripts will first come included in custom maps and also handle collisions or even create interesting environment with puzzles.

From there I might see how feasible it'd be to make a completely game-agnostic Editor. It overlaps a little with making your own AAA engine like Godot/UE. If I say it's a general editor, people are gonna expect a more complete functionality. As it stands I can say that "Hypersomnia doesn't need it", which is why feature X is not there. It's currently way more specialized to this exact single game than it seems from the first glance. For example - there is literally no hierarchy! The most we have is nodes assigned layers, nodes can't be nested in nodes yet. There's a lot of object properties specific to this kind of game too, e.g. footstep sounds, physical properties on portals etc.

However - if you look at the map's json format and how simple it is (literally just layers, node positions+sizes and types), you'll notice that there is absolutely nothing about characters, rifles et cetera (well, except for default game mode settings) - if you have a game which needs this kind of object pattern (no tilesets, just random sprites aligned to grid, some physical), you can already very easily write a converter that converts Hypersomnia's json to your game's json, and use the Editor for editing and just to gauge the physical interactions playtesting with a character holding a rifle that later won't be in your game.

lolriven commented 2 months ago

That's actually very exciting, I would love to see that! I definitely see how difficult it would be in this case to make a logic-agnostic editor. I'm really fascinated by how your netcode works. I've written my own rollback netcode solution and I still get excited to see how others solve their solutions. Even that aspect alone would be incredible. The main reason I asked about a separate editor/engine was there's a lot things that hypersomnia does like deterministic physics, collisions, raycasting , line of sights and lighting which I think would be really cool to have that be its own engine where someone then in C or C++ build their own game logic on top of that.