February 04, 2012, 03:46:18 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Please report any bugs or issues that you might be encountering with the Beta in the Support System so that we can better keep track of any oustanding issues that may come up.

GameCore Support System
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Object Spawner Tutorial  (Read 1419 times)
ross.rockafellow
Global Moderator
Full Member
*****
Posts: 142



View Profile
« on: October 09, 2009, 01:02:25 PM »

Hello all,

I'm a new edition to the GameCore team. I'm real excited to see what this community can get done. I've been getting up to speed on the engine the last few weeks and I have decided to do a series of tutorials for the community. I noticed a forum post on the spawner and a lack of detailed documentation, so I have come to fix that problem. I hope this tutorial is helpful (procedural vertex animation is next, we'll get those spawned objects moving!)

Object Spawners

Terrain Spawners (otherwise known as Grass / Trees etc) are a powerful method of populating large areas of your worlds quickly and easily. Here is a quick tutorial on the process. (It's my first, so be gentle).

The first step to take (and the one that will make the whole process much quicker) is to build an inventory world, Keep it in the same project folder, just make a blank world with everything you want to spawn in it. This way any changes you make to the object (to be spawned) in the inventory world will automatically update your game world. It is also good practice to export the object from the inventory world and bring THAT export into the spawner to assure better compatibility. In the inventory world you can tweak everything from the physics to the procedural vertex animation without chewing up frame rate, but more on the vertex animation in a bit.

So once you have your inventory world with the objects set up and exported for the spawner go back into your main game world. (For my example my inventory world is plants.wld and my main game world is ross01.wld) So in the main world (ross01.wld), on the main menu bar click Environments → Object spawner/foliage. You will get a dialogue box that looks like this:


The top portion of the box contains a window showing what objects you have loaded into the spawner with a few buttons to augment the list (Add, Replace, Delete). You should be adding the exports from you inventory world.

Edit properties is a way to go into the script of the object and edit the object you have selected from the list.

The properties section is where the magic happens. Type is referring to the terrain layer you wish the objects to spawn on. (spelling must be EXACT). This is really handy for placement and keeps all spawned objects where they should be naturally while still being random.

Max Objects is the amount of object to be spawned into the world. Max Distance is how far from the current camera position the objects will be drawn. There is a really cool way of handling the 'popping' of spawned objects called alpha test dissolve, but more about that when we talk about the object surfaces and vertex animation.

Spacing controls the distance between spawned objects (the smaller the number the tighter the clumps).

Randomness helps keeps things looking more natural.

Rotation is set for a number between 0-360. This controls the random rotation of an object and for most spawners should be at 360 creating random placement around all 360 degrees.

Fix scale
makes sure the random scaling keeps the uniform shape of the object. This is how you avoid oddly shaped objects like flat, tall trees (small random z, big random y)

Align Terrain will align the pivot point of the object with the terrain. This will slope a tree forward if it spawns on a hill instead of still mostly straight without the align terrain checked. TIP: set your pivot points for objects like trees a bit above the tree base, this will help eliminate the ?floating tree effect?.

The Min and Max Scale controls the minimum and maximum randomization of object size.

Here is my test world (ross01.wld):



There are a couple of things to make note of:

Notice how the grass clumps are sloped running down the pond bank, that is the Align Terrain check box in action. Also the 'spacing' is a bit misleading here as the grass clumps were actually modeled as clumps and some of the spacing is hard meshed into the model, but we still get decent saturation.

While I used actual 3d models for my test world one of the coolest features of the object spawners is the ability to spawn straight from a texture (no mesh required, you say? Indeed.) By simply loading in a texture with alpha of grass GameCore will auto generate the planes needed to place the objects on. While this may not be desired for detail its great for getting some solid saturation of simple objects.

TIPS FOR SPAWNERS:

Set your pivot points for objects like trees a bit above the tree base, this will help eliminate the dreaded 'floating tree effect' when it snaps to the terrain.

As you can see in my test world the color of the spawned grass clumps and the grass tile texture I have on the terrain could use some color matching. If you built your inventory world you can tweak the color of your spawned grass using object surfaces, that will help blend everything more naturally.

For heavy saturation of say, grass, a great way to do it is with two different spawners. One that spawns close with a mesh (low Max Distance and Spacing, high Max Objects) and one that spawns farther away with just a texture (high Max Distance, Spacing and Max Objects).
« Last Edit: October 09, 2009, 01:56:25 PM by ross.rockafellow » Logged
hikmayan
Full Member
***
Posts: 231



View Profile
« Reply #1 on: October 10, 2009, 03:55:23 PM »

Ross,
Thanks for the contribution;really handy tutorial with important tips. Smiley
Logged

You have to be in it.....to win it!
shazlovely
Newbie
*
Posts: 1


View Profile
« Reply #2 on: March 26, 2010, 07:23:54 AM »

?The practice of writing has always verged on folly, and in a world that craves images it has become more questionable and frustrating than ever. I?d give it up tomorrow if I could shed my unfashionable belief in its importance.?  Wonderfully written column, Tom.  And dead on.




================================================
network+ notes
Logged
pixel_legolas
Hero Member
*****
Posts: 786


View Profile
« Reply #3 on: March 26, 2010, 10:27:27 AM »

did you also see my mini tutorial on how to force the spawned objects within certain areas? So the trees etc don't pass terrain you don't want them to be at. I think it of course was quite obvious for most people anyway Smiley
Logged
gekido
Guest
« Reply #4 on: March 28, 2010, 01:09:18 PM »

Another quick tip - if you see strangeness happening with your foliage objects when used as a spawner, you need to select the object as 'export geometry' with the object (under the 'tools' menu).  This will export a version of the geometry with the transforms / etc set properly so that it can be used as a spawner properly.

My workflow for working with spawners is to setup an inventory world with just the spawner objects in it - this way I can easily jump in and edit / setup the spawners.

For example:


This is where I setup the spawners and edit them once setup.

Once setup, I add them to a 'template' world that I then use as the starting point for building other worlds:



Logged
Jim
Jr. Member
**
Posts: 85



View Profile WWW
« Reply #5 on: July 26, 2010, 02:35:17 AM »

Your images are borked.
Logged

www.gamecreation.ca - gamecore stuff.
Pages: [1]
  Print  
 
Jump to:  

 
Powered by MySQL Powered by PHP bluBlur Skin © 2006, hbSkins
Powered by SMF 1.1.14 | SMF © 2006-2011, Simple Machines LLC
Valid XHTML 1.0! Valid CSS!