Jump to content

Lua Issues


Marcus
 Share

Recommended Posts

I decided to look past the syntax of Lua and give the tutorials a go. I was actually pleasantly surprised at the quickness of putting together a script. The only problem I have with scripting now is the first script in the tutorial pdf when run seems very choppy. The two example scripts in the SDK also ran very choppy. My framerate was jumping every where from 70fps on the low end to 310fps on the high end. Is this normal? If I can't even turn a single cube and have it look good, could I really make a game with Lua?

 

Any advice would be appreciated.

Link to comment
Share on other sites

all work fine for me. whats your system spec?

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

could you post the code you are using just incase you missed something?

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

require("Scripts/constants/keycodes")

-- Register abstract path
RegisterAbstractPath("")

-- Set graphics mode
if Graphics(1680, 1050, 32) == 0 then
Notify("Failed to set graphics mode.", 1)
return
end

world = CreateWorld()
if world == nil then
Notify("Failed to initialize engine.", 1)
return
end

gbuffer = CreateBuffer(GraphicsWidth(), GraphicsHeight(), 1+2+4+8)

camera = CreateCamera()
camera:SetPosition(Vec3(0, 0, -2))

light = CreateSpotLight(10)
light:SetRotation(Vec3(45, 55, 0))
light:SetPosition(Vec3(5, 5, -5))

material = LoadMaterial("abstract::cobblestones.mat")

mesh = CreateCube()
mesh:Paint(material)

ground = CreateCube()
ground:SetScale(Vec3(10.0, 1.0, 10.))
ground:SetPosition(Vec3(0.0, -2.0, 0.0))
ground:Paint(material)

light = CreateDirectionalLight()
light:SetRotation(Vec3(45, 45, 45))

while AppTerminate() == 0 do
if KeyHit(KEY_ESCAPE) == 1 then break end

mesh:Turn(Vec3(AppSpeed() * 0.5, AppSpeed() * 0.5, AppSpeed() * 0.5))

UpdateAppTime()
world:Update(AppSpeed())

SetBuffer(gbuffer)
world:Render()
SetBuffer(BackBuffer())
world:RenderLights(gbuffer)

DrawText(UPS(), 0, 0)
Flip(0)
end

Link to comment
Share on other sites

Graphics(1680, 1050, 32)

I think this will make graphics window which is covered by the upper part of the Vista Start button. That will cause random behaviour in 3D apps, some may be depending on idle timers, and it might mess them up.

 

Try to make a smaller window, or use fullscreen, so that the Vista Start button does not overlap on your graphics window.

You could also use Windows 2000 theme to get some additional FPS in 3D games, and to avoid this Vista bug too.

They "fixed" this Vista bug in Win 7 by making the start button not come over the task bar.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Graphics(1680, 1050, 32)

I think this will make graphics window which is covered by the upper part of the Vista Start button. That will cause random behaviour in 3D apps, some may be depending on idle timers, and it might mess them up.

 

Try to make a smaller window, or use fullscreen, so that the Vista Start button does not overlap on your graphics window.

You could also use Windows 2000 theme to get some additional FPS in 3D games, and to avoid this Vista bug too.

They "fixed" this Vista bug in Win 7 by making the start button not come over the task bar.

 

That actually was full screen. But just for fun I set it to windowed mode at 1024x768 with the same issues. I wondered if it was Aero, but after disabling it, still the same problems. Everything in the editor seems to run fine though. Odd.

Link to comment
Share on other sites

Okay I figured out the problem.

 

I only get the choppiness when I run the script in the editor. If I compile the file into a .luac and then drag-and-drop that onto engine.exe, I don't get the choppiness. Odd, but I feel better now that I can get it to work.

Link to comment
Share on other sites

What happens if you don't compile the file, but drag the .lua onto the engine.exe?

 

Runs equally as well. It seems that it is just a problem with having the script editor open at the same time.

 

When I open the task manager with the script editor open and the script running, the script editor is taking 45 percent of my CPU. When I run it from engine.exe, it allows the script to have 85 percent of my CPU time.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...