3D Objects in Game Editor

Post here your demos and examples with the source files.
Forum rules
Always post the games with a screenshot.
The file must have the ged and data files (complete game source)
Use the forum attachment to post the files.
It is always better to use the first post to put the game files

3D Objects in Game Editor

Postby tintran » Thu Jan 12, 2012 9:26 pm

this GE file reads a wireframe from an .obj file (obj file was created in blender).
it just reads the vector and faces definition and ignores all other lines.
but i think the function displaywire() which tries to project 3D into 2D can be improved (right now it's just hacked i just tried different values and see what looks acceptable, but when i do a regular cube it looks wrong, anyone who knows can improve on it).
to read a different model just change the file name inside wirefromfile() function to a different name
(ie. "monkey.obj" - a monkey head default object in blender,
"ico.obj" - icosphere,
"frame.obj" - a cube
or your own .obj model)
also rotate z-axis portion of rotatewire() function is buggy, when i try doing it it just flattens the model and i am not sure why :(
If anyone can help fix displaywire() function or figure out why the model flattens when z-axis rotation portion of rotatewire(), that would be awesome.
Attachments
monkey.png
wireframe.zip
(38.94 KiB) Downloaded 760 times
sphere.png
User avatar
tintran
 
Posts: 157
Joined: Fri Dec 24, 2010 1:34 am
Score: 30 Give a positive score

Re: Screensaver

Postby tintran » Thu Jan 12, 2012 10:42 pm

z-axis rotation bug solved.
improvement on 2D projection based on http://en.wikipedia.org/wiki/File:Perspective_Transform_Diagram.png
Attachments
wireframez.zip
(39.42 KiB) Downloaded 539 times
icosphere.png
User avatar
tintran
 
Posts: 157
Joined: Fri Dec 24, 2010 1:34 am
Score: 30 Give a positive score

Re: Screensaver

Postby happyjustbecause » Fri Jan 13, 2012 1:21 am

Hey, I've tried all of these screensavers, and I must say, they are extremely cool. I don't really understand the code, and how you did them, but I like them a lot. It shows that gE can create a variety of things when people play around with it!
:D
For small creatures such as we the vastness is bearable only through love.
-Carl Sagan

Night Knight Development Thread
User avatar
happyjustbecause
 
Posts: 267
Joined: Tue Jul 26, 2011 3:10 pm
Location: Frazier Park, Ca
Score: 15 Give a positive score

Re: Screensaver

Postby Hblade » Fri Jan 13, 2012 3:52 pm

I'm very impressed! Amazing! and yay for blender monkey =)
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Screensaver

Postby Jagmaster » Fri Jan 13, 2012 8:13 pm

:lol: Suzanne.
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: Screensaver

Postby SuperSonic » Fri Jan 13, 2012 9:28 pm

@tintran: Wow dude, that's awsome :D

Hblade wrote: yay for blender monkey =)

Jagmaster wrote::lol: Suzanne.

:lol:
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Screensaver

Postby tintran » Sat Jan 14, 2012 1:16 am

found a teddy bear .obj on the internet.
some models have much larger z values so i added the ability to set SCALE (left mouse button and SCALE will set to xmouse value)
and the ability to set BZ (right mouse button and BZ will set to xmouse value) (BZ seems to change the focal length I think).
two values will be displayed for debugging purposes.
so i guess now we sort of have a wireframe viewer as a screen saver.
Attachments
teddy.zip
(176.03 KiB) Downloaded 435 times
teddy2.png
teddy.png
User avatar
tintran
 
Posts: 157
Joined: Fri Dec 24, 2010 1:34 am
Score: 30 Give a positive score

Re: Screensaver

Postby Hblade » Sat Jan 14, 2012 3:14 am

You have truely impressed me with this 3D Wireframe drawing using 3D Files. Incredible indeed. Now add physics and a character model animated but in wireframe >:3

Lol jk thats too insane xD
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Screensaver

Postby tintran » Sun Jan 15, 2012 2:29 am

improved displaywire(). lines further away from view gets drawn first and in green.
Attachments
monkey.zip
(339.31 KiB) Downloaded 425 times
monkey.png
User avatar
tintran
 
Posts: 157
Joined: Fri Dec 24, 2010 1:34 am
Score: 30 Give a positive score

Re: Screensaver

Postby Jagmaster » Sun Jan 15, 2012 6:26 am

+++++
A lot of time put into these Screensavers I'll bet.
Thanks for your contribution to GE :D
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: Screensaver

Postby makslane » Sun Jan 15, 2012 1:12 pm

Awesome!
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: Screensaver

Postby tintran » Sun Jan 15, 2012 10:08 pm

speed enhancement. (only look at defined vectors instead of blindly looping to 10000 all the time, rotation looks much smoother with this change)
speedy.zip
(293.57 KiB) Downloaded 403 times
monkey.png

also if you click Game Mode then hit Esc and repeat that 18 times or so you'll get the following error:
canvas -> Draw Actor, in displaywire function, line 119: Attempt to access 12529024 bytes.
If is correct, set variable gedMaxGameMem=138794450 or more
in an action before the allocation
canvas -> Draw Actor, in displaywire function, line 63: WRITE attempted beyond access area

then you have to close down GE, reopen it and do it another 18 times or so and the error appears again.
this looks like a memory leak problem, i haven't used malloc or free in my code, they're all just predefined arrays, so i don't really know how to fix this problem. :( please let me know if you find out why this memory leak is occuring!

edit: moved some arrays definition from displaywire() to global and solved the memory leak, weird I thought that functions automatically handled memory freeing of arrays that are defined within it.
nomorememleak.zip
(311.38 KiB) Downloaded 390 times
User avatar
tintran
 
Posts: 157
Joined: Fri Dec 24, 2010 1:34 am
Score: 30 Give a positive score

Re: Screensaver

Postby lcl » Sun Jan 15, 2012 10:54 pm

That's very impressive tintran! :D
+1 and a loooot respect!
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Screensaver

Postby Hblade » Sun Jan 15, 2012 11:27 pm

Fantastic. You've made a breakthrough.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Screensaver

Postby Game A Gogo » Mon Jan 16, 2012 12:23 am

tintran wrote:edit: moved some arrays definition from displaywire() to global and solved the memory leak, weird I thought that functions automatically handled memory freeing of arrays that are defined within it.

This pretty much only happens within GE, happened to me before
When a game closes from within GE, I don't think it clears any memory
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Next

Return to Game Demos

Who is online

Users browsing this forum: No registered users and 1 guest

cron