Page 13 of 13

Re: Oysi's 3D Rendering & Physics Engine

Posted: Wed Oct 15, 2014 10:52 am
by Oysi
Haha! Of all the things, it's the console you want to know about. xD

Very well.

veethree is indeed correct, it does loadstring. At first it sets up an environment for the console to use, and adds in all the elements from _G, such that it works like any other script. Then in the main script I put in all the stuff I want it to have extra, variables and such. And I use this separate environment because all my stuff is local, which doesn't translate over to different environments (unlike globals). On top of that, whatever global variables you define (x = 2 for example) will still work on the preceding calls as well. Then it's just a matter of opening the console, registering what you type (which you can do with love.textinput), and running whatever.

Really the only difficult part I suppose would be:

Code: Select all

local func, err = loadstring(code)
if func then
	local success, result = coroutine.resume(coroutine.create(func))
	if success then
		-- everything worked just fine, and if the thingy returned anything, it's 'result'
		-- (it can also return several values, at which point you need to pack it in a table and such)
	else
		-- runtime error, the error is 'result'
	end
else
	-- compile error, the error is 'err'
end
Or if you want to see how I made it, check this.

Take note that I never got around to rewriting it. So it's really just a prototype. But it does what I needed it to do, and very easy to use. Just call those functions through their respective love functions, and you're pretty much good to go.

Re: Oysi's 3D Rendering & Physics Engine

Posted: Wed Oct 15, 2014 10:57 am
by Roland_Yonaba
A question, perhaps. Is there here a real gain in using coroutines ?

Re: Oysi's 3D Rendering & Physics Engine

Posted: Wed Oct 15, 2014 11:26 am
by Oysi
In this case, probably not. In this case, pcall should work the same way.

In different scenarios, coroutines are extremely helpful. For the purposes of a console, I guess the main advantage is the fact that you can yield a coroutine, and then potentially resume it later on (and repeat). Which allows you to do things like wait 3 sec, wait for an event, etc...

Re: Oysi's 3D Rendering & Physics Engine

Posted: Mon Dec 28, 2015 3:40 pm
by Creator
Why do you do this?

Showing us your awesome engine without any code to learn from. Why?

Re: Oysi's 3D Rendering & Physics Engine

Posted: Mon Dec 28, 2015 6:27 pm
by bobbyjones
Bro don't worry we have a new better open source replacement. Love3d \o/

Re: Oysi's 3D Rendering & Physics Engine

Posted: Wed Dec 30, 2015 12:22 pm
by Karai17

Re: Oysi's 3D Rendering & Physics Engine

Posted: Fri Apr 08, 2022 2:22 pm
by Kaister93
Oysi still hasn't open-sourced his 3d engine? Sigh, I really want to take a look at a few things.

Re: Oysi's 3D Rendering & Physics Engine

Posted: Fri Apr 22, 2022 12:26 am
by Jasoco
Doesn't seem like it's gonna happen now. It's been 8 years. For 3D you can use Groverburger's 3D engine. But for physics, I have no idea unless Oysi decides to come back here soon. They haven't posted since 2014.