Reality Factory Community Release April 2008

Programming Reality Factory and Genesis3D.
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Reality Factory Community Release April 2008

Post by Jay » Thu Apr 24, 2008 11:30 pm

This is a release built onto the physics release which contains:

-Particle Wind (without Wind Generator, just enable/disable it)
-Physics
-Scripted Projectiles
-GlobalValueArrays for easy exchange of data between scripts
-speed optimization in the ActorManager: Searching for the same actor repeatedly is now faster
-Enhanced Weapon system as in the first community release.
-this release is backwards compatible to the first community release and to the physics release

I made a sample projectile script, sample projectile definition ini file and sample script which adds a scripted projectile. More documentation may come later, source code will come later too (It is late and i wanted to release it today, docs and source code may still take a few days, depending on how much time i have). I also did not have much time to test the release, so there may be bugs. Please post bugs regarding this release in this topi only to avoid confusion.

A short overview over the added features (a full, detailed list will come with the documentation)
ScriptedProjectile short reference:

Commands
Move(); Move(x,y,z,speed); //Move into current direction or to target with the current speed, or move manually into a direction specified, with a speed specified
CheckForCollision(); //Checks if collision occours. 0=Nothing, 1=Liquid, 2=Actor, 3=Model, 4=Level or StaticMesh
SetDirection(x,y,z); //Set direction manually
NormalizeDirection(); //Use to bring direction to a lenght of 1 (if it isn't 1 then Move() might move too slow or too fast)
SetSpeed(speed);
SetDestinationPoint(x,y,z); //Sets direction so that the projectile will fly towards the destination point
SetTarget(char* ename); //sets a target, use SetTarget(""); to un-set target
Remove(); //Delete it. The current order will still be executed to its end
GetHitName(); //Retrieves EntityName of hit entity, if possible. (Only possible for Liquid, Actor, and Model, if it's a model it will return the entityname of the DestroyableModel)
DamageActor(char* name, char* attribute, float amount); //Damages an actor
DamageModel(char* name, char* attribute, float amount); //Damages a model
GetAttribute(char* attrib, (char* entity));
SetAttribute(char* attrib, float amount, (char* entity));
FaceActor(char* name); //Rotate to face actor immeadiately
Transform(x,y,z,roll,yaw,pitch); //Used to transform a point (x,y,z) to a specific direction (roll, yaw, pitch), Example: Transform(0,0,1,self.current_roll, self.current_yaw, self.current_pitch); transforms the point 0,0,1 with the current roll,yaw and pitch, this returns the current direction
GetTransformX(); // Get X,
GetTransformY(); // Y,
GetTransformZ(); // Z corrdinates of transformed point
GetEntityYaw(char* entity);
GetEntityPitch(char* entity);
Random(a,b); //returns random integer from a to b
AddExplosion(char* explosion, char* bone, float ox, float oy, float oz, (char* ename));
SetPosition(x,y,z); //Teleport to point (x,y,z)
SetAngles(roll,yaw,pitch);
ConvertDegrees(degrees);
Math(char* command, (arguments) ); - math command to do thinghs like square root, get mathmatical constants (e, pi), etc.
PlaySound(char* name);
ApplyForce(char* ename, float x, float y, float z); //Applys a force to an actor, usefull for pushing thinghs when hitting an actor
GetEntityX(char* ename)
GetEntityY(char* ename)
GetEntityZ(char* ename)
Animate(char* anim, bool Hold); //Usefull for animated projectiles
AnimateEntity(char* anim, char* ename, bool Hold=false);
StringCopy(char* string);
DamageEntity(float amount, char* attribute, char* ename); //for compatibility reasons (compatibility to normal scripts, is used when for example a function from another script is called, like my Dioran.DamageTarget(...) function that does all the damage in TowersOfTrembolon)
ModifyAttribute(char* attribute, float amount, (char* ename));


Writeable variables
self.think - write to specify next order

Readable variables
self.current_X
self.current_Y
self.current_Z
self.current_yaw
self.current_pitch
self.current_roll
self.direction_X
self.direction_Y
self.direction_Z
self.target_name -
self.EntityName - the EntityName of the scripted projectile. Will return "ScriptedProjXX" where XX is a number from 0 to 63
self.animate_at_end
self.time -time since the the creation of the scripted projectile, usefull for time-out or something like that
self.time_frame - time passed since last frame

Usage of GlobalValueArrays:
There are only 2 ScriptCommands:
SetGlobalArrayElement(name,index,value);
GetGlobalArrayElement(name,index);

where name is one of those:
ScriptedProjectileParamList
PawnExchange
SkydomeExchange
User0
User1
User2
User3
User4
User5
User6
User7

and index is 0-15 and specifies the index of the value in the array.

To understand the scripted projectiles, open the sample files and look, then try yourself. Ask if you're unsure.

Download Link:
http://www.mediafire.com/?uzux015ntpi

Good night.

EDIT: A patch is available, for more info look at this topic:
http://www.realityfactory.info/forum/vi ... 097#p27097
Last edited by Jay on Mon May 26, 2008 10:56 pm, edited 1 time in total.
Everyone can see the difficult, but only the wise can see the simple.
-----

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: Reality Factory Community Release April 2008

Post by Juutis » Fri Apr 25, 2008 9:52 am

Sweet! Jay, this is excellent! Perfect timing too. I have a 5 day holiday from the army so I have a lot of time to test these features. Awesome work man, simply awesome. :D

**EDIT**
I don't see anything about decals in the sample files. Can a scripted projectile make a decal in the wall just like a normal one? :o
Last edited by Juutis on Fri Apr 25, 2008 4:40 pm, edited 1 time in total.
Pain is only psychological.

Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

Re: Reality Factory Community Release April 2008

Post by Danimita92 » Fri Apr 25, 2008 4:14 pm

Thanks Jay, can't wait to use the ScriptedProjectile

User avatar
madness
Posts: 91
Joined: Mon Feb 11, 2008 5:56 pm

Re: Reality Factory Community Release April 2008

Post by madness » Fri Apr 25, 2008 4:25 pm

.....- .. -.....
.....O...O.....
.........>......
..________..
..\ |||||| /...
.. ------....
................

So excited.
Somewhere in Nevada...

User avatar
fps
Posts: 504
Joined: Mon Sep 26, 2005 9:54 pm
Location: in a magical land devoid of hope, happiness, and sanity.

Re: Reality Factory Community Release April 2008

Post by fps » Fri Apr 25, 2008 4:36 pm

O GOD!
TESTING THIS AS SOON AS I GET OUT OF CLASS.
1 wrote:
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.

2 wrote:
You say that like it's a bad thing.

1 wrote:
You are a bad thing.

User avatar
Sph!nx
Posts: 297
Joined: Thu Feb 22, 2007 7:26 pm

Re: Reality Factory Community Release April 2008

Post by Sph!nx » Fri Apr 25, 2008 10:26 pm

Excellent!! Really superb features. Kudos to anyone who contributed!
Regards Sph!nx

Sven Co-op, DevEd: Development & Editing

Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

Re: Reality Factory Community Release April 2008

Post by Danimita92 » Sun Apr 27, 2008 4:26 pm

Okay, problem here. I copied the files from the download, and suddenly one of my scripts stopped working:

Code: Select all

{

Spawn[()
{
Console(true);
LowLevel("Init");
}]

Init[()
{
    AttachCamera();
    if(GetEventState("AIM") = false)
    {
        PositionToPawn("jugador",-65,-5,-145,true,true);
    }
    if(IsKeyDown(73))
    {
        PositionToPawn("jugador",-45,15,-55,true,true);
    }        
}]

}
It worked fine yesterday, and I haven't done anything to it.

Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Reality Factory Community Release April 2008

Post by Jay » Sun Apr 27, 2008 8:49 pm

Does the console say anything? The RealityFactory.ini (Reader script error)? Maybe you found a bug i didn't know of (All my scripts still work fine)

@Juutis: Thanks that you pointed that out (the decals). Currently they can't. I will certainly add this.
Everyone can see the difficult, but only the wise can see the simple.
-----

Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

Re: Reality Factory Community Release April 2008

Post by Danimita92 » Sun Apr 27, 2008 9:16 pm

The console says "+ Low level script error for camara in Init Order"

Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Reality Factory Community Release April 2008

Post by Jay » Sun Apr 27, 2008 9:25 pm

Ok thanks. I will get to the bottom of this.
Everyone can see the difficult, but only the wise can see the simple.
-----

User avatar
Graywolf
Posts: 75
Joined: Mon Apr 14, 2008 8:36 pm
Location: Anchorage, Alaska
Contact:

Re: Reality Factory Community Release April 2008

Post by Graywolf » Sun Apr 27, 2008 10:42 pm

Ummm... About the arrays. Did you know you could do the same basic thing by adding a global variable to the simkin interpreter, and setting its AddIfNotPresent state to true? You end up with the same basic thing, without limitations on array names or lengths.

Example:

Code: Select all

skTreeNodeObject* data = new skTreeNodeObject();
data->setAddIfNotPresent(true);
interpreter.addGlobalVariable("GlobalData", skRValue(data, true)); // true flag here let's the interpreter handle deletion.
Then, in a script:

Code: Select all

{
FOO ["BAR"]
FOOBAR
{
BAR1 ["bar"]
BAR2 [3.14]
BAR3 ["pie"]

DoSomething[()
{
GlobalData.Foo = FOO;
GlobalData.Array = FOOBAR;
debug(GlobalData.FOO # GlobalData.Array.BAR1 # GlobalData.Array[3]);
}

}

I don't remember right off-hand whether the addIfNotPresent behavior extends to the nodes children...
"So, what's the life of a programmer like?" "...Huh? What life?!"

RF System X:
http://www.realityfactory.info/forum/vi ... f=9&t=3599

User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: Reality Factory Community Release April 2008

Post by metal_head » Mon May 19, 2008 9:00 pm

OK,I really want to try the newton engine,but I don't know how to make the thing work.For example I want a realistic falling barrel,so i put a static entity proxy on my level with the barrel,but there was no change.How can I assosiate the barrel with the engine so it acts realistic I realy need help about it,I have no expiriance working with engines too.Which enity shall I use,do I have to script something... please I need a step by step explanation.

Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Reality Factory Community Release April 2008

Post by Jay » Mon May 19, 2008 10:03 pm

Ask federico. I have no clue about the physics stuff.
Everyone can see the difficult, but only the wise can see the simple.
-----

User avatar
bernie
RF Moderator
Posts: 1249
Joined: Tue Nov 15, 2005 10:07 am
Location: Ireland

Re: Reality Factory Community Release April 2008

Post by bernie » Mon May 19, 2008 10:22 pm

Ok you're going to have to experiment with this one - there's no manual of info.
Place a PhysicsSystem entity in your level and then put your barrel into the level using a PhysicsRigidBody entity and play about with the values. You should get it working. I did this with boxes and spheres but I haven't tried cylinders or capsules yet. Think of it as an exploration and enjoy the experience of braking new ground. Also play around with the PhysicsMaterial entity. It's great fun messing around with these things and who knows... you might become the expert.

Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Reality Factory Community Release April 2008

Post by Jay » Mon May 26, 2008 10:53 pm

A fast patch, for more info look at this topic:
http://www.realityfactory.info/forum/vi ... 097#p27097

Link to the patch:
http://www.mediafire.com/?tlnlx14bntm
Everyone can see the difficult, but only the wise can see the simple.
-----

Post Reply