Jump to content


Photo
- - - - -

Fake 3d Trees Engine. It's Simple!


  • Please log in to reply
37 replies to this topic

#1 C.Zorg

C.Zorg

    GMC Member

  • New Member
  • 381 posts

Posted 20 June 2009 - 03:57 PM

  • Title: Fake 3D Trees
  • Description: This shows a quick and simple methode to create fake 3D trees for TDS- and/or RPG games. To make it work with GM Lite, just remove or comment out the Create Event in obj_Tree and make all tree sprites transparent.
  • Made With: GM7 Pro
  • Registered: Yes (and No, read Description)
  • File Type: .gmk
  • File Size: ~120 Kb
Version 2
Posted Image
Download (secondary link if above isn't visible)

Fixes and additions
Version 2
* Separated the shadow from the bottom tree layer so the shadow stays at the same place
* Made the shadow softer for a nicer look
* The player can no longer walk through tree bases

Posted Image

Additional Info
I DID NOT MAKE THE TREE SPRITES! All credits for those sprites goes to Newly Discovered!
I used his tree sprites because they works perfectly for this example and I can't make trees myself.
To make it work with GM Lite, just remove or comment out the Create Event in obj_Tree and make all tree sprites transparent.

Controls are Arrow keys to move the player and ENTER to switch debug mode on and off.

Everything about this engine is commented in the .gmk file

Edited by C.Zorg, 24 June 2009 - 12:41 PM.

  • 0

#2 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14392 posts
  • Version:GM:Studio

Posted 21 June 2009 - 02:43 AM

NEAT!!! Really neat! You have leafy trees too?
  • 0

#3 C.Zorg

C.Zorg

    GMC Member

  • New Member
  • 381 posts

Posted 21 June 2009 - 10:02 AM

NEAT!!! Really neat! You have leafy trees too?

Thanks. No I don't have leafy trees. I didn't make the tree sprites used in this example.
  • 0

#4 Kyon

Kyon

    Creator of Dirkels

  • New Member
  • 4237 posts

Posted 21 June 2009 - 12:00 PM

OMG!
This is...
This is...
WONDERFULL!
  • 0

#5 shm31

shm31

    GMC Member

  • New Member
  • 12 posts

Posted 21 June 2009 - 12:14 PM

wow ! really amazing work !!! :)
  • 0

#6 C.Zorg

C.Zorg

    GMC Member

  • New Member
  • 381 posts

Posted 21 June 2009 - 01:11 PM

Thanks for the positive response!
It may look nice but the coding is pretty simple. In each tree you calculate the distance and direction to the center of the view and move the different parts of the tree according to that direction and distance...
  • 0

#7 devonch40

devonch40

    GMC Member

  • New Member
  • 17 posts

Posted 21 June 2009 - 02:19 PM

Looks nice, but you might want to make the shadow a different layer from the bottom. It also moves with the view and normal shadows would stay on the ground.
  • 0

#8 Syynth

Syynth

    GMC Member

  • GMC Member
  • 434 posts
  • Version:GM:Studio

Posted 21 June 2009 - 02:47 PM

the other thing is the tree's have no base. you walk right through them, otherwise really neat. too bad it would be hard to make more sprites like that...
  • 0

#9 C.Zorg

C.Zorg

    GMC Member

  • New Member
  • 381 posts

Posted 21 June 2009 - 03:57 PM

Well, both the shadow and collision is easily done. But the point with this engine was the 3D look on the trees so I didn't make the rest, but I can make it in a while when I get home...
  • 0

#10 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14392 posts
  • Version:GM:Studio

Posted 22 June 2009 - 02:52 AM

I took the liberty to make a few changes...

Download Fake_3D_Trees.gmk


Changes:

Added Leafy Tree

Added a Random tree generator

Added leafy tree sprites

Addded collision script

Added collision with player

Removed Solid Option from tree to be compatible with the smooth collision

Removed the preload flag

changed spr_Top to spr_PineTop and so on and added spr_LeafTop and so on

Added check to not draw if too far

Added check if the sprite_set_alpha was already called

image_angle is now random so they dont all look like clones.

obj_Tree is now the parent for all the trees of this type, children set the sprite used by the tree in the child create event

Had to split the draw into multiple objects because now trees were ovelapping, so the bottom of one tree was droawing over the top of another. More obvious with the leafy trees.

obj_Top, Middle, And Bottom draw each part at the righ level. These are created, destroyed and controlled by the obj_Tree. When the tree is too far, the are also set to invisible

[edit]
Also added wind, simply by rotating each part a little...

I suggest you crop your images so it takes less space your in the video card (and gmk) and increases performance some more

Edited by icuurd12b42, 22 June 2009 - 03:14 AM.

  • 0

#11 Southman

Southman

    I simply am not here

  • GMC Member
  • 1662 posts
  • Version:GM:Studio

Posted 22 June 2009 - 03:02 AM

wow host-a is slow today
  • 0

#12 irshead

irshead

    GMC Member

  • New Member
  • 76 posts

Posted 22 June 2009 - 07:42 AM

cool i will use it for my game
can u make fake 3d buldings????
  • 0

#13 C.Zorg

C.Zorg

    GMC Member

  • New Member
  • 381 posts

Posted 22 June 2009 - 10:08 AM

I took the liberty to make a few changes...

Download Fake_3D_Trees.gmk


Changes:

[...]

Host-a.net is very slow right now. I'll look at the gmk later :)...

cool i will use it for my game
can u make fake 3d buldings????

Yes I can do fake 3D buildings too, but I don't need to. Someone else already made an example with fake 3D buildings
http://gmc.yoyogames...howtopic=421418
  • 0

#14 Kubanen

Kubanen

    Vipers

  • GMC Member
  • 1721 posts

Posted 22 June 2009 - 01:11 PM

ehm, the link won't work :).
  • 0

#15 C.Zorg

C.Zorg

    GMC Member

  • New Member
  • 381 posts

Posted 22 June 2009 - 01:25 PM

ehm, the link won't work :).

It seems like host-a.net is down atm. The link will work as soon as host-a.net is up again...
  • 0

#16 irshead

irshead

    GMC Member

  • New Member
  • 76 posts

Posted 22 June 2009 - 03:51 PM

Yes I can do fake 3D buildings too, but I don't need to. Someone else already made an example with fake 3D buildings

http://gmc.yoyogames...howtopic=421418


the link don't work can u help?
  • 0

#17 TheSnidr

TheSnidr

    That guy

  • Global Moderators
  • 2439 posts
  • Version:GM:Studio

Posted 22 June 2009 - 03:53 PM

Unfortunately I use host-a.net for my engine too, and it's down at the moment.


Nice engine you got going here! Looks good.
  • 0

#18 irshead

irshead

    GMC Member

  • New Member
  • 76 posts

Posted 22 June 2009 - 03:54 PM

Yes I can do fake 3D buildings too, but I don't need to. Someone else already made an example with fake 3D buildings

http://gmc.yoyogames...howtopic=421418


the link don't work can u help?
  • 0

#19 SparkzBolt

SparkzBolt

    Graphics....Zap

  • New Member
  • 416 posts

Posted 24 June 2009 - 12:58 AM

Too bad all the fake 3D engines are use pro. I think mostly people without it want to!(that's just me thought.)
  • 0

#20 Petey_Pii

Petey_Pii

    GMC Member

  • New Member
  • 769 posts

Posted 24 June 2009 - 01:56 AM

this idea could also be used for a space background where stars witha high depth move slowly in the back where as stars with a lower depth move quicker as you move around, great tutorial btw
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users