Jump to content

xtom

Members
  • Posts

    365
  • Joined

  • Last visited

Posts posted by xtom

  1. Funnily enough I just coded a function for this today...

     

    I put the function below in the player script and then use the following to call to run and check it in post render...

     

    if self:FadeScreen(0,100) == true then

    -- screen has now faded to black

    end

     

     

    if self:FadeScreen(1,100) == true then

    -- screen has now faded from black

    end

     

    It seems to work pretty good but if anyone spots anything dodge in the code let me know. Still learning lua as I go.

     

    -- fades screen to black
    -- fade 0 fade to black
    -- fade 1 fade from black
    -- speed eg. 10=fast 100 slow
    function Script:FadeScreen(fade,speed)
    local screenWidth = App.context:GetWidth()
    local screenHeight = App.context:GetHeight()
    if fade>0 then
    -- fade from black
    if self.fadeValue == nil then self.fadeValue=speed end
    
    local alpha = self.fadeValue/speed
    if alpha<=0 then alpha=0 end
    App.context:SetBlendMode(Blend.Alpha)
    App.context:SetColor(Vec4(0,0,0,alpha))
    App.context:DrawRect(0,0,screenWidth,screenHeight)
    
    if self.fadeValue <= 0 then
    self.fadeValue = nil
    return true
    end
    
    self.fadeValue = self.fadeValue-1
    
    else
    -- fade to black
    if self.fadeValue == nil then self.fadeValue=1 end
    
    local alpha = self.fadeValue/speed
    if alpha>1 then alpha=1 end
    App.context:SetBlendMode(Blend.Alpha)
    App.context:SetColor(Vec4(0,0,0,alpha))
    App.context:DrawRect(0,0,screenWidth,screenHeight)
    
    if self.fadeValue >= speed then
    self.fadeValue = nil
    return true
    end
    
    self.fadeValue = self.fadeValue+1
    end
    
    return false
    
    end
    

    • Upvote 1
  2. Does anyone have an example or tutorial on how to apply a post effect in the lua code? I want to simulate the player being sick so I tried adding a blur and wobble effect in Post Effects dialog in the editor. The effect is pretty cool but I don't know how to apply these in the lua code.

  3. I see the fps weapons pack dlc has prefabs that allow you to place the weapons as pickups around the level. Would it be possible to have one of these pickup prefabs for the autopistol that is included for free? I will hopefully get the fps weapon pack dlc at some stage in the future but it would be good to have one for the autopistol included free to see how it works and what is the official standard code used when handling weapon pickups.

  4. This is pretty cool and will be a great memory saver but if you walk away from something and do a quick 180 you can see a lot of black/texture popup which is quite ugly. I think it should maybe only unload the textures if the player is a good distance away. It seems to happen if they are behind you and only 50 meters or so away. That's so close it's obvious so maybe only unload them if they are 200+ meters away or something. Maybe on an ssd drive it loads them quicker that you wouldn't notice but it's noticeable on my setup with a 7200rpm hard drive.

    • Upvote 1
  5. They're not game breaking but it makes such a difference if you have the appropriate sounds playing. Walking through the quiet landscape with echoing corridor footsteps clopping along doesn't help with the immersion. I'll probably go with a more generic softer sound that works both indoor and outdoor for now but it would be nice if there was an easy way to do this properly. It's another small step (ha there's an unintended pun) towards AAA game play, or at least AA.

  6. I did a bit of experimenting and reading and came across what the collapsed scenery problem is. I got the raycasting to the ground working and also tried with a collision check but it seems if you are constructing buildings and floors with csg brushes which would be pretty typical then you can't check if they are collided with like you would with an entity/prop. Or at least you can't seem to use getmaterial on them etc. because they aren't entities.

     

    It looks like if you give all floors a mass and collision type prop this will make them possible to check material but I haven't tried that fully and I'm not sure if that would be a good idea. I assume performance might be better with scene vs prop/mass? I don't know.

     

    Another option might be to use invisible trigger boxes over the floors or at entry/exit points to different floor types, and when you enter one change to appropriate footstep sound. It might be a bit messy having lots of extra boxes/triggers to do that though and might make scene management more complex. Maybe it would work well for an indoor level but then there is terrain and possible different textures snow,grass,mud,dirt etc. and layering trigger boxes over that wouldn't be ideal, every time you paint the terrain you would need to check and adjust the trigger boxes.

     

    What might be good is if the material dialog had an option to assign sound files like footstep sounds and maybe hit sounds for when a weapon hits it. This would make this situation a ton easier.

  7. Yes it's been bugging me too. The current sound is good for rooms and corridors but not so much terrain. I might do some experimenting with GetMaterial today. What do you mean by "collapsed scenery" ?

  8. Undo for applying materials too. I accidentally textured a whole group of objects the other day with a different material and I had to reload my last save because it would have taken to long to redo all the previous textures. There's a lot of things that would be nice to have included in the undo/redo feature.

  9. Thanks, that looks interesting Thirsty, at the moment I'm just experimenting with what is possible with the default tools but I'll check that out too.

     

    So I tested the different light settings 0 - 2 on my current 30 building test map and it runs on all settings without the Failed.. error messages so I'm not sure why it sometimes fails. Low quality looks fine though and will probably suit a terrain/town game so I don't mind using that if I have to. High qulaity ran too (very laggy) but it still ran, at least this time!

  10. I have 30 working again now (somehow) so thats 60 lights. Wow so that's a lot of memory.

     

    I was thinking of making a game with terrain and a few small towns, and in those towns would be some buildings with lights. Is this feasible? If they are far enough apart is memory freed up for other lights as you get further away/closer to them? Or is it a total amount of memory that is consumed from the start to end? I won't have 60 lights too close to each other at one time like in this test, but there could be more spread across a big game.

  11. Ok that's not what it is then because I went back to getting the message again with just nine buildings again somehow. However I have started again and right now I'm up to 20 buildings and it's running fine. I'm going to mess around it with it more to see if I can figure out why it limits to 9 sometimes and other times I can get more in there. There must be some reason for this.

  12. I found out something good. I had 3 ceiling lights in the building and they overlapped each other. If I remove the middle light and now none of the lights overlap I can place lots of buildings with no error message! Tested with 40 buildings (80 lights) and no error message.

     

    Tip of the day: Don't overlap your lights! :)

     

    Probably some memory intensive goings on when the lights overlap.

×
×
  • Create New...