Jump to content

Phodex Games

Members
  • Posts

    275
  • Joined

  • Last visited

Posts posted by Phodex Games

  1. For all those facing the same problem, its actually pretty easy. Log into the steam backend and set up an achievement like so:

    image.png.cf0a5661de425eef8b333782b04b4833.png

    Then in leadwerks, if you use lua, just call Steamworks:Initialize() in the main.lua at start. To set an achievement active do this:

    Steamworks:SetAchievement("STORY_COMPLETE")
    --And thats all :)

    Two things to keep in mind and which confused me are:

    1. Steam may take a while to display your achievements after you published them, so wait until you see them displaying in the steam store, or when you click on the game in your library.

    2. The achievement unlocked popup, will NOT show up while ingame, you only see after you closed the game and an achievement has been unlocked.

    There are also progressive achievements but the work pretty similar.

    Little tip: As those functions are not documented, activate auto complete for the Leadwerks IDE and type "Steamworks:" it will display all available functions.

    Good Luck :)

    • Like 1
    • Thanks 4
  2. Hi,

    I want to add steam achievements to my game, but I only found very old threads about the topic. I can't really get it running. I am trying to do this with lua by the way.

    So I set up a few achievements and published them in the steamworks backend, then after I called Steamworks:Initialize() in my game I just call Steamworks:SetAchievement(API Name as string) to unlock an achievement right? This does not work for me, and the function is also not documented. Am I doing something wrong?

    Thanks!

    EDIT: Ok solved, I think it does not work with my developer account and the achievement unlock message seems to only be displayed after I closed the game again.

    • Thanks 1
  3. 7 hours ago, Marcousik said:

    I imagine like you let it play a sound:

    local video = Video:Load(path)

    video:Play()

    I actually build a something like this for my own UI system, using the theora library and some old code I found in the forums. I wanted to put it to the marketplace actually, but it does not play audio yet, so you would need to play the audio externally with Sound:Play(). Also as far as I remember the quality was not that good, but maybe it was just because of the video conversion to ogg.

    If there is a demand I may consider working on this again and bring it to the marketplace as part of the phodex framework :)

     

     

    • Upvote 1
  4. Ok so I found a workaround for the issue. It actually works pretty good so far, still its not ideal, and I just tested it for a single non-prefab object with no parent, but it is at least something. A Physics:Refresh() function maybe would be a good idea? But thats just my unprofessional opinion.

    function Script:Start()
    	self.startPos = self.entity:GetPosition(true)
    end
    
    function Script:UpdateWorld()
    	if self.moved then
        	--Move the object one frame after I gave it mass then remove the mass and set it back to scene collision
    		self.entity:SetPosition(self.startPos.x + 15, self.startPos.y, self.startPos.z, true)
    		self:SetMoveMode(false)
    	end
    	if keyHit.K then
    		self:SetMoveMode(true)
    		self.moved = true
    	end
    end
    
    function Script:SetMoveMode(state)
    	if state then
    		self.entity:SetCollisionType(Collision.Prop)
    		self.entity:SetMass(10)
    	else
    		self.entity:SetCollisionType(Collision.Scene)
    		self.entity:SetMass(0)
    	end
    end

    Future will show if this will also work for my more complexe scene...

     

    EDIT: @mdgunn Just saw your reply. Yeah my sentence was a little weird. I meant that with this method, all of my objects will have dynamic physics, and objects (like wodden planks) I place on the roof of a room will fall to the ground when mass is enabled. However as you can see above I found a solution, at least for the moment.

  5. 8 hours ago, mdgunn said:

    I've never yet seen the physics break if I have an item with mass

    Ah yeah the new cube I created in your scene had 0 mass actually. It does actually work with mass > 0. The problem is if I set mass to my scene object then it sometimes just falls through the ground (which by the way is why I did not set a mass), or it behaves like a dynamic physics object, which I not want, I maybe have some wodden planks at the ceiling and don't want them to fall on the ground ^^.

    8 hours ago, mdgunn said:

    Do you need to move bits of your dungeon after you place them

    Well I have different room layouts & different prebuild furnishing sets. A few rooms are preloaded and then everytime you exit a room an new one gets loaded and placed at the right position. This works in the first place, but I experienced that after a certain number of rooms, the collison of some objects are broken (so far just the furnishing objects, not the room itself were affected).

    8 hours ago, mdgunn said:

    Why not have the bits HAVE mass and sit them on an underlying 'scene floor' that does not move?

    Could you explain this a little more? As explained about arent my objects flying around with mass enabled? How would you created the scene floor and not make him move?

    By the way, thanks for you help :D its actually one of the last things I need to get done before I can release it...

  6. 14 hours ago, mdgunn said:

    Strange, I tried self.startPos.x + 5 instead of +1 and it goes back and forth multiple times fine still.

    I downloaded your files. First it worked, but when I created a new cube and changed it to +15 it did again not work. I now also experienced, when changing back to +5 with another cube that just the front of the box had physics and I can walk inside the cube from the sides. Play around with different pos values (like +5 +15 +25) and you will see the physics break again...

  7. 18 minutes ago, Josh said:

    or will end up creating something other than what was described.

    Well ok I guess you are right. I just meant I need like 5 minutes to setup a scene like this. I know you are busy and I appreciate you take the time... 

    I attached a test project. Just open the start.map. If you press "K" the box moves and you can walk through the box. Now the question is how to move it without breaking the physics.

    TestLevel.zip

  8. 17 minutes ago, Josh said:

    If you upload an example I can try then I can determine what's going on.

    Well to see the problem I am explain I would need to upload my whole project, which is relatively large. If I have time I can try reproducing the error in a smaller setup and upload it here. But as the tests with the box results in the same behavior (disabled physics when setting position after an entity is spawned) I though it is actually the same error as with my more complex scene... Sorry I don't understand why the setup I and mdgunn described is not enough to examine the problem...

    I mean the question still remains, how to change an objects position with static scene phyiscs after its placed in scene. I see no solution yet. I understand that it has to do with the physics engine not updating the new position of the object, but what to do against it?

  9. 24 minutes ago, Josh said:

    However, you can call SetPosition or Move once and the collision will work after that

    Yeah this explains why, in my actual setup, the physics breaks when the prefab is loaded the second time and placed in the scene. At one point I release a room and load another one. When a prefab is loaded in the scene the second time and position is changed physics are broke. You are talking about "continuously" calling this, but I am actually not. I just call it once after a prefab is loaded. 

  10. 1 hour ago, mdgunn said:

    actual problem which really seems to relate to PREFABS

    Yeah I first thought Prefabs are the problem as well, BUT thats why I set up the test scene with a normally placed box with same conditions as my prefab objects (Scene physics and 0 mass). This is a summary of what I have tested and what happend, again this is a normal object placed in the editor. No Prefab. I think if I find a solution for moving this object I can use the same for my prefabs:

    • SetPosition breaks the collision of the object
    • Move breaks the collision of the object if used twice
    • Joint:Kinematic does not work for static physics objects (I also think it makes no sense to use a joint for a static object...)

    I know Prefabs are a little weird sometimes, but currently its about a normal object, although I use prefabs in my actual situation. I wonder this problem didn't occur for sombody else yet, it think changing an objects position should be used every now and then...

    The weird is that in my actual setup the physics just break for models, but not for csg brushes, under different circumstances however, which are a little hard to explain right now, the csg brushes physics broke aswell. 

  11. 6 hours ago, mdgunn said:

    Try....

    Thanks for the code, it actually works, but that is not what I actually want. This slowly moves the object in place. I just want to spawn a new object and set its position. And I also don't want to have a object with mass, or dynamic physics. I simply want to change the position of  a static object (scene physics and 0 mass). Imagine something like this:

    function Script:SpawnObject()
    	--the object has scene physics and 0 mass
      	self.obj = Prefab:Load("Prefabs/Object.pfb")
    	self.obj:SetPosition(x,y,z)
    end

    The above code sometimes breaks the newly spawned objects physics as mentioned earlier. Using a joint does not seem to be an option. I dont want my object to slowly move towards its spawn position.

    I could provide a test proejct, but the behavior can be reproduced so easily. Just take a csg brush, scene physics on, 0 mass. Now try to change its position & test the collision with a player controller.

  12. On 9/27/2018 at 10:23 PM, Josh said:

    The above code should work

    It somehow does not. This is what I have:

    image.thumb.png.21c2dde8df0643019899fb3234de8979.png

    This is what the attached code:

    function Script:Start()
    	self.joint = Joint:Kinematic(1, 1, 1, self.entity)
    end
    
    function Script:UpdateWorld()
    	if keyHit.K then
    		self.joint:SetTargetPosition(300, 2, 0, 1)
    	end
    end

    It does not even move slightly, but even if. I just want to set the position of a static scene object. Why should I need to use a joint for that, I would expect set position to work for a static physics object. I really need this to work, otherwise you can just randomly walk through objects...

  13. 1 hour ago, Josh said:

    There is no motor so you don't have to worry about that. 

    Yeah I just tried that because it did not work. Hmm I still can't get it work. What am I doing wrong?

    function Script:Start()
    	self.joint = Joint:Kinematic(1, 1, 1, self.entity)
    	self.joint:SetTargetPosition(300, 2, 0, 1)
    end

    Shouldn't this code change the position of my object? Could you give me an example code how to move a physics object with this? And does the object need a mass or specific collision setting?

  14. 2 hours ago, Josh said:

    The kinematic joint will allow you to precisely control the orientation of an object with physics forces

    Ok I wonder how to use this for my purpose now. I tried this code but my object does not move at all:

    function Script:Start()
    	self.joint = Joint:Kinematic(0, 0, 0, self.entity)
    	self.joint:EnableMotor()
    end
    
    function Script:UpdateWorld()
    	if keyHit.K then
    		self.joint:SetTargetPosition(150, 2, 0, 0)
    	end
    end

    I don't really need continually change of an physics object. I am currently building a random dungeon generator and the systems loads in prefabs and sets them in place to generate a new room. All objects have Scene physics with no mass (And I think the joint does not work with 0 mass, does it?). I experienced that in some rooms some objects have no physics anymore (seems to be random). So the set position command is only used once after the prefab is loaded. The example shown here with the box was just to examine the behavior. So I need a solution how I can move my rooms & furnishings without losing the physics...

  15. Ok so I am just testing this. You can easily recreate this yourself. I created a csg box with following settings:

    image.png.87c65ab2cb394b54cc0b809c880f12dc.png

    And attached this script to it:

    image.png.243c7f3e12b8c5edd0c7a620add0290e.png

    (Its using my key manager so don't wonder) First my player collides with the csg box but after the SetPosition command I can walk through. I will try to work around the issue and examine this behavior. If I find a solution I will post it here.

     

    EDIT 1: This does not happen when the object is set to prop physics AND has a mass (prop with 0 mass has the same behavior as scene). With scene physics & mass the object falls through the ground. But I NEED to move a scene object with static physics...

    EDIT 2: I though Move was at least working, but if all this is not weird enough now if I use Move more then one time the physics get disabled again.

    EDIT 3: So the idea now was to first set the entities mass to something greater than 0 and then change it back to 0. If other to expect this did not work, something more weird is need to be done to make this work. The code below did actually work and I can now set the physics object position, but because the mass reset to 0 happens one update later the object can move a tiny bit through physics (I could decrease this to a minimum by using a minimal mass).

    function Script:UpdateWorld()
    	if self.posChanged then self.entity:SetMass(0) end
    	if keyHit.K then
    		self.entity:SetMass(10)
    		self.entity:SetPosition(15, 2, 0)
    		self.posChanged = true
    	end
    end

     

  16. Could be difficult to share, but you can easily achieve the same error I guess when creating a simple box with physics, make it a prefab, load it and set the position of it on button press. Then you just need something to test the collsion (e.g FPS Player). At the start the physics should work but if you change the position you should be able to walk through the box. But sometimes the error does not occur so you may not be able to reproduce it. I currently will finish some other aspects of my project and will come back later to this bug. Hope to gather some information here. I will try some stuff when I have time and maybe share a setup where the problem appears, however thanks for you answer.

  17. So I think this is a bug. When I load a prefab with physics on, it works in the first place and my player can collide with the object (Collision set to scene and physics to rigid body). If I change the position however the physics is disabled and I can walk through the object. Changing the position again did sometimes turn the physics on again. This is some of the weird behavior I every now and then encounter with Leadwerks :(, especially with Prefabs. This did not happen when using the "Move" function instead of SetPosition. How could I fix this? I need to change the positon of an physics object during runtime...

  18. 5 hours ago, Argent Arts said:

    You can use any color for the areas you do want emission

    Ok thank you :) I tried it and it works, but is there a way to increase the radius/intensity of the emission?

    @Josh Thank you, good to know! I found the tessellation_example.mat which explains this shader so now I only need to know about how to use the parallax and env (which stands for enviorment map I guess) shader. Some example materials like the tessellation example for those would be a good idea I guess.

     

  19. Hi just want to report two bugs.

    I have version 4.5 beta. When I start Leadwerks it crashes sometimes with no reason and if I restart it, it just works. Leadwerks also crashes sometimes when doing something as simple as parenting two objects. I also heard this random crashing behavior from others and I think thats some of the larger flaws Leadwerks has and should be fixed. Leadwerks should at least do a backup save of your map when it crashes (I know there are normal backup saves). Second is something more precise. If you get a CSG brush via "FindChild" in lua and apply "SetScale" to it the application will stop running with no error message. Ah and now I remember one more bug. If you unparent bones/objects from an objects hierarchy in the editor and remove the main object, you can't remove the former child. 

    Hope this helps fixing. Hope at least the crashing gets less with the final release of 4.5.

×
×
  • Create New...