Jump to content

Cole Chapman

Members
  • Posts

    138
  • Joined

  • Last visited

Everything posted by Cole Chapman

  1. I do believe they are your models bud. (I am no expert) When I put them in the editor, the largest number that jumped out was the 3000 batches (I'm not sure what exactly they are though) so I started messing with them. In the image below, I deleted those two small models (Both of the Crates models) from the scene and the batch size went down by roughly 820. The FPS difference after this was about 17 Before to 25 after. I could be very wrong, but thats just what I picked up on. Since the Arctic scene has WAY more polys than your mall scene and WAY less batches, I think we can say that that is the first issue you should try and tackle. (Like I said though, could be wrong)
  2. Okay I have another question. How come the FPS drops down so much when looking straight down at a terrain compared to when your looking at an angle? (Its like this in the Editor as well)
  3. Oh wow, I forgot all about build options. I thought that the exe that BMax built just said .debug and it was the final executable Thank you for helping, the FPS cleared right up when I unchecked Debug. and I had no idea the editor was made in Bmax, thats pretty sweet Thanks again!
  4. The Problem: When the window is 800,600 using the Scene I want to load, I get about 13 Ave FPS (Not suprised, the Day and Night Settings are way up) What surprises me though is when I maximize the parent window to my full resolution (1920x1080), the FPS stays the same. When I scale it even lower than 800x600, the FPS still does not break 13. I always thought the more space a program/game had to render, the slower the performance (made sense logically) On another note, when I open the scene up in the Leadwerks Editor, I get a solid 30 FPS. Is this due to problems in my code, or does BlitzMax generally operate that slow (assuming Leadwerks Editor was written in C++ or something) Heres the code: SuperStrict Framework Leadwerks.Engine Import "Framework.BMX" Import MaxGUI.MaxGUI Import MaxGUI.Drivers Import BRL.EventQueue Include "lua-gluefunctions.bmx" RegisterAbstractPath("C:\Leadwerks Engine SDK") GCSetMode(2) Global FW:TFramework Local GEWindow:TGadget Local GEWindowX:Int 'Null (WINDOW_CENTER) Local GEWindowY:Int 'Null (WINDOW_CENTER) Local GEWindowW:Int = 800 Local GEWindowH:Int = 600 Local GEWindowStyle:Int = WINDOW_TITLEBAR|WINDOW_RESIZABLE|WINDOW_MENU|WINDOW_STATUS|WINDOW_CENTER Local Canvas1:TGadget Global Scene:TEntity Global Move:Float Global Strafe:Float Global CamRotation:TVec3 = Vec3(0) Global mx:Float Global my:Float Global MouseXInt:Int Global MouseYInt:Int GEWindow:TGadget = CreateWindow("GE", GEWindowX, GEWindowY, GEWindowW, GEWindowH, Null, GEWindowStyle) Canvas1:TGadget = CreateCanvas(0, 0, ClientWidth(GEWindow), ClientHeight(GEWindow), GEWindow) SetGadgetLayout(Canvas1, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED) SetGraphics(CanvasGraphics(Canvas1)) ActivateGadget(Canvas1) EnablePolledInput() FW:TFramework = CreateFramework() If Not FW RuntimeError "Failed to Initialize Engine" SetScriptObject("fw", fw) Scene:TEntity = LoadScene("abstract::DayNightCycle.sbx") PositionEntity(fw.Main.camera, StringToVec3(GetEntityKey(scene, "cameraposition"))) Repeat While PeekEvent() WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End Case EVENT_WINDOWSIZE SetGraphics CanvasGraphics(Canvas1) EndSelect Wend CameraUpdate() If KeyDown(KEY_ESCAPE) Then End FW.Update() FW.Render() SetBlend(1) DrawText(MouseX(), 0, 10) SetBlend(0) Flip(0) Forever GCCollect() End Function CameraUpdate() If KeyDown(KEY_SPACE) mx = MouseX() - GraphicsWidth()/2 my = MouseY() - GraphicsHeight()/2 MoveMouse(GraphicsWidth()/2, GraphicsHeight()/2) CamRotation.X = CamRotation.X + my CamRotation.Y = CamRotation.Y - mx RotateEntity(FW.Main.Camera, CamRotation) move = KeyDown(KEY_W) - KeyDown(KEY_S) strafe = KeyDown(KEY_D) - KeyDown(KEY_A) MoveEntity(fw.Main.camera, Vec3(strafe / 10.0, 0, move / 10.0)) EndIf EndFunction Function StringToVec3:TVec3(text:String, scale:Float = 1.0) Local t:TVec3 = Vec3(1) Local sarr:String[] sarr = text.split(",") If sarr If sarr.length > 0 t.x = Float(sarr[0]) * scale If sarr.length > 1 t.y = Float(sarr[1]) * scale If sarr.length > 2 t.z = Float(sarr[2]) * scale EndIf Return t EndFunction 'These functions allow you to pass framework to the lua state' Function SetScriptObject(name:String, o:Object) Local size:Int=GetStackSize() lua_pushbmaxobject(luastate.L,o) lua_setglobal(luastate.L,name) SetStackSize(size) EndFunction Function GetStackSize:Int() Return lua_gettop(luastate.L) EndFunction Function SetStackSize(size:Int) Local currentsize:Int=GetStackSize() If size<currentsize lua_pop(luastate.L, currentsize - size) EndIf EndFunction
  5. I was looking at the animation tutorial and I wanted to know if the latest Leadwerks contains the Crawler model. If not can someone point me in the direction of where I can get it? Thanks!
  6. Ah, I thought the auto GC was something in Leadwerks. Thanks for the info man!
  7. Well anything with memory is generally important (just a logical rule of thumb) but if I dont have it, does that mean that (and this is an uneducated guess) more memory will be allocated for my program as I load and delete more and more things?
  8. Ah, yes GCCollect() makes more sense than calling GCSetMode() again. I did both GCCollect AND removing all Garbage Collection codes and they both run on par with each other (I saw higher spikes with removing but it was only a few frames So I need to know if not having GCCollect is okay and I guess what does it exactly do?
  9. Bringin this ol' thread back up. I had an example program stripped down and running and I noticed the cube rotating got slow so I threw in a DrawText UPS() to see how the FPS was doing and I noticed it was getting slow. I recalled that this issue happened a while back to me (This thread) so I revisited and put in the correction. However, even when I through in GCSetMod(2) in the loop, the UPS dropped progressively from over 1000 to just below 200 before I terminated it. Im going to paste my code and hopefully someone can shed some light SuperStrict Framework leadwerks.ENGINE Local world:TWorld Local gbuffer:TBuffer Local camera:TCamera GCSetMode(2) RegisterAbstractPath( "C:/Leadwerks Engine SDK" ) Graphics(800,600) world=CreateWorld() If Not world RuntimeError "Failed to create world." gbuffer=CreateBuffer(GraphicsWidth(),GraphicsHeight(),BUFFER_DEPTH|BUFFER_COLOR0|BUFFER_COLOR1|BUFFER_COLOR2) camera=CreateCamera() PositionEntity camera,[0.0,0.0,-2.0] Repeat GCSetMode(2) If KeyHit(KEY_ESCAPE) Exit If AppTerminate() Exit UpdateAppTime() UpdateWorld(AppSpeed()) SetBuffer(gbuffer) RenderWorld() SetBuffer(BackBuffer()) RenderLights(gbuffer) DrawText (UPS(), 0, 0) DrawRect MouseX(), MouseY(), 250, 250 Flip(0) Forever gbuffer=Null GCCollect() End
  10. Haha well thank you very much for the response! I figured out that I could declare a variable saying MouseFromX and MouseFromY is already declared and that could work. But I know from looking at it right now, that I would completely have to rewrite (If MouseDown on THIS GUI Object) because currently if I added lets say a button, it would think I am clicking on the button as well as the window. I will sit down right now and think about all of this. Thanks again! ah, was posting this while you edited, yeah boolean is what ill have to do ^^, thanks man
  11. Cole Chapman

    GUI

    Couple questions. 1. Am I correct in saying that it would be faster for my program to render 2d GUI instead of 3D? (3D Being making a cube or a plane and adding textures to those) 2. Will it work just as fast programming GUI in BlitzMax(What I am using) than it would be to program it in LUA and run scripts? 3. As far as code, I am still working on it and I may get this done before anyone posts, but if not... What is the code for having a window (in this case a rectangle) move with the mouse if the mouse is clicked? So far I have: Method DrawWindow() DrawRect x,y,w,h If MouseDown(1) Then If (MouseX() > x And MouseX() < x+w) And (MouseY() > y And MouseY() < y+h) Then Local MouseFromX:Int = MouseX() - x Local MouseFromY:Int = MouseY() - y Repeat Local XPos:Int = MouseX() - MouseFromX Local YPos:Int = MouseY() - MouseFromY x=XPos y=YPos Until MouseDown(1) = False EndIf EndIf End Method With that code, I used the repeat so it wouldnt declare MouseFromX and MouseFromY again, however, being stuck in that loop stops the rendering so that wont be able to work. Is there a way to declare those once and not have it declared again until a new MouseClick occurs?
  12. I was messing with the editor and noticed this driving a Viper Scout through the trees. When you move the camera down near the terrain, it adjusts the position to not collide with the terrain. I think the camera (when going through trees) adjusts to not collide with them but it is indeed strange. I will mess with it a bit but if you figure it out, please do tell how you accomplished it
  13. Thank you for showing me that download. Unfortunatly, I do not still have my key which is why im kind of annoyed that not only is this Client Area transition not the best, but support hasnt gotten back or even shot an email my way saying they got my email. I am still under the Member Group of "Leadwerk Developer" so hopefully that will be my key to getting my leadwerks download. =/
  14. I got Leadwerks forever ago as a Christmas gift and I want to start using it. I cannot find any type of download and in my account under Client Area it had nothing about me buying or where a download is for it. I emailed support two days ago and have not gotten a response, can someone point me in the right direction?
  15. Yeah, I used EntityType(Controller,1) and I didnt use BodyMass, I dont see why I would need it. However, I JUST tried it, and camera is now falling downward. I dont want physics applied to this camera, I just want to be able to fly through the scene, what do you suggest I do?
  16. Cameras are working pretty solid, now Im just trying to get the WASD movement down, I think Im not using UpdateController right or something, it doesnt change the Controller position at all, X Y and Z are still the same =/
  17. Thank you so much, I didnt know without it, MouseX and Y wouldnt work, should have checked those variables, I really apreciate the help!
  18. The code does nothing yet, im just trying a few things out, and when I use EnablePolledInput, the entire canvas gets all buggy and i see colored squares and nothing what I want to render =/
  19. Thanks to everyone who helped figure this out, I fixed what I was told to, put Garbage Collector in Loop, I am using DrawText instead of GadgetText for the Window Title, but now I have one more question. I figured it would be dumb to start a new topic, so Ill just say it, I am trying to add camera controllers, and I have ported the FPS controller to Blitz as well as tried some older camera code, and I cant figure out what the problem is SuperStrict Framework leadwerks.framewerk Import maxgui.drivers Import brl.eventqueue Import brl.timer RegisterAbstractPath "C:/Program Files (x86)/Leadwerks Engine SDK" SetGraphicsDriver GLGraphicsDriver(), GRAPHICS_BACKBUFFER | GRAPHICS_DEPTHBUFFER Global FW:TFramewerk Local W:TGadget Local C:TGadget Local MX:Float = 0.0 Local MY:Float = 0.0 Local Move:Int = 0 Local Strafe:Int = 0 Local Jump:Int = 0 Local Mesh:TMesh Local Ground:TMesh Local Light:TLight Local Controller:Tcontroller Local CameraRotation:TVec3 = Vec3(0) Local ControllerPosition:TVec3 = Vec3(0) W:TGadget = CreateWindow("Easy GL Cube in a GUI window", 10, 10, 800, 600) C:TGadget = CreateCanvas(0, 0, W.ClientWidth(), W.ClientHeight(), W, 0) C.setlayout 1, 1, 1, 1 SetGraphics CanvasGraphics(C) FW:TFramewerk = TFramewerk.Create() If Not FW RuntimeError "Failed to initialize engine." FW.renderer.SetSkybox(LoadMaterial("abstract::FullskiesBlueClear0016_2_L.mat")) PositionEntity FW.Main.camera, [0.0, 0.0, - 2.0] Controller = CreateController(1.8, 0.4, 0.5, 45) Mesh:TMesh = CreateCube() Ground:TMesh = CreateCube() Light:TLight = CreateDirectionalLight() FW.SetStats(0) ScaleEntity Ground, [10.0, 1.0, 10.0] PositionEntity Ground, [0.0, - 2.0, 0.0] RotateEntity Light, [45.0, 45.0, 45.0] Repeat GCSetMode(2) UpdateAppTime() WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End Case EVENT_WINDOWSIZE SetGraphics CanvasGraphics(C) EndSelect RedrawGadget C MX = Curve(MouseX() - GraphicsWidth() / 2, MX, 3) MY = Curve(MouseY() - GraphicsHeight() / 2, MY, 3) MoveMouse(GraphicsWidth() / 2, GraphicsHeight() / 2) CameraRotation.X = Clamp(CameraRotation.X + MY / 5.0, - 89, 89) CameraRotation.Y = CameraRotation.Y - MX / 5.0 RotateEntity(FW.Main.camera, CameraRotation) RotateEntity(Controller, Vec3(0, CameraRotation.Y, 0)) If KeyDown(KEY_W) Move = 6 If KeyDown(KEY_LSHIFT) Move = 2 End If End If If KeyDown(KEY_S) Move = -5 If KeyDown(KEY_LSHIFT) Move = 0 End If End If Strafe = (KeyDown(KEY_D) - KeyDown(KEY_A)) * 8 If KeyHit(KEY_SPACE) And ControllerAirborne(Controller) = False Jump = 4.7 Else Jump = 0 End If UpdateController(Controller, 0, Move, Strafe, Jump, 30, 0) ControllerPosition = EntityPosition(Controller) PositionEntity(FW.Main.camera, Vec3(ControllerPosition.X, ControllerPosition.Y + 1, ControllerPosition.Z)) TurnEntity Mesh, [AppSpeed() * 0.5, AppSpeed() * 0.5, AppSpeed() * 0.5] If KeyHit(KEY_ESCAPE) Exit If AppTerminate() Exit FW.Update() FW.Render() DrawText("FPS: " + UPS(), 0, 0) DrawText("Camera Rotation X: " + CameraRotation.Z, 0, 20) DrawText("Camera Rotation Y: " + CameraRotation.Y, 0, 40) DrawText("Camera Rotation Z: " + CameraRotation.Z, 0, 60) DrawText("MX: " + MX, 0, 80) DrawText("MY: " + MY, 0, 100) Flip(0) Forever FW.renderer.gbuffer = Null FreeEntity light GCCollect() End The MX and MY are what screw it up
  20. yeah, its inside the look, and I was glancing at GCSetMode(2) I found out its a "Garbage Collecetor Mode" when set to 2, no memory is automaiticaly collected, I switched it to 1, and I am getting a steady performance and a higher FPS, So I do believe I got it now, thank you for taking a look at it though man! I really apreciate it
  21. Yeah I was just lookin at that myself, I took them both out so its just: SuperStrict Framework leadwerks.ENGINE Import maxgui.drivers Import brl.eventqueue Import brl.timer Local world:TWorld Local gbuffer:TBuffer Local camera:TCamera Local mesh:TMesh Local light:TLight Local ground:TMesh Local material:TMaterial GCSetMode(2) RegisterAbstractPath( "C:/Program Files (x86)/Leadwerks Engine SDK" ) SetGraphicsDriver GLGraphicsDriver(), GRAPHICS_BACKBUFFER | GRAPHICS_DEPTHBUFFER Local w:TGadget = CreateWindow("Easy GL Cube in a GUI window", 10, 10, 512, 512) Local c:TGadget = CreateCanvas(0,0,w.ClientWidth(),w.ClientHeight(),w,0) c.setlayout 1, 1, 1, 1 SetGraphics CanvasGraphics(c) world=CreateWorld() If Not world RuntimeError "Failed to create world." gbuffer=CreateBuffer(GraphicsWidth(),GraphicsHeight(),BUFFER_DEPTH|BUFFER_COLOR0|BUFFER_COLOR1|BUFFER_COLOR2) camera=CreateCamera() PositionEntity camera,[0.0,0.0,-2.0] material=LoadMaterial("abstract::cobblestones.mat") mesh=CreateCube() PaintEntity mesh,material ground=CreateCube() ScaleEntity ground,[10.0,1.0,10.0] PositionEntity ground,[0.0,-2.0,0.0] PaintEntity ground,material light=CreateDirectionalLight() RotateEntity light,[45.0,45.0,45.0] Repeat SetGadgetText(w, UPS()) RedrawGadget c TurnEntity mesh, [AppSpeed() * 0.5, AppSpeed() * 0.5, AppSpeed() * 0.5] If KeyHit(KEY_ESCAPE) Exit If AppTerminate() Exit UpdateAppTime() UpdateWorld(AppSpeed()) SetBuffer(gbuffer) RenderWorld() SetBuffer(BackBuffer()) RenderLights(gbuffer) Flip(0) Forever gbuffer=Null FreeEntity light GCCollect() End Still does the same thing
  22. I put leadwerks in a canvas in MaxGUI and it was working fine, and I added UPS. At first the UPS says around 300, and then about 1 minute later it gets down to 60-ish and you can even see the decline in performance on the cube rotating, here is my code: SuperStrict Framework leadwerks.ENGINE Import maxgui.drivers Import brl.eventqueue Import brl.timer Local world:TWorld Local gbuffer:TBuffer Local camera:TCamera Local mesh:TMesh Local light:TLight Local ground:TMesh Local material:TMaterial GCSetMode(2) RegisterAbstractPath( "C:/Program Files (x86)/Leadwerks Engine SDK" ) SetGraphicsDriver GLGraphicsDriver(), GRAPHICS_BACKBUFFER | GRAPHICS_DEPTHBUFFER Local w:TGadget = CreateWindow("Easy GL Cube in a GUI window", 10, 10, 512, 512) Local c:TGadget = CreateCanvas(0,0,w.ClientWidth(),w.ClientHeight(),w,0) c.setlayout 1, 1, 1, 1 SetGraphics CanvasGraphics(c) world=CreateWorld() If Not world RuntimeError "Failed to create world." gbuffer=CreateBuffer(GraphicsWidth(),GraphicsHeight(),BUFFER_DEPTH|BUFFER_COLOR0|BUFFER_COLOR1|BUFFER_COLOR2) camera=CreateCamera() PositionEntity camera,[0.0,0.0,-2.0] material=LoadMaterial("abstract::cobblestones.mat") mesh=CreateCube() PaintEntity mesh,material ground=CreateCube() ScaleEntity ground,[10.0,1.0,10.0] PositionEntity ground,[0.0,-2.0,0.0] PaintEntity ground,material light=CreateDirectionalLight() RotateEntity light,[45.0,45.0,45.0] Repeat SetGadgetText(w, UPS()) WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End Case EVENT_WINDOWSIZE SetGraphics CanvasGraphics(c) gbuffer = CreateBuffer(GraphicsWidth(), GraphicsHeight(), BUFFER_DEPTH | BUFFER_COLOR0 | BUFFER_COLOR1 | BUFFER_COLOR2) EndSelect RedrawGadget c TurnEntity mesh, [AppSpeed() * 0.5, AppSpeed() * 0.5, AppSpeed() * 0.5] If KeyHit(KEY_ESCAPE) Exit If AppTerminate() Exit UpdateAppTime() UpdateWorld(AppSpeed()) SetBuffer(gbuffer) RenderWorld() SetBuffer(BackBuffer()) RenderLights(gbuffer) Flip(0) Forever gbuffer=Null FreeEntity light GCCollect() End So I am asking why it does this, if anyone can help that would be great Chapman7
×
×
  • Create New...