Jump to content

Phodex Games

Members
  • Posts

    275
  • Joined

  • Last visited

Posts posted by Phodex Games

  1. 25 minutes ago, Josh said:

    camera->SetClearMode(Buffer::Depth);

    Thank you for the code snippet, but I am actually using lua and the method "SetClearMode" does not exist. I also tried it with C++, although I am not into it yet and have some trouble, but Visual Studio does not recognize the SetClearMode method either...

    also do I have to set it on camera 2 and 1? Because in your code its just camera.

    I would expect it to look like this in lua, maybe I did something wrong?

    local camera = Camera:Create()
    camera:SetClearMode(Buffer.Depth)

     

  2. 1 hour ago, Josh said:

    Yes. Just set the camera clear mode in the second world to only clear the depth buffer and it will work.

    Ok but how to exactly do this? Could not find it in the documentation yet.

    I am using the code snippet from here to play around with it: https://www.leadwerks.com/learn?page=API-Reference_Object_World_GetCurrent

    How can I tell both cameras to render at the same time?

    I tried camera:SetClearColor(0, 0, 0, 0)...

  3. Hi,

    I once was using an engine where you could set up scenes like leadwerks uses maps. It was possible to load multiple scenes at once and also have multiple cameras set up in those scenes. That came in handy for preventing first person hands to clipping through walls, or was used to set up UI, as in that engine you needed a camera to display UI. I wonder if something similar is possible in Leadwerks and how I would achieve it. Do I need to create multiple worlds? And how to load two seperate maps at the same time? What I want to do is creating a new UI system based on 3D models, therefore I need a camera to display them and I would like to overlay that scene, having an seperate camera & lightning. Would also be awesome for split screen. Any solutions or suggestions?

    Thanks for your input!

    Markus from Phodex Games

  4. Ok I found the solution myself. You need to do the following:

    local image = gui:LoadImage("path to texture")
    --
    local button = Widget:Button("", 0, 0, 1024, 768, gui:GetBase())
    button:SetString("style","Push")
    button:SetImage(image)

    But then the image appears in the middle of button. I fixed that by changing the drawing command inside the button.lua script.

    Still I wonder how it is possible to give my new button an automatic hover effect (e.g button is gets brigther) and disable the default rendered rectangle. I also wonder how to change the appearance of the UI, give it a new design etc. This topic is poorly documented, although the system is pretty cool and easy to work with. Would love to get some more input, tutorials etc.

    • Upvote 1
  5. Hi,

    I am currently trying to learn the leadwerks GUI, to be able to improve my own system. I already managed to display a button and make it print something on click. So my question is, how is it possible to load an image and apply it to an button instead of the default greay appearance? If found that there seems to be such a functionality inside the button.lua:

    --Draw image if present
    local image = self.widget:GetImage()
    if image~=nil then
      local imgsz = image:GetSize()
      gui:SetColor(0.7)
      gui:DrawImage(image,pos.x+(sz.x-imgsz.x)/2,pos.y+(sz.y-imgsz.y)/2)
    end

    I also found that "Image:Load(string path, GUI gui)" exists and should work loading an image from a texture. However Image:Load() does not seem to work in lua. I would have expected that applying an image would work like this:

    function Script:Start()
    	local gui = GUI:Create(context)
    	local guiScale = gui:GetScale()
    	local panel	= Widget:Create("", guiScale * 100, guiScale * 100, guiScale * 600, guiScale * 600, gui:GetBase(), "Scripts/GUI/Panel.lua")
    	self.textField= Widget:TextField("text", guiScale * 15, guiScale * 10, guiScale * 150, guiScale * 20, panel)
    	self.testButton	= Widget:Button("button", guiScale * 175, guiScale * 10, guiScale * 80, guiScale * 20, panel)
    	--APPLY THE IMAGE!
      	local image = Image:Load("Image.tex") -->Error Method "Load" does not exist for "Image"
      	self.testButton:SetImage(image)
    end
    
    function Script:ProcessEvent(event)
    	if event.id == Event.WidgetAction then
    		if event.source == self.testButton and event.data == 0 then
    			System:Print("Clicking")
    		elseif event.source == self.testButton and event.data == 1 then
    			System:Print("Hovering!")
    		end
    	end
    end
    
    function Script:UpdateWorld()
    	while EventQueue:Peek() do
    		local event = EventQueue:Wait()
    		self:ProcessEvent(event)
    	end
    end

    So how can I achieve that my button uses an image instead of the standard rect to be drawn?

    Thanks in advance :)

    Markus from Phodex Games

  6. @Yue Thanks for the feedback. Also consider to fill out this from, it helps me gathering more detailed feedback. Takes only a few minutes. You actually need a pretty good PC to run it smoothly. At least a low - medium end gaming pc. Running it on 12 FPS must be a pain :D. I will think about providing more languages, but first I will work on concepting a real game offering more gameplay depth. I have some cool ideas.

    Greetings to you as well :)

    • Upvote 1
  7. Hi there,
    I am very proud to finally present "Bladequest - The First Chapter" to you, which I secretly worked on for quiet a while now. I want to introduce myself to you and my welcome present for you is Bladequest - TFC and should be considered only a sneak peek of what is to come, its more like an interactive presentation, than a final full polished game, so please keep that in mind while playing. There is much more to come!

    I want to build a community of dedicated gamers which share their ideas and likings with me to provide them just the best and most addictive games. Especially important for me is atmosphere and the player identification with the game and its characters. To tell me your likings and preferencescheck this out!

    Bladequest is meant to show you, what I am able to do and what could be possible. It is currently lacking some features and content, but we can build upon it, whatever we like! Join my email list to stay in touch, share ideas and craft an epic game together. Let’s do it!

    Image_09.thumb.png.9cd486ea2268285312ec0fd8a3bcabb1.png

    CHECK THIS OUT TO READ MORE AND DOWNLOAD!

    • Like 2
    • Upvote 1
  8. Hi,

    so the final version of my project is ready and I want to release it. It also works fine on my computer, will also test it in my laptop as well. But on my friends PC there are some problems. It crashes without any error when changing options in the game menu (as it is using a file read/write command accessing a lua data file inside the game directory). It works if he starts the game as administrator, but then the game crashes with an "programm not working" error message from windows, when loading the first gameplay map. This could also be fixed by setting "Always start as administrator" to true in the exe settings. But I cannot expect from the user that he enables admin mode by manual in order to play the game, can I?

    So how can I handle this issue? Should i just set the exe to "run as admin" by default and deliever this with my installer? Does this even work? Or does windows reset this, especially if the files are packed into an installer file. Or do I need any kind of security certificate for releasing software on windows? I have not much experience on this subject.

  9. I recently found out that all this seems to get cause by the Time updating (one reason for the error seems to be stopping Time:Update() from getting called in the main loop), still I could not 100% fix this issue, still there is flickering, in the editor and ingame. I really want to fix it its literally the last thing I need to solve before the release version is finished.

  10. It seems that this gets caused if I do graphic changes ingame (for example adding/removing Post Effects). I therefore created a routine which resets the emitters (tried reset and pause/play), but still this happens. It even occurs with emitters without spritesheet, then there is no flicker, but the emitter bursts all particles at once which looks weird as well. Overall I have to say the emitters behave very unpredictable most of the time.

  11. Hmm no that does not work unfortunately, I only activated it in hope it would fix the issue maybe, but its still there, even in editor atm. Its weird because sometimes it just works and I changed nothing, seems to be some kind of bug :(. Maybe I have to use fire without animated spritesheet now.

    • Like 1
  12. Hi I encountered a weird problem with my particle emitters using animated spritesheets. This is how it looks like:

    As you can see it does work normally in the editor but ingame it has this weird flickering. I also have this behavior in the editor sometimes. It seems to appear randomly. In the editor, the flickering can mostly be fixed by disabling and enabling the emitter or by decreasing the particle count to 1 and then increasing it again to 2: I think this problem appears when changing graphic settings, as sometimes ingame it also works. It even happens that one emitter of the same kind works and another not.

    The sprite sheet image settings:

    Bug_03.PNG.4c8c23ff62c34067e94245dc5ef65683.PNG

    The Sprite sheet:

    Spritesheet.thumb.PNG.4b3a67ce336cd4662330e6ee779182c9.PNG

    Here the emitter settings:
    Bug_01.PNG.693002d8f86f27058375f96f6d84125f.PNG

    Bug_2.PNG.0728891624bedc7fa459252d3b34540d.PNG

    I tried the default and the smoothanimation shader for the emitter material. So what could cause this problem? This is one of the last bugs in my project and I would be gald to fix it soon :) Thanks for you input as always.

  13. I fixed the problem on my own now. After disabling various things and doing the map change in main loop I could nail down the problem. It was caused by many diffrent sources and turned out to be pretty complex, still could fix it luckily. Thanks for all who posted, your information was helpful indeed.e

  14. Hey :)

    its me again. I had a similar problem some time ago, but this time its diffrent and I still did not found a solid solution. So when I tried to load a new map like this,

    world:Clear()
    Map:Load("Map path") 

    it just crashes, without any error or anything. After some testing and deleting diffrent stuff step by step I got a object reference count error. This is pretty frustrating :(. Well I know its due to my code, but sometimes I lack some bascis as I learnt the whole coding stuff by myself. I nailed down the problem by trial and error. It seems to be my AI/Characters and weapons equipped to the player and the AI, had no energy yet to do deeper research on this. I am just wondering how you generally deal with such an issue. I have this problem very often, if I want to release an object it just crashes (for example it is playing an animation atm, or used elsewhere in code), so I need to fiddle around, using self.entity:Hide(), or do some workarounds to prevents this. I know there is self.entity:AddRef(), but how to best use this to prevent my game from crashing? I am a little bit helpless and so close to the release, I need to fix this! <_<

  15. @reepblue Thanks thats the information I needed :), but the problem now is that for some reason import does only work with pure string not put into a variable. But within my system I often used "dofile" to load self made data files, like sound profiles for various objects, which paths are stored in variables to be flexible. Is there any way you could do this? Otherwise I have some trouble :rolleyes:

  16. When I exported my project and started the exe file, just nothing happned, window doesnt even pop up. I nailed down the issue to some  "dofile" commands I am calling inside my main. The error does not seam to be within the files I am calling. It seems to be "dofile" in general. Running in Admin mode did NOT solve the issue by the way. So I fear this does not work due to lua sandbox is enabled after exporting is it? It would greatly help me if there would be a way to avoid this, otherwise I have to re-design all my code so it does  not need "dofile", which could get hard, especially with my save/load system.

  17. 1 hour ago, Josh said:

    However, I do not see evidence of anything wrong here. The framerate is stable after 40 minutes. If it really was leaking in a way that affected performance, you would continue to see a decrease over time. I think we can attribute the lower framerate after 20 minutes to your computer running some other task, or perhaps you just checked it at a moment when the garbage collector was running.

    Hmm I would not consider this as solved so quickly, because in my own project I experienced a drop from 60 to 40 and going down and it did not refresh, also when I am not wrong the 22 fps in the demo stayed and it was not just for a few seconds or so. Maybe I even messed up some screenshots, so the third one may be from another restart. The Problem is examining this problem takes some time. I am currently doing this. I will try System:GetMemoryUsage() and see if the memory goes up as well. I think I should put it to extreme and let it run for like an hour. I will respond again if I did that. I will also try running it in normal mode and just observe the fps without taking a look at memory. However, even if the demo level is alright, I still have to find the issue in my own project...

  18. Hi,

    I am in the final stage of the development of my game and now its time to bring the performance to a decent level. So I did some research and found out that over the time my framerate begins to drop from 60 - 40, maybe even further did not try it out. The effect is not so drastical if I put my player into an empty scene with no other objects and scripts running, but still existant and noticable. The results of my research showed that the script memory increases from time to time. Garbage collection happens, but still the memory is getting higher and higher. Of course I though it was due to my code and I had generated a memory leak, but then, when I tried the leadwerks build in FPS Demo Level I got a little nervous when I encountered the same issue. I tried to create a more extreme situation and started the level in Debug Mode and left it alone for about 30 minutes.

    First it looked like this:

     5ae34f7ca3d2f_FPSTestLevel2018-04-2717-43-24-56.thumb.jpg.94352ed3da52f50b927fb2d66d1f8c9c.jpg

    After 30 minutes:

    5ae34f8751917_FPSTestLevel2018-04-2718-14-37-67.thumb.jpg.b81bc737674979e140cb6a0d26a583a9.jpg

    After 40 minutes:

    5ae34f8bea5da_FPSTestLevel2018-04-2718-24-16-24.thumb.jpg.9c3d22b405aa4e55a0519617ffa2c41b.jpg

    When I took a closer look I saw that the Memory decreases, as the script memory increase, but for some reason that still meant an fps drop of about 8 frames. It recovers again over time. Also the memory usage went negativ? By the way I encounterd this behavior even on a empty map with only one camera...

    So several question come up to me, some specific to this problem some of more general nature. As I am very happy with the result of my project and it turned out very professional, I also want to provide a good performance for my audience, so I really would need some help, due to my limited knowledge in this sector, as I am no well trained sofware engineer :):

    1. What does the memory usage & script memory usage actually say ? I guess Mem usage is fonts, textures, etc. but what exactly is script usage? Is it how much RAM my code is taking?

    2. In which unit is the mem usage provided here? I would guess its in bytes?

    2. I this memory leak normal, or should I call it memory shift, as it seems to shift memory to the script usage?

    3. Can I overcome that memory leak and how, as it seems to negativly affect my framerate?

    3. If someone knows guides or information about optimizing lua code performance wise and how to overcome code bottlenecks it would be kind if you could share this with me :)

    This is what I have already read and found: 

    https://www.leadwerks.com/community/blogs/entry/1866-common-bottlenecks/

    https://www.leadwerks.com/community/topic/13854-performance-question/?hl=performance

    https://www.leadwerks.com/community/topic/6369-memory-leak/

    I encounterd some more problems, but I try to solve them by my self first, as I did not much research on them. I for example have some lights flickering or disappearing when it should not disappear, or my lightquality change during runtime still results in disabled lights. When I fail solving them you will hear from me again soon :D

    If you read so far I thank you very much and I really appreciate it, I hope I provided all needed information and all was clear to read and understand.

  19. Actually i was too curios about the UI system that i started to play around with it :). Its very interesting. Your tutorial is pretty helpful, as there is no other information, besides the documentation about it. You undestand that it will take a while till I understand all that code you send me, but its a great reference, really appreciate your help. Very nice of you :).

  20. Thanks for the effort man :) unfortunately I have no idea of the Leadwerks GUI system. I use my very own system, because back in the day there was no GUI system for LW and I never had time or felt to learn it as my own was getting better and better. But I guess I would benefit to learn it, so that I understand how GUI in general works and what the conventions are. For now I guess I will stay with my old system, as the effort would be insane to first learn the whole GUI system and then rebuild it for my project, especially as I am in the final stage of the project. So I will just stay with my normal healthbars ^^ I guess. But next time I will definetly try it out! I saw you have a tutorial series about it maybe that helps, but the for GUI system there are not many good tutorials and information yet...

×
×
  • Create New...