Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by Josh

  1. If you open up the FPSPlayer script you can see that the player itself will be passed into the Use() function: --Use the object, whatever it may be usableentity.script:Use(self) So you could add a value directly onto the player in your switch function: function Script:Use(player) player.disablemove = true if ShowedImage=="Yes" then ShowedImage="No" else ShowedImage="Yes" end end And then disable the player input in the FPSPlayer script if this value is set to true: if self.disablemove ~= true then if window:KeyDown(Key.W) then self.input[1]=self.input[1]+1 end if window:KeyDown(Key.S) then self.input[1]=self.input[1]-1 end if window:KeyDown(Key.D) then self.input[0]=self.input[0]+1 end if window:KeyDown(Key.A) then self.input[0]=self.input[0]-1 end end
  2. You would probably just want to add a variable to the player script like this: self.disableMovement = true And then add an if statement around the code that handles player input..
  3. Josh

    Particle Physics

    I made some changes to the design of the particle system. I am less concerned with the exact behavior of particles as they move around and move interested right now in building a system with good performance and deep physics interactions. Although I want particle behavior to be customizable, I don't think scripts are the right tool for the job. C++ plugins are better suited for this for two reasons. C++ is much faster, and particles are a system that will make heavy use of that. Lua scripts can't be run on separate threads. In Leadwerks Engine 4 we have basic particle collisions, but I wanted something more interactive in the new system. I move the particle update code into the physics thread. I implemented collision as well as the ability for particles to exert forces on other objects. Here's what happens when some slow-moving smoke particles interact with a scene: The lower platform rotates freely while the upper platform is motorized. When the particle velocity is increase they start to behave like a stream of water: Best of all, the speed is surprisingly fast. 4000 particles with collision update in just 2 milliseconds. The code scales well across cores so if you have a lot of CPU cores simulations with 100,000 particles are possible. Right now particles are processed in the physics thread, and get sent to the rendering thread for display, but right now the main thread actually never sees the individual particles. This is fast enough I think particles will default to full physics. Instead of just being a dumb visual effect we are going to have fully interactive fluids and gases. Flamethrowers can fill a room with fire and it will creep around corners to fill a space.
  4. Josh

    Beginning with Particles

    I see the "values" as being script-defined properties. I am offloading all the particle features and settings into Lua scripts so that there is no limit on the features particles can support..In LE4 we had fixed emission volumes, in the new engine you can add a script for a new emission shape of your own, or whatever you want. Does that make more sense now?
  5. I wanted to work on something a bit different, and this sure is different. I've got a framework of a new particle system worked out. What's really special about this system is the amount of interactivity the particles will allow. Particle-world collisions. Particle-particle collisions (repulsion) Particle-particle cohesion (fluids with surface tension) Instead of just being a visual effect, I want our new particles to be fully interactive with physics so that particles can exert forces on objects. This will allow you to simulate fluids, smoke, and other effects in a realistic manner, not just dumb collision of particles bounding off walls. It should even be possible to simulate hydrophobic and hydrophillic liquids if you mix two together with different cohesion values. Basically what I want is something like Nvidia Flow on the CPU and exerting forces on the world. So if you had water falling on a water wheel the wheel would move because of the forces, or a blast of wind could knock objects over without any special force fields or other fake effects. I also have a technique worked out that will allow lighting of clouds and other masses of gas, with back-scattering. Emitters can be instanced so if you have one really high-quality torch effect, for example, you can instance it and use it as much as you like without any additional computational cost per instance. Particle emitters can be controlled with a Lua script or C++ actor. Two new functions are available, UpdateParticle() and EmitParticle(). Here is a script that controls particle behavior over time: entity.particleVelocity = Vec3(0,0,1) entity.particleAcceleration = Vec3(0,-1,0) entity.inverseSquareFalloff = true entity.particleRadiusBegin = 0.1 entity.particleRadiusEnd = 0.2 entity.particleColorBegin = Vec4(1,1,1,1) entity.particleColorEnd = Vec4(1,1,1,0) entity.particleMass = 1 entity.particleSpin = 5 function entity:Start() self.particleColorBeginHSL = HSL(self.particleColorBegin.rgb) self.particleColorEndHSL = HSL(self.particleColorEnd.rgb) local emitter = Emitter(self) if emitter == nil then return end local n for n = 1, #emitter.particles do emitter.particles[n].mass = self.particleMass emitter.particles[n].falloff = (n-1) / (#emitter.particles - 1) end end function entity:EmitParticle(index) local emitter = Emitter(self) if emitter == nil then return end emitter.particles[index].position = self:GetPosition(true) emitter.particles[index].velocity = TransformVector(self.particleVelocity,self,nil) emitter.particles[index].radius = self.particleRadiusBegin emitter.particles[index].color = self.particleColorBegin end function entity:UpdateParticle(index) local emitter = Emitter(self) if emitter == nil then return end emitter.particles[index].velocity = emitter.particles[index].velocity + self.particleAcceleration / 60 local falloff = emitter.particles[index].falloff if self.inverseSquareFalloff then falloff = falloff * falloff end emitter.particles[index].color.rgb = RGB(self.particleColorBeginHSL * (1 - falloff) + self.particleColorEndHSL * falloff) emitter.particles[index].color.a = self.particleColorBegin.a * (1 - falloff) + self.particleColorEnd.a * falloff emitter.particles[index].radius = self.particleRadiusBegin * (1 - falloff) + self.particleRadiusEnd * falloff emitter.particles[index].rotation = emitter.particles[index].rotation + self.particleSpin / 60 end A different script could be used to make particles emit from vertices of a model, to make the model appear to be on fire, or other effects. This will allow infinite customization to create any behavior you want. Particle physics will be calculated on the physics thread so I expect them to be very fast.
  6. I quit the web cold-turkey, outside of this website and here is what I notice: Movies, music, and games, in physical formats, are very interesting again, like they used to be. I discovered an interesting mod for S.T.A.L.K.E.R. by browsing through game DVDs. I never would have found it looking online because I don't want to search through uncurated piles of trash. The idea of subscribing to a newspaper (Wall St. Journal) or magazine is actually pretty appealing. It gives you a bit of intellectual stimulation in just the right dosage. I have a much much better mood every day. Digital content delivered over the web results in an overload of information, combined with a race to the bottom in terms of quality. You can see this happening in real-time on Steam. Tool didn't even bother to release a real CD with their recent album, and the album is also really sub-optimal quality. The whole "streaming" thing seems ridiculous to me. Instead of exchanging money for a product, you are giving money so that a computer can be set up somewhere that will dynamically deliver the correct bits to your computer, while their legal team maintains licensing agreements with the content owner, until the day comes that one of those things stops happening. Yes, just about anything you want offline can be found online, but it's going to be a crappy version of what you could get offline. Streaming movies always freeze up, the sound is bad quality, you might have some weird subtitles you can't turn off. The whole experience is like looking at everything through really dirty goggles. Everything feels poorly put together like it might fall apart at any moment or be taken away. So although physical media has / is taking a huge hit, it seems like online content is on really a self-destructive path. I would not be surprised if the web turns into a garbage bin of mountains of data no one ever looks at, and owners just start pulling the plug on a lot of stuff. I don't know, but there is definitely something strange happening. I feel like everything in the consumer space has been exhausted and something big is going to change. It takes a bit of discipline to get through the first couple of weeks but it is so much better. I have the same feeling now that I have not had since the late 1990s. I can't force the rest of the world to do the same, but for my own life I feel like life offline is 1000% better.
  7. Josh

    Sprite Layers and the GUI

    Maybe it is being called somewhere else? I can’t tell without seeing the full program.
  8. Josh

    Sprite Layers and the GUI

    Just call GetEvent to retrieve the next event in the queue. If it is a mouse or hey event you can pass it straight to the GUI processEvent method.
  9. Josh

    Sprite Layers and the GUI

    gui->ProcessEvent() will send the event to the appropriate widget it effects. Those widgets may then emit an event for the widget action, which can be detected in the main event handling code like in your example above. So mouse and key events get send into the GUI and then may result in new events being generated. The reason it is done this way is it gives you precise control over the raw input, so you can do a 3D in-game GUI and control how the mouse events work.
  10. Josh

    Voxel Code

    In LE4 use Entity->Release(); In LE5 just set the variable to NULL. Frustum and occlusion culling are built-in. Surfaces can be cleared and re-built, but faces cannot be removed in LE4. In LE5 you can modify the vertex and indice arrays and then call Mesh->Finalize().
  11. Josh

    2D Drawing to Texture

    Here is what I came up with: void Camera::SetRealTime(const bool realtimemode) void Camera::Refresh() Refresh will cause a non-realtime camera to render once before it is disabled automatically, until the next refresh.
  12. Technically, 4,294,967,295 vertices is the max. But there will be a limit lower than that depending on your hardware. Very roughly I would aim for no more than 10,000-20,000 polys for any particular model.
  13. LE5 beta updated. Added 3D GUI example, missing newton double float lib.

  14. Josh

    3D GUI

    Putting all the pieces together, I was able to create a GUI with a sprite layer, attach it to a camera with a texture buffer render target, and render the GUI onto a texture applied to a 3D surface. Then I used the picked UV coords to convert to mouse coordinates and send user events to the GUI. Here is the result: This can be used for GUIs rendered onto surfaces in your game, or for a user interface that can be interacted with in VR. This example will be included in the next beta update.
  15. GUI is working in 3D space. Never did this before.

    1. gamecreator


      How much of these new features are a challenge you enjoy versus a frustrating necessity?

    2. Josh


      The features are pretty fun actually. I planned all this out to have this specific functionality work. Vulkan has been some of the most frustrating difficult stuff I have ever worked on (not as bad as Android / iOS stuff though) but the hard part of that is through I think.

  16. Josh

    Voxel Code

    If you keep developing this I would be interested in licensing the code to add a Minecraft-type game template to the new engine.
  17. A dynamic cast will return NULL if the conversion is not valid. (A static cast can potentially return an invalid object.) So you might want to also check if the result of the cast is NULL before continuing.
  18. Cast the Actor object to your custom actor object and the function will be available. See C++ dynamic casting.
  19. Both of those code examples do the exact same thing.
  20. Do you want a Lua or C++ function to be called?
  21. Josh

    Voxel Code

  22. I don’t mean to pick on you in particular but this is the sort of thing I mean. It sounds like the things you read online are making you unhappy and affecting your life in a negative way.
  23. A low-carb diet is healthy. What I am saying is they start with something valid, but the tendency is for these thing to grow into an all-encompassing belief system.
  24. A friend recently told me they deleted all their social and forum accounts for no particular reason. They just didn't want to be online anymore. It got me thinking. The common view of the Internet is that it is a digital mirror of the real world, and the sum of all human knowledge. This is not true. In the late 1990's Internet message boards were a novel thing. You could discuss various interests online and it was interesting and organic. Now most interaction has been channeled into a few big platforms, and I don't think that is the case today, and it has not been for many years. Outside of some technical topics, I think the Internet has become: Corporate and government(s) astroturfing, probably a great deal of which is generated by AI MLM marketers and cult leaders. (The former is monetized and the latter is not.) Mentally ill compulsives posting variations of the same joke on YouTube over and over. When I think about the intelligent wise people I know in my life, none of them ever write anything online, and I never find their good advice online, about anything. Instead, I see various cults for health, fitness, money, politics, business, every aspect of life you can imagine, and all of it is very bad advice that has nothing to do with reality. For example, for something as simple as food, there is a cult for eating meat. There is also a cult for not eating meat. Humans throughout history have always had some vulnerability to this type of thinking, but it seems like these things are arising faster than ever before in history, and it is totally drowning out normal organic conversations. One sign is if they have their own made-up terms or acronyms for anything, it is probably all bullshit. The only sources of information I have ever found useful in my life are: Other people I have conversations with in real life. My own intuition. Some books. I am saying we are going back to a time before the Internet, because the only people spouting their ideas are the mentally ill. In reality, we have probably been there for 5-10 years. Outside of technical information or booking a hotel, I think it is time to turn off the Internet as much as you can. Now is a good time to read some books, pray or meditate, and pay attention to the people around you. Avoid people who seem like they are getting sucked into some kind of ideological framework or health fad of any kind, or at least call them out on it. I have seen this in several people I know in my life. Having a head full of nonsense is worse than ignorance. By reading the content that is on the Internet, you are not becoming more informed. You are becoming more neurotic.
  25. Josh

    2D Drawing to Texture

    That is actually something I will have to figure out for the editor, too.
  • Create New...