-
Posts
7,936 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by Rick
-
I think we're being asked to give our number 1 priority. If we could select multiple most people would probably select everything, but Josh has to focus on only a couple of main priorities at a time. He can't do them all right now. So he's asking us to rank what we think is priority.
-
I think 3D GUI would be sweet. I did some of this for my game and it works out great as it scales without having to do any extra work with caring about screen resolution and it scales well visually I thought.
-
Thx Shadmar
-
Does the Leadwerks license include later versions?
Rick replied to OutragedSuburbanAmerican's topic in General Discussion
Older versions of LE (2.x specifically) requires a more powerful PC than the current Leadwerks 3. -
That's if you choose to attach a script to it. I don't think being able to loop over all loaded entities is much to ask really. Pretty common task.
-
I think CSG can stay but I think we all thought it would be the same as any other model and we wouldn't have these differences. I hope CSG being equal with other models in how they behave is on the road map.
-
I didn't even know the particle editor existed Nice!
-
A restart of the editor seems to fix the problem so thinking it's not stuck keys. It also only happens in the editor and no other programs.
-
I created a prefab of a player, where I attached the AnimationSequence script to it. Then in App.lua file I load the prefab in App:Start(). In App:Loop() I call it like: self.player.animationmanager:SetAnimationSequence(1, 30, 200) Where self.player is the prefab I loaded. I get an error when this function is called saying self.animations doesn't exist. The Script:Start() does get called, which creates the self.animations table, so not sure why the table isn't there when SetAnimationSequence() gets called, but seems it's somehow not. Seems like the scripts variables don't hold after Script:Start() for some reason.
-
I don't know how I do it, but almost always if I work long enough in the editor, left click in the objects, assets, scene tab registers as a right click and brings up the popup menu.
-
Missed this, but in LE2 the way I was doing classes was: Bubble = {} Bubble_mt = {} Bubble_mt.__metatable = Bubble Bubble_mt.__index = Bubble Bubble = setmetatable(Bubble, Bubble_mt) function Bubble:New() local obj = {} table.CopyFromTo(self, obj) --obj.color = color obj.sphere = CreateSphere(32) --obj.sphere:SetKey("color", colorNumber) --obj.tmrTurnOff = Timer:New(250) --obj.tmrTurnOff:AddEventHandler(obj, self.TurnOff) obj.sphere:SetScalef(.125, .125, .125) obj.sphere:SetColor(Vec4(1, 0, 0, 1)) return obj end function Bubble:Update() --self.tmrTurnOff:Update() --self.sphere:Turnf(1, 1, 1) end function Bubble:TurnOn(silent) --if silent == false then --PlaySound(self.sound) --end --PaintEntity(self.cube, self.onMaterial) --self.tmrTurnOff:Start() end function Bubble:TurnOff(tmr) --PaintEntity(self.cube, self.offMaterial) --tmr:Stop() end A template for new classes could be made very easily like this with a "Create Class" option for the Lua editor. Could help the Lua programs from making everything global and all in 1 file. When games start getting bigger in Lua and aren't using the entity scripts, using classes like this will help organize it better.
-
To Replicate: 1) Create Lua project 2) Create 'prefabs' folder in assets tab 3) Create a cube, set it's physics to character controller, save as prefab named 'player' (the issue isn't prefab related but this will work with the code below 4) Open App.lua and remove everything and copy the code below and paste it in 5) Run the game and notice that unless you are moving the rotation of the character controller doesn't work --This function will be called once when the program starts function App:Start() --Set the application title self.title = "Z Is 4 Zombie" --Create a window self.window = Window:Create(self.title) self.window:HideMouse() --Create the graphics context self.context = Context:Create(self.window, 0) if self.context == nil then return false end --Create a world self.world = World:Create() --Load a map local mapfile = System:GetProperty("map", "Maps/start.map") if Map:Load(mapfile) == false then return false end self.camera = Camera:Create() self.camera:SetFOV(70) self.playerLight = SpotLight:Create() self.playerLight:SetIntensity(3) self.cameraRotation = Vec3() self.player = Prefab:Load("Prefabs/player.pfb") self.moveSpeed = 3 self:CameraFollow() return true end function App:CameraFollow() -- over the shoulder view self.camera:SetPosition(self.player:GetPosition()) self.camera:SetRotation(self.player:GetRotation()) self.camera:Move(.75, 1.8, -1) self.camera:Turn(0, -5, 0) local camY = self.camera:GetRotation().y self.camera:SetRotation(self.cameraRotation.x, camY, 0) -- a light so the player model stands out self.playerLight:SetPosition(self.player:GetPosition()) self.playerLight:SetRotation(self.player:GetRotation()) self.playerLight:Move(3.75, .75, 0) self.playerLight:Turn(0, -90, 0) end function App:UpdateGame() local move = ((self.window:KeyDown(Key.W) and 1 or 0) - (self.window:KeyDown(Key.S) and 1 or 0)) * Time:GetSpeed() * self.moveSpeed local strafe = ((self.window:KeyDown(Key.D)and 1 or 0) - (self.window:KeyDown(Key.A) and 1 or 0)) * Time:GetSpeed() * (self.moveSpeed * .66) -- get the mouse movement local currentMousePos = self.window:GetMousePosition() local mouseDifference = Vec3() mouseDifference.x = currentMousePos.x - 100 mouseDifference.y = currentMousePos.y - 100 -- adjust and set the camera rotation local tempX = self.cameraRotation.x + (mouseDifference.y / 15) if tempX > -25 and tempX < 25 then self.cameraRotation.x = tempX end self.cameraRotation.y = self.cameraRotation.y + mouseDifference.x / 15 self.window:SetMousePosition(100, 100) self.player:SetInput(self.cameraRotation.y, move, strafe) end --This is our main program loop and will be called continuously until the program ends function App:Loop() --If window has been closed, end the program if self.window:Closed() or self.window:KeyDown(Key.Escape) then return false end --Update the app timing Time:Update() --Update the world self.world:Update() self:UpdateGame() self:CameraFollow() --Render the world self.world:Render() self.context:SetBlendMode(Blend.Alpha) self.context:DrawText("Cam Rotation Y:"..self.cameraRotation.y, 0, 0) -- draw crosshairs self.context:SetColor(1, 0, 0, 1) self.context:DrawLine(self.context:GetWidth() / 2, (self.context:GetHeight() / 2) - 15, self.context:GetWidth() / 2, (self.context:GetHeight() / 2) + 15) self.context:DrawLine((self.context:GetWidth() / 2) - 15, self.context:GetHeight() / 2, (self.context:GetWidth() / 2) + 15, self.context:GetHeight() / 2) self.context:SetColor(0, 0, 0, 1) self.context:SetBlendMode(Blend.Solid) --Refresh the screen self.context:Sync() --Returning true tells the main program to keep looping return true end
-
This is in Lua now, but here is the entire code. You could just make a cube or something and give it a character controller physics body then save it as a prefab called player. You'll have to make a 'prefabs' folder also right off the base and the code should run as is then. I just created a little csg floor to test on. --This function will be called once when the program starts function App:Start() --Set the application title self.title = "Z Is 4 Zombie" --Create a window self.window = Window:Create(self.title) self.window:HideMouse() --Create the graphics context self.context = Context:Create(self.window, 0) if self.context == nil then return false end --Create a world self.world = World:Create() --Load a map local mapfile = System:GetProperty("map", "Maps/start.map") if Map:Load(mapfile) == false then return false end self.camera = Camera:Create() self.camera:SetFOV(70) self.playerLight = SpotLight:Create() self.playerLight:SetIntensity(3) self.cameraRotation = Vec3() self.player = Prefab:Load("Prefabs/player.pfb") self.moveSpeed = 3 self:CameraFollow() return true end function App:CameraFollow() -- over the shoulder view self.camera:SetPosition(self.player:GetPosition()) self.camera:SetRotation(self.player:GetRotation()) self.camera:Move(.75, 1.8, -1) self.camera:Turn(0, -5, 0) local camY = self.camera:GetRotation().y self.camera:SetRotation(self.cameraRotation.x, camY, 0) -- a light so the player model stands out self.playerLight:SetPosition(self.player:GetPosition()) self.playerLight:SetRotation(self.player:GetRotation()) self.playerLight:Move(3.75, .75, 0) self.playerLight:Turn(0, -90, 0) end function App:UpdateGame() local move = ((self.window:KeyDown(Key.W) and 1 or 0) - (self.window:KeyDown(Key.S) and 1 or 0)) * Time:GetSpeed() * self.moveSpeed local strafe = ((self.window:KeyDown(Key.D)and 1 or 0) - (self.window:KeyDown(Key.A) and 1 or 0)) * Time:GetSpeed() * (self.moveSpeed * .66) -- get the mouse movement local currentMousePos = self.window:GetMousePosition() local mouseDifference = Vec3() mouseDifference.x = currentMousePos.x - 100 mouseDifference.y = currentMousePos.y - 100 -- adjust and set the camera rotation local tempX = self.cameraRotation.x + (mouseDifference.y / 15) if tempX > -25 and tempX < 25 then self.cameraRotation.x = tempX end self.cameraRotation.y = self.cameraRotation.y + mouseDifference.x / 15 self.window:SetMousePosition(100, 100) self.player:SetInput(self.cameraRotation.y, move, strafe) end --This is our main program loop and will be called continuously until the program ends function App:Loop() --If window has been closed, end the program if self.window:Closed() or self.window:KeyDown(Key.Escape) then return false end --Update the app timing Time:Update() --Update the world self.world:Update() self:UpdateGame() self:CameraFollow() --Render the world self.world:Render() self.context:SetBlendMode(Blend.Alpha) self.context:DrawText("Cam Rotation Y:"..self.cameraRotation.y, 0, 0) -- draw crosshairs self.context:SetColor(1, 0, 0, 1) self.context:DrawLine(self.context:GetWidth() / 2, (self.context:GetHeight() / 2) - 15, self.context:GetWidth() / 2, (self.context:GetHeight() / 2) + 15) self.context:DrawLine((self.context:GetWidth() / 2) - 15, self.context:GetHeight() / 2, (self.context:GetWidth() / 2) + 15, self.context:GetHeight() / 2) self.context:SetColor(0, 0, 0, 1) self.context:SetBlendMode(Blend.Solid) --Refresh the screen self.context:Sync() --Returning true tells the main program to keep looping return true end
-
Below is some code that controls my character controller. It's pulled from Aggror's tutorial and modified slightly. The problem is if I'm NOT moving I CAN'T rotate the controller. If I'm moving I can rotate the controller just fine. What am I missing? I draw to screen the self.cameraRotation.y variable and I see it changing when I move my mouse, but the controller isn't rotating without movement of the controller. function App:UpdateGame() local move = ((self.window:KeyDown(Key.W) and 1 or 0) - (self.window:KeyDown(Key.S) and 1 or 0)) * Time:GetSpeed() * 1 local strafe = ((self.window:KeyDown(Key.D)and 1 or 0) - (self.window:KeyDown(Key.A) and 1 or 0)) * Time:GetSpeed() * 1 -- get the mouse movement local currentMousePos = self.window:GetMousePosition() local mouseDifference = Vec3() mouseDifference.x = currentMousePos.x - 100 mouseDifference.y = currentMousePos.y - 100 -- adjust and set the camera rotation self.cameraRotation.y = self.cameraRotation.y + mouseDifference.x / 15 self.window:SetMousePosition(100, 100) self.player:SetInput(self.cameraRotation.y, move, strafe) end Code editing does not work very well on this site. I copy/paste and it messes it up. I go to edit and then for some reason I see tags in my code like , etc.
-
Can you overload the function to take a Z value? It won't break anything that way and give more flexibility.
-
I have floor segments (made from csg) and in the center of each floor segment I have a pivot. In the scene hierarchy the pivot is a child of the floor segment. floor --->center_pivot When I pick the floor segment I use pickinfo.entity->GetChild(0) to get the pivot at the center, but it returns NULL. Shouldn't this return the child pivot? I know it's picking the floor correctly because I put a sphere at the pick location and the sphere is in the right location. Entity* sphere = Model::Sphere(); sphere->SetPosition(pickinfo.position);
-
http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/camera/cameraraycast-r199 In LE2 I seem to remember we could provide a distance (z) value for how far out to pick. This can be useful.
-
Are you trying to apply the materials in the normal editor and it applies it to the entire model? If you double click the model to bring up the model editor then you should be able to drag the materials into the individual parts and have it work.
-
In the editor directory I think there should be an editor.log or engine.log file. Look at that and if nothing stands out to you copy/paste it here so we can see it. That goes through the steps of initialization of the engine and will generally show where it last left off or why it's failing.
-
I don't know if you are being serious or not, but iOS takes about 7 days before they'll get to looking at it. Then if they accept it it'll be ready for release on iOS devices. Android is about 2 hours lol
-
Yep, np. Just wanted to share stuff.
-
I think he means store like components in their own lists like in his first post " list/vector for each componenttype (vector<movecomp>, vector<guicomp>...).". When you process stuff you process a list at a time so that all/most of the memory that list refers to is in cached memory making it faster to deal with. On a side note, the event code I posted on the asset store works great with this style of design because it lets components fire events and register to get events and helps with decoupling the classes. Your connection becomes hooking up events between components. I'm not sure if you thought about how components communicate together but this is a great way to do that and not have each component need to know about the other in terms of it's insides. The generic GameObject is where they know about the other components attached. I was playing with this style in C# in LE2, but I stored it all in 1 list because my components were plugins (dll's) and loaded dynamically at run-time and added to generic game objects at design time. This is very dynamic and easy to extend functionality and didn't require creating extra containers for a new component. This is a pretty good article that takes you through the thought process http://gameprogrammi.../component.html . However, I don't like the idea of having the specific components in the game object that they stay with. They do talk about another communication method of messages. The funny thing is all of this is basically how Lua/Flowgraph works in LE3 Here is the method that really takes this to the extreme, and should help explain why and how to do this. http://gamesfromwith...oriented-design Look at the first answer. I think that helps describe witih a small example the idea. It's for sure a different way to think but it produces faster code. http://stackoverflow.com/questions/1641580/what-is-data-oriented-design
-
Yeah I've seen the extreme of what can be done to avoid memory cache misses and it can totally change how you have to think and design your code. I can't remember the name for that style now, but I find it a pain to read myself. This little example isn't the extreme but you can go far beyond this to get the speed. Where does it stop and what do you sacrifice? I think some of the benefits of having the 1 list is the flexibility to it. There are always trade-offs between flexibility and speed. That might be more relevant in a more dynamic language than C++, but if he creates more components later, the maintenance is more involved as he'll have to create separate lists. This may seem small, but it can start adding up if he has 100 different components over time. It also adds in complexity. That guys says one of the primary benefits is reducing cache misses, but I'd argue one of the primary benefits is also flexibility.
-
IMO this can get pretty advanced and you can get pretty extreme with it and unless you are creating the next gen game isn't something you really have to worry about, but it allows you to get max performance which sounds great until you realize to really max this in your entire application it really changes the structure of it. Often to the point of making it confusing to understand and maintain if you aren't used to it.
-
I have a small csg floor (set collision to scene). I create a character controller in code and it sits on this CSG cube and this works great. I made the following Lua script: Script.type1 = ""--string "Type" function Script:Start() self.entity:SetKeyValue("type1", self.type1) end When I attach this script to the csg floor model the character controller passes right through the floor. If I remove it, the character controller sits on top like I would expect. Very odd.