Oysi's 3D Rendering & Physics Engine

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Oysi
Prole
Posts: 48
Joined: Fri May 02, 2014 11:18 pm
Location: Earth

Re: Oysi's 3D Rendering & Physics Engine

Post by Oysi » Wed Oct 15, 2014 10:52 am

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.
Follow the potato. Achieve enlightenment.

User avatar
Roland_Yonaba
Inner party member
Posts: 1562
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Oysi's 3D Rendering & Physics Engine

Post by Roland_Yonaba » Wed Oct 15, 2014 10:57 am

A question, perhaps. Is there here a real gain in using coroutines ?

User avatar
Oysi
Prole
Posts: 48
Joined: Fri May 02, 2014 11:18 pm
Location: Earth

Re: Oysi's 3D Rendering & Physics Engine

Post by Oysi » Wed Oct 15, 2014 11:26 am

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...
Follow the potato. Achieve enlightenment.

Creator
Prole
Posts: 3
Joined: Sat Oct 17, 2015 10:01 am

Re: Oysi's 3D Rendering & Physics Engine

Post by Creator » Mon Dec 28, 2015 3:40 pm

Why do you do this?

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

bobbyjones
Party member
Posts: 720
Joined: Sat Apr 26, 2014 7:46 pm

Re: Oysi's 3D Rendering & Physics Engine

Post by bobbyjones » Mon Dec 28, 2015 6:27 pm

Bro don't worry we have a new better open source replacement. Love3d \o/
Do you frequently have great ideas but immediately lose them? Check out the MVP for my website called IdeaVault. It is designed to solve that problem. Desktop browsers only currently.

User avatar
Karai17
Party member
Posts: 879
Joined: Sun Sep 02, 2012 10:46 pm

Re: Oysi's 3D Rendering & Physics Engine

Post by Karai17 » Wed Dec 30, 2015 12:22 pm

STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests