Jump to content

Ttiki

Developers
  • Posts

    66
  • Joined

  • Last visited

Posts posted by Ttiki

  1. Hello everyone.

     

    Quick question, has any of you had any experience with implementing Steam API and more precisely Steam Input API to Leadwerks and even with Ultra ?) 

    I'm curious on the benefit, if any, to develop a connector to Steam API quickly in the development process to manage controller settings / game settings.

    Do you have one build for mouse and keyboard and another one controller ready ? Do you only have one build and just check in-game for if the user is using a controller or mouse/keyboard? How do you handle menus and GUIs, etc. That sort of thing.

  2. Hi.

     

    I thought Leadwerks was available to run on Mac OS? Am I crazy?

    Also, I know about Ultra App Kit being Mac OS ready, will Ultra Engine be accessible on Mac OS one day? I was wondering if I could use my Mac for developing my game or not.

     

    Thanks.

  3. Thank you so much. I didn't think 

           self.entity:SetPickMode(Entity.BoxPick,true)

    self.entity:SetPickMode(Entity.BoxPick,true)

    would be the problem. Might have to check the documentation more thoroughly. As well as for the scale.

    Thank you very very much ! :wub:

     

    Have a nice day.

  4.  There are two maps included: the first one, n1, represents the normal gameplay level or the first level. To reduce file size, I've removed most models from this map. It features a hospital bed with a pivot point to which the PlayerController.lua script is attached. This is where the Pick event occurs. Please bear in mind that the code might not be optimal as it's still under heavy development, and I haven't started optimizing it yet.:unsure:

    At both ends of the corridor, you'll find two empty pivots named HallwayWaypointA and HallwayWaypointB. Just below, there's a black box containing the monster with the Nurse.lua script attached. Essentially, her script starts a random counter, and when the counter hits a certain value, she will spawn randomly at one of the two points in the hallway and then proceed to move to the other point. The test inside the PlayerController.lua script is to check if the player has their flashlight on and whether the nurse passes through the raycast.

    There's another box outside the map with a simple FPSController. When you try the game, you'll find that you can only move the camera. Press 'F' to turn the flashlight on/off, and 'q' to enter sleep mode, which enables the FPSController. Press 'q' again to return to the default game mode.

    The second map is a stripped-down version of the level without the outside box and without any brushes or models except for the floor. This map is better suited for testing purposes since it contains only the essential entities and brushes.

    Thank you very much for your help! If you have any questions, feel free to ask. I'm here to assist you!

    :D

    2132315131_T3-L4-Dev.zip

  5. 11 minutes ago, Marcousik said:

    Hi 2 ideas to try:

    self.lightRayEnd:GetPosition()

    1)

    Check if this is not a child, if it is, it should be GetPosition(true)

    No, it's not a child of anything. It a simple Pivot I've placed to avoid any confusion with the end point (i.e I'm sure what is the endpoint of the ray).

     

    13 minutes ago, Marcousik said:

     

    2) I got an issue with pick() returning entities not precisely enough 

    Try to replace the false with true in the Pick() arguments

    Yeah, i've tried that as well with the new I've just made, no concluent changes happen.

    Quote

    Also maybe use [Name-of-your-created-world].Pick(....)

    Do you mean something like World:GetCurrent():Pick() ? 

  6. Ok, so after some more testing, I'm left even more confused. I know it's me again being stupid and missing something obvious, but I can't find the problem. When trying to hide the picked entity, it got hidden, but I couldn't see any changement. I thought it could have been a problem with some of my point entities. So I gave all my entities a KeyValue and logged which entity was being caught, but even then, the picked entity returned a KeyValue of nothing (" ").

    As I said, I'm on a map with just simple brush for the floor for the entity to walk on, the enemy, and my pivot which handles the player controller part by creating the light and the camera and which is used to detect if the enemy is passing through the light.

    I thought it could have been with the model of my enemy which has lots of children and different materials. So I deleted the model and attached my enemy script to a simple cylinder brush with Character collision and characters controller as physics mode. Each entity in the world, each brush have a simple script attached to it to set a key value for classname, which I log into the console in the Pick test. 

    And now, the Pick entity is not even picking anything from the scene. I tried removing the Collision.Character and set a radius, nothing worked. I logged every position of the Pick (Pick start point and Pick end Point as well as the enemy position in the world, but still nothing. The enemy passes through the raycast, the coordinates tell me it should be picked up by the Pick method. 

    :(

  7. 3 hours ago, Yue said:

    What is the origin of the lightning?, a mesh?

    Edit:  

    pickInfo.entity:Hide() --<<< Test.

    The origin of the lightning is a spotlight I create inside the player controller script at the Start method. 

    And thanks, I did not think of testing to hide the picked entity... :wacko: I will try that...

  8.  

    Hi everyone,

    I'm currently encountering an issue with a Pick operation in my Lua code and I'm hoping someone can help me figure out what I'm missing.

    Here's the context: I have a player controller, which is essentially a pivot that creates a light and a camera. The player controller doesn't involve any movement, the mouse position on the screen simply influences the camera rotation.

    I also have an enemy that randomly spawns and passes in front of the light, down a corridor. I want to check two things - if the light is on, and if the enemy crosses the light's path. If both conditions are met, I want to call a method from the player script to the enemy script.

    Here's the relevant part of my player controller code which handles the light being on and the Pick operation:

    function Script:UpdateWorld() 
      [...] 
      if not self.flashlight:Hidden() then 
        local pickInfo = PickInfo() 
        local i**** = self.entity.world:Pick( 
          self.entity:GetPosition(), 
          self.lightRayEnd:GetPosition(), 
          pickInfo, 
          .25, 
          false, 
          Collision.Character 
        ) 
        if i**** and pickInfo.entity:GetKeyValue("classname") == "npc_nurse" then 
          pickInfo.entity.script:SetPlayerIsShiningLight() 
        end 
      end
    end

    The flashlight check works as expected. However, I'm having trouble with the Pick method. It seems to correctly pick up the enemy when it crosses the ray's path. But it also appears to pick up another entity. I've simplified my map to include only a floor for the enemy to walk on and the basic set-up for the player controller. I've confirmed that the KeyValue is being correctly set in the enemy script (in the Start method), and that the collision is set to Character.

    Through debugging (I've removed all the console debug statements from the code above for clarity), I found that when I test for the pick position, it returns 0,0,0.

    To make sure I wasn't missing something in my calculations, I created another pivot to mark the end of the raycast (self.lightRayEnd).

    Does anyone have any idea what I could be doing wrong, or what might be causing this issue? I appreciate any input or suggestions. Thanks!

     

  9. Source 2 handles world geometry differently than Source. It doesn't use CSG any more but meshes. Creating a level with Source 2 is more like making a big model (composed of different models). You don't need to create 3 brush to create a doorway now, only one block you cut out and extrude (just like in blender and other modeling software.)

    That's the reason they could make the world so good, they didn't have the limitation of simple CSGs and could model things directly into the level editor.  

    • Like 2
  10. Hello.

    That's pretty easy to do, you just have to change the background color and pass a Vec4 for each channel (red, green, blue and alpha)

    Here is a little example in Lua :

    --A little example of panel creation with a transparent background
    local panel=Widget:Panel(0,0,64,64,gui:GetBase())
    panel:SetBool("border",true)
    panel:SetObject("backgroundcolor",Vec4(0.15,0.15,0.15,0.75)) --Vec4(r,g,b,a)

     

    And here is the result :

    Example in game (I've changed the code from the example code above to avoid conflict with my menu)

     

    • Like 2
    • Thanks 1
  11. Worked well, no problem launching the game. I just had a bug with my mouse being visible at the center of the screen. (And option button is disable in menus.)

    It looks really promising, :) can't wait to see what you'll do in the future with this game.

  12. 1 hour ago, Slastraf said:

    You might use 
    https://www.leadwerks.com/learn?page=API-Reference_Object_Entity_SetOcclusionCullingMode
    SetOcclusionCullingMode to true or false and look at the results.
    For this you need to add a script to each decal, or make a "decal handler" that sets this for every decal entity.

    I've tried this, it didn't work. Nothing seems to have changed. They still disappear when the player look away.

    1 hour ago, reepblue said:

    Make a new game with the FPS template and play the "AI and Events" map and pay attention to the decals. Also make sure your blend modes are the same as the samples.

    Thank you, I completely forgot about this MyGame example, even though I've played with it a lot. Now, I made some testing, and they work correctly, even stretch out a lot like mine. And I couldn't reproduce the bug. No matter how much I would stretch a decal, it would not disappear. 

    I made sure my materials were set up correctly, even copying the one from the example. But no matter what, mine still disappeared. I've used a technic from the demo and put all origins in the floor to extend the height as much as I could. 

     

    I've compiled a quick project with everything needed. If you want to try by yourself with my assets. I will let this problem aside at the moment and finish my demo. 

    DecalCullingTest.zip

    Thank you very much for your help!

  13. Yes, sorry, I forgot to add this information. I'm running with an AMD Ryzen 7 1700 with an NVIDIA GeForce GTX 660.


    I also thought it was a culling issue, but I wanted to be sure and see if someone did encounter this bug. I've tried scaling up the height and it kind of worked. However, to fix this issue I would need to make my decals way too high. Of course, I could always subdivide the big lines which cause me problems into smaller bits.


    I'm sorry if this sounds stupid, but I don't know the last question ^^ (IDK what's the MyGame example...)

     

    And congrats for your 1600th post! 

  14. Hello everyone.

    I'm working on a new demo for Twisted Minds and wanted to use decals for drawing a path on the floor. (See the screenshot below.)

    vlcsnap-2021-05-15-15h33m58s739.thumb.png.c553aef7516b532a0d7a19080c39eb39.png

    However, whenever the decal entity left the screen, the whole decal disappears. Here is a little video showing this problem.

    As you can see on the video, I set up the view range to infinite just to test and occlusion culling is disabled.

    I don't know what I'm missing, if I'm missing something, or if I'm not using decals correctly.
    Could anyone lighten up my lantern, please?

    Kindly, 
    Ttiki.

  15. Looks pretty good to me. I think all the blurriness is caused by the VM. 
    The checkmark and radio button mark are not high res, though. And the toggle button doesn't give much information about its state. The text lowers a bit, but that's all there is.

    image.thumb.png.c05be50c3a2af8dbe2ad2ba0f0e05d74.png

    Toggle off

     

    image.thumb.png.341a409414752a5dbdaf1f5bfbdae770.png

    toggle on 

     

    I used Ubuntu 20.04.1 LTS with GNOME version 3.36.8. 

  16. 8 hours ago, khotan said:

    No, I don't know... It is my first try in Lua for learning because I used before in C++ that work fine.

     

    How to setup for startup map in main.lua file ?

    When you launch Leadwerks, in your Script folder there is a file called Main.lua. In it you'll be able to change the name of your application's window and change the startup map.

     

    import("Scripts/Menu.lua")
    
    --Initialize Steamworks (optional)
    --Steamworks:Initialize()
    
    --Initialize analytics (optional).  Create an account at www.gameamalytics.com to get your game keys
    --[[if DEBUG==false then
    	Analytics:SetKeys("GAME_KEY_xxxxxxxxx", "SECRET_KEY_xxxxxxxxx")
    	Analytics:Enable()
    end]]
    
    --Set the application title
    title="TEMP" --Here, you can change the name displayed on the window.
    
    --Create a window
    local windowstyle = 0
    local winwidth
    local winheight
    local gfxmode = System:GetGraphicsMode(System:CountGraphicsModes()-1)
    if System:GetProperty("devmode")=="1" then
    	gfxmode.x = math.min(1280,gfxmode.x)
    	gfxmode.y = Math:Round(gfxmode.x * 9 / 16)
    	windowstyle = Window.Titlebar
    else
    	gfxmode.x = System:GetProperty("screenwidth",gfxmode.x)
    	gfxmode.y = System:GetProperty("screenheight",gfxmode.y)
    	windowstyle = Window.Fullscreen
    end
    window = Window:Create(title,0,0,gfxmode.x,gfxmode.y,windowstyle)
    if window == nil then
    	gfxmode = System:GetGraphicsMode(System:CountGraphicsModes()-1)
    	window = Window:Create(title,0,0,gfxmode.x,gfxmode.y,windowstyle)
    end
    
    --Create the graphics context
    context=Context:Create(window,0)
    if context==nil then return end
    
    --Create a world
    world=World:Create()
    
    local gamemenu = BuildMenu(context)
    
    --Load a map
    local mapfile = System:GetProperty("map","Maps/start.map") --Here, change Mpas/start.map by the name of your first map you want to load (or rename your first map start.map, your choice)
    if mapfile~="" then
    	if Map:Load(mapfile)==false then return end
    	prevmapname = FileSystem:StripAll(changemapname)
    	
    	--Send analytics event
    	Analytics:SendProgressEvent("Start",prevmapname)
    	
    	gamemenu.newbutton:Hide()
    	gamemenu.resumebutton:Show()
    	window:HideMouse()
    else
    	gamemenu:Show()
    end
    
    while window:Closed()==false do
    	
    	--Show game menu when escape key is hit
    	if gamemenu:Hidden() then
    		if window:KeyHit(Key.Escape) then
    			Time:Pause()
    			gamemenu:Show()
    		end
    	end
    
    	--Update events
    	while EventQueue:Peek() do
    		local event = EventQueue:Wait()
    		event = gamemenu:ProcessEvent(event)
    	end
    	
    	--Handle map change
    	if changemapname~=nil then
    		
    		--Pause the clock
    		Time:Pause()
    		
    		--Pause garbage collection
    		System:GCSuspend()		
    		
    		--Clear all entities
    		world:Clear()
    		
    		--Send analytics event
    		Analytics:SendProgressEvent("Complete",prevmapname)
    		
    		--Load the next map
    		if Map:Load("Maps/"..changemapname..".map")==false then return end
    		prevmapname = changemapname
    		
    		--Send analytics event
    		Analytics:SendProgressEvent("Start",prevmapname)
    		
    		--Resume garbage collection
    		System:GCResume()
    		
    		--Resume the clock
    		Time:Resume()
    		
    		changemapname = nil
    	end	
    	
    	if gamemenu:Hidden() then
    		
    		--Update the app timing
    		Time:Update()
    		
    		--Update the world
    		world:Update()
    		
    	end
    
    	--Render the world
    	world:Render()
    		
    	--Render statistics
    	context:SetBlendMode(Blend.Alpha)
    	if DEBUG then
    		context:SetColor(1,0,0,1)
    		context:DrawText("Debug Mode",2,2)
    		context:SetColor(1,1,1,1)
    		context:DrawStats(2,22)
    		context:SetBlendMode(Blend.Solid)
    	else
    		--Toggle statistics on and off
    		if (window:KeyHit(Key.F11)) then showstats = not showstats end
    		if showstats then
    			context:SetColor(1,1,1,1)
    			context:DrawText("FPS: "..Math:Round(Time:UPS()),2,2)
    		end
    	end
    	
    	--Refresh the screen
    	if VSyncMode==nil then VSyncMode=true end
    	context:Sync(VSyncMode)
    	
    end

     

    • Like 1
×
×
  • Create New...