Modding Discussion Immersive View

Discussion in 'Starbound Modding' started by Extazy620, Feb 8, 2017.

  1. Extazy620

    Extazy620 Scruffy Nerf-Herder

    Hi everyone, i'm looking for a mod that would change the view in games.
    For example if i'm at the surface of a planet and there's a cave just below, then i can't see it. Or another example, if i'm right a door closed i do not see what there is on the other side.

    I think mod like this may help in the immersion of the game.

    If somebody know a mod like that, please tell me !

    My apologies for my bad english !
    IHart likes this.
  2. lazarus78

    lazarus78 The Waste of Time

    Doubt one exists. Something might be able to be rigged together using facades, but it would be a mess and completely impractical, and nowhere near quite what you are looking for.
    IHart likes this.
  3. The | Suit

    The | Suit Agent S. Forum Moderator

    I forget the technical term but that would be a lighting mod.
    But I can tell you that - the game uses general lighting over these point lighting for performance reasons.

    So the type of mod you are asking for would have a pretty high toll on performance.
    IHart likes this.
  4. Inf_Wolf14

    Inf_Wolf14 Parsec Taste Tester

    I recommend looking into the lighting.config in the root of the assets:
    By default, light permeates blocks by a small value, which is why you can see dark rooms even through walls.

    If you were to patch the config to lessen, or even disallow light to permeate tiles, then rooms would be darker if not pitch black, hence unable to be seen until you introduce light to the environment.
    xaliber, Ultimate sandvich and IHart like this.
  5. IHart

    IHart Scruffy Nerf-Herder

    It's a field of view mod! I want.
  6. Chofranc

    Chofranc Pangalactic Porcupine

    That is a problem with the natural glow that every player haves, use Tanz Lighting Overhaul, is lighting overhaul that it will increase a lot your immersion and is modular if you don't want some features that add.
    Last edited: Feb 9, 2017
  7. bk3k

    bk3k Oxygen Tank

    You'd obviously(as mentioned) need directional lighting.

    Well you could do something crazy like lights scan for a room perimeter(similar to colony deeds) and then look for players within that perimeter. If a player is present, only then allow the light to turn on. You'd probably want any doors that are part of the perimeter to message the lights when they open and close. You'd probably want a quick fade for the lights turning on/off based off this.

    But then if the light is not within an enclosed perimeter, you'd need a different approach. You'd scan for players within a certain range, determine distance, any any barriers(tiles that occlude light), and use that to calculate positional lighting angle, intensity, and orientation.

    Actually scrap all that. Disable light from all objects. Instead lights will become messaging beacons for players. The player scripts would look for lights, then message to get light color, state, if the lights are supposed to be directional(like the outpost lights), etc from them. The player scripts also look for tiles that occlude light. After calculating what the player could actually see with respect to angles(relative to eyes), distance, occlusion, etc the player scripts spawn invisible projectiles that produce light(often directional) as needed.

    Combined with light not being allowed to bleed through walls that would make for a good "you can't see what you can't see" mod. It certainly wouldn't help performance any! And there would be a MASSIVE amount of objects to patch. In fact you'd want to patch any materials that would otherwise produce light and have the player scripts also scan for these tiles. And then you get to mod content that produces light too.

    So maybe to modify that idea again, A down-scaled approach. Don't even touch the light engine, don't scan for objects, no messaging. After calculating what the player should be able to see(pure geometry), put a black, completely opaque "particle" image overlay over everything else. That's a lot of particles! Short lived too, but perhaps this is probably the best performing yet as simple as it gets method. Near the borders of what is visible, you could have partially transparent shadow overlays too.
    Cyel likes this.
  8. Cyel

    Cyel Scruffy Nerf-Herder

    ^That last idea with world.collisionBlocksAlongLine() was what I thought

    But I prefer the "disable light from all objects" idea, if there's a way to "shut down the sun" (that's a pretty cool thing to say) you could probably make a status effect check world.skyTime() or world.timeOfDay() and adapt the amount of light emitted from the player; the game will calculate it as the only source of light and will "naturally" block off what's out of the player's vision (if light-doesn't-go-through-blocks is on) + fade out as the line of sight goes further and further
  9. IHart

    IHart Scruffy Nerf-Herder

    There has to be a way to just render one giant mask over the entire map, particles can not be the best answer.
  10. bk3k

    bk3k Oxygen Tank

    Well the "particle" can vary in size. Some particles are PNG images and thus can serve as a mask. For example -
    "/particles/hoverbikewreck/hoverbikegreenwreck/hoverbikegreenwreck1.png" is actually used as a "particle".

    For the areas not near the edges of what would be visible, you could use rather large images. 4 large rectangles could cover the majority of the screen. Progressively smaller ones once you're near the visible zone. And you'd have probably lots of varieties to cover different angles, with the best ones for the job chosen. So I'm thinking in most cases you could get away with not too many(especially where flat-ish surfaces are.) You could clamp the angles to 10 degree increments or so thus leaving you 36 angles to consider, and then some larger images, some smaller. The images themselves after optimization would be very small in file size(indexed with very few color palettes necessary) so should load reasonably fast(Starbound's unfortunate tendency to frequently dump then reload image assets not withstanding).

    I'd build a table with all the particle references stored in a JSON file(access with root.assetJson), and use something like
    function particleList(wrapTable)
      --storage.pTable is the big table I'd store in a JSON file
      --likely I'd slap together a temporary script to generate it initially
      local rTable = { }
      for k, v in ipairs(wrapTable) do
        rTable[k] = storage.pTable[v.angle .. "_" .. v.length]
      return rTable
    After having determined the player visible geometry, you build a circle around it. Where the visible area continues to the edge of the screen, wrap around off-screen. You're essentially comparing a table of coordinates here. From that you calculate your angles. This angle continues for this distance, Clamp the numbers and your variables can be appended as strings to make a key for pTable. At the next angle change, you determine the next piece the same way until you've returned to the origin.

    It is a lot of math, yes but computers are good at math. Of course once you've done the wrap around, you spawn a few more(huge) rectangles to fill the rest of the screen. The code itself I think could run fairly fast, but the issue is how often you'd need to run it for a quality result. So you start thinking about co-routines.

    No doubt this would be far better to run this C++ side, as well as let the engine use a zBuffer for this. But all that is beyond the reach of modders. In any case, I find it more so an interesting thought problem rather than a mod I'd create.

    I wouldn't use such a mod most the time as it would dramatically alter the character of the game such that building would be rather difficult among other things. But on occasion that would be cool like in missions. It would add to the platformer challenge aspect of the game for sure! In a more Metroid/Castlevania type game... this would be a great mechanic. You might not even see much behind you either(after all you aren't looking behind you).
    Last edited: Feb 9, 2017
    Cyel likes this.

Share This Page