Virtual world system to allow for an actual city

I am no mapper so bare with me.

Let’s say we had 10 different houses without interiors, just the exterior, with the interiors far below/above the map. Using a script, when a player uses the door they are teleported to the houses interior.
Expanding on this, we duplicate all of the exterior houses as many times as we like, and can change the textures etc but the mesh should stay the same to fit the already existing interior.
Now, all types of houses teleport to the same assigned interior - that can’t work since players will be in each others houses. A fix for that is a virtual world system - all entities, including players, inside the interior are assigned a virtual world when they enter or spawn inside and any entity that is not assigned to the players virtual world is removed to the player(s), or essentially not there. This way, two or more players with different houses share an interior, although they won’t even know it. This allows for a large city map with more than 10 houses without reaching the hammer limits since we’re just using simple exteriors for the most part. This means that windows will be redundant on houses and you will not hear anything or see anything inside the house from the outside.

Am I wrong, mappers? Probably.

I don’t think we can do that but nice idea
Or maybe?

I considered this idea once before - it’s almost like instances in MMO’s so when you walk past a barrier, everything not placed by that player is invisible - and you can invite others into your instance.

I don’t know if it would work on a large scale, but it would probably be possible in a test environment. Unsure how well it would hold up, especially on a bigger scale.

[editline]20th January 2017[/editline]

You can set entities to be invisible to players, unsure about collisions and things though

Using http://wiki.garrysmod.com/page/GM/ShouldCollide and http://wiki.garrysmod.com/page/Entity/SetPreventTransmit should let you do this?

You can ent:Remove() clientside - or that ^

Any mappers input?

Did something like this a long time ago (at least in code)

The problem I ran into was I didn’t know how to suppress particle effects and sounds coming from another “world”.
I used the EntityEmitSound hook to try to catch sounds, but the hook only catches sounds played from the client, not sounds sent to it from the server, so things like gunshots and some footsteps would still leak into other worlds.

This is one of those “clever”, hacky things that sounds good at first. A few people have tried, but it just hasn’t worked well in practice (so far).

I mean you could re-create a footstep and probably a gunshot

I created something like this for a well-of darkRP server owner, and I experimented with lots of options.
The best one was creating clientside entities, and have serious serverside checks if there’s anything intractable in the interiors (ie. a weapon etc.), and overhauling mostly the PlaySound() function to a clientside CreateSound() with an invite system. Mainly particles are the tricky ones, my experiments suggest that most particles can be rendered transparent and 0,0,0 along with their parent entities, as long as there is one, but im not sure about that.

It’s possible, but only if you put lots of effort into it, and you will still end up with a semi working glitchy addon. Clientside only objects are also hard to deal with, many of them are not exactly supported by the engine, have GC problems and in general, are messy.

But if you ever get yourself to start working on this, make sure to let us know :PP

Didn’t GMod Tower accomplish pretty reliable instancing for the personal rooms?

But then, they didn’t really have to worry about gunshots or particles either.

i’m almost positive it wasn’t instanced and they really did have a bunch of different rooms on the map for each apartment door.

I guess you could just make lots of empty rooms, perhaps just one, and have worldspawn entities as props, perhaps even walls.

Gmodtower rented those rooms to first come first serve , and just loaded their layout upon renting it.

We have something like that in GCinema.
Aside of the mapped theaters, one can make his own apartments (with a p. good sims-like editor), which is a lot of entities passed to the client to render, leaving other player/entities in a different apartment as invisible, non-collidable. As a result, everyone can make fully customized rooms with fully customized materials.
It has the problem of bullets and explosions going through, but since it’s a cinema server, it doesn’t matter for us.
It has a few bugs, as everything, but I like it a lot.

Only one room in the map is used, though.

Some guy quite a few years ago was developing a little Diablo-esque gamemode where you could enter dungeons and fight monsters for loot/money and you could only see people in your party within the dungeons, but it had the same issue as above where some things like explosions/decals/blood etc would bleed through and be visible by everyone.

For things like wallpapers, floors etc did you have a blank room and just have entities overlaying the walls/etc?

It works great in GTA:Online, but you will need some binary module to do this. And I don’t think it is possible even with a binary module. Multiworld system is implemented in many games, i.e. GTA, Minecraft. To create a REAL another world we need to run another instance of the map on the same server, but it will be laggy as hell. Source Engine wasn’t really made for this. You could try to not load unneeded parts of the map in each world, but I doubt anyone will ever make this because it’s too hard. We could try to ask GMod devs though.

As an example you can look at GTA:Network, an unofficial GTA 5 Multiplayer, where different “dimensions” are implemented: https://wiki.gtanet.work/index.php?search=dimension

I came across a layers code for gmod 12 that worked nicely and fixed it up if i can find it i will post it tonight, that should be usable for what you want. I fixed it up for this exact reason and just never got round to doing it. One of the nice things is that anything on layer 0 is on all layers.

This is getting rated dumb but couple of points as to (probably) why -

  • The question is purely about if/how it can be achieved in Garrysmod
  • GTA/Minecraft by default don’t have a system like this, they generate/load separate levels when you transition areas and don’t do any kind of player phasing.
  • As mentioned above phasing is already possible in Garrysmod as you can just group entities up and tell clients to only render what is in their group, and with a few clever hacks change whole environments.

There’s only really a point to it in certain situations in any game. Having a 100 player server and making it instanced so it could support 200 people on one map would be pointless because the source engine would be unable to handle it, even if having 2 separate 100 slot servers on the same machine was fine. When you start dealing with large amounts of players in a single server you start moving into cluster technology and load balancing instances or areas of a single huge environment over different machines, like WoW/Eve do. A hacky way of doing this would be to fade all networked entities out but keep the player loaded into the level and free to move when they are disconnected from the server and just fade entities back in when they load into the new server, but this still aint possible on Source.

Within the context of the source engine it’s only really feasible on a small scale to pull off some neat trickery. The question for this kind of thing is whether or not it’s worth the trade off of developing it and dealing with the limitations vs just taking the extra mapping overhead (Which aside from Hammer limits doesn’t really impact performance on clients due to culling), though I imagine creating 50 small rooms below still wouldn’t majorly impact performance, but it would actually be far harder to develop for because you’d now be dealing with 50 virtual spaces instead of a single space and having to write some basic entity phasing code.

The code for phasing at its most basic is really simple, all you need to do is put a flag on entities that need to be in specific instances and then write some logic to manage toggling visibility/physics between different groups automatically as things change (enter/leave/die/etc).

Interesting idea.

Possible something like a LUA based trigger being the defining instance space, and everything inside the trigger is invisible to any other player not in the instance.

Wouldn’t know how to solve the sound issue without being too hacky, though.

Maybe let’s not overthink this, shall we?

All we need is to have the particle effects removed under certain conditions. Arent they entities of some sort? Or a kind of object that can be grabbed and removed? Perhaps they work like decals?

If the particles-madness can be resolved, all we need is to change physical properties of the entities in an area.

At the worst case scenario, we can just re-create all particles with a simple system and removing the original ones; and do the same with env_explosion and the bullet trace system. I doubt there is much else that interferes with the already existing solutions.

Also how about the space-enlarging github addon? Can’t that work?