Jump to content

Recommended Posts

Me and my friends have been playing Don't Starve Together and we always complain about these 1 block rivers that make no sense, and we kept thinking it would be really cool if you were able to make bridges or platforms you can place on the water as a mod, does anyone know if thats possible?
Thanks!

From my testing the barrier between the water and the land is a rather small invisible wall going up in the normal from the land.

The water itself has collision as if it were land, but you can't drop anything on it; you are free to move around on it.

 

Theoretically if a bridge were made then it would need to go up in this vertical direction to go over this wall, since the engine does support players going in this way.

The bridge itself would have its own wall to keep the player inside.

 

I think I'll see what I can make in terms of a functioning bridge.

Edit:

The physics makes everything circular with a non-changeable height (assuming player height like the invisible walls).

So having a triangle prism for a bridge isn't going to work.

 

For now, there's a mod that lets the player jump (DST) which you can find here: http://steamcommunity.com/sharedfiles/filedetails/?id=447092740

 

I assume I'll need to simulate a complex physics shape by teleporting the player's physics around based on relative position of the bridge.

Such a hackish thing to do.

Edited by CarlZalph

I work with a LOT of physics in the mod I'm working on. The barrier between land and water is "LIMITS". the ground is just "GROUND".

Most everything in the game colides with "WORLD" (which is both ground and limits). 

If you were to do

inst.Physics:ClearCollisionMask()  --removes all previous collision types it used to collide with
inst.Physics:CollidesWith(COLLISION.GROUND)

You would then be able to walk freely from land into the water, and back.

You would then need to do inst.Physics:ChangeToCharacterPhysics(inst)  (a preset for adding all the major physics collision types to characters) to put them back to normal.

Standardcomponents.lua is where this all comes from, by the way.

So there IS a way to bypass the barriers between land and water. However, you'd need to get real clever if you wanted to then keep them on a specific platform and not just wander into the water wherever they like.

 

As far as I've studied, I don't think there is any way to move these "LIMITS" barriers after the map has been generated, so it would be a pretty tough mod to make.

That actually would be better.

Having the bridge be a flat turf-like object in appearance that makes it so that when entered the players lose the collision of the barriers that reinstates when departing, while adding back a collision to have bridge boundaries.

 

Edit:

Playing around with these and I found that SetCapsule creates a pill shape for the top of the object.

The game uses the Bullet physics engine.

 

I can do what I was originally planning, actually.

You can create a cylinder, and the player happily walks up 0.2 units freely.

So it'll be a set of cylinder stairs with two taller cylinders on its sides, creating a peanut shape looking down of valid movement, and a two-sided stairwell from a side view.

 

Invisible wall height barrier is 2.0 units.

Doing this will make the entire thing a passive collision mesh rather than having it poll the players and mess with their collision mask flags.

 

Though this will incur a higher entity count since I need to generate 12 meshes..

It might be better for the polling approach and still have a peanut shape for the two sides to reduce it to 2 meshes with a periodic polling.

Edited by CarlZalph

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...