Topic for enhancements on RF i made

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

Post by Jay »

No, right now inaccuracy is not possible. The scripted projectiles only execute their order when it hits an actor (and not when it hits normal level geometry, this is also to prevent endless-loops of creating projectiles when you let it fire scripted projectiles again when it hits an actor...)
Everyone can see the difficult, but only the wise can see the simple.
-----
User avatar
zany_001
Posts: 1047
Joined: Fri Mar 02, 2007 8:36 am
Location: Aotearoa

Post by zany_001 »

ah, ok.

@juutis how did you achieve inaccuracy on Nirhis?
Once I was sad, and I stopped being sad and was awesome instead.
True story.
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis »

zany_001 wrote:@juutis how did you achieve inaccuracy on Nirhis?
Scripted weapons. I simply randomized the point where the projectile is shot.

@Jay: Great work! I can't wait for the scripted projectiles. I already have a couple of uses for them. :)
However, I'd like to be able to execute an order when the projectile hits the level geometry also. It would let us create more realistic fragmentation grenades if the projectile could shoot other projectiles around it whenever it hits something.
Pain is only psychological.
User avatar
fps
Posts: 504
Joined: Mon Sep 26, 2005 9:54 pm
Location: in a magical land devoid of hope, happiness, and sanity.

Post by fps »

I think we need have a seperate order availble for the execution with the geometry and i also think we need seperate collision oreders for different material.
i dont know how we would do it but i think that things like water should have a different effect on the projectile. what do you think?
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.
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Post by Jay »

Hm. Maybe with a Liquid entity... Maybe i should just add a new command GetLastProjHitType(). This could then be "Actor", "Liquid", "Model", or "Level". And then you could get the entitynames of those (if possible) and in this way you could affect the projectile further. Then we also needed a comand called TerminateScriptedProjectile(), which is then the only way to destroy a scripted porjectile. This way they could pass a Water-Liquid (with entityname "Water") but then explode on the wall beneath it... Or a flamewave spell that just stops when it hits a solid wall, but will go through actors and damage them all. I don't know if it makes any sense if i let you get the entityname of a projectile and by that you could give it attributes, so it will hit a maximum of 5 enemies and then it will be destroyed... It would also be possible to implement a SetProjectileDirection(x,y,z) command that lets you specify if it will bounce off or change its direction according (A light spell might bounce off a Mirror-model)

But this is all theorethitacally here, nothing of it implemented.
Everyone can see the difficult, but only the wise can see the simple.
-----
User avatar
fps
Posts: 504
Joined: Mon Sep 26, 2005 9:54 pm
Location: in a magical land devoid of hope, happiness, and sanity.

Post by fps »

as long as it is open, the boundires are non existant.
however i might add that bullets don't pass through water so well. moving that fast the particals of water can't get out of the way too quiclky. its like shooting balistic gel. it depends on the conditions but somtimes a bullet can skip of water like it were a flat stone movig thousands of feet per seccond.
anyways,
ADD moment.
got to go.
ps. check out my videos in the game dev fourm.
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.
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Post by Jay »

No problem. You just use a SpeedValue (i think it was called like that?) for your Liquid entity... You know, the one that influenes speeds...
Everyone can see the difficult, but only the wise can see the simple.
-----
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

It has been a while

Post by Jay »

So. It has been a while. In the past few months i was mainly focusing on learning for my end-of-school tests (Abitur). Now that they are written, and now that federico has given me the beta he used to compile his RF NGD, i have started to work again.

I have built my stuff on the physics release, so the release could be called the RFNGD+ release. I don't like this name however, so i will just name it 'RealityFactory CR April 2008'. This release adds (based on what is possible with RF075C)

physics (implemented)
Enhanced pawn weapon system (implemented)
simplified version of particle wind, without the WindGenerator, you just set the wind and enabled/disable it. (implemented)
SetAttribute() and GetAttribute() for skydomes (not yet implemented)
Controllable particle wind by skydome script so that you don't have to have an extra pawn just for the wind, also good to sync the skydome wind and particle wind (not yet implemented)
Some speed optimizations

AND

the ScriptedProjectile. (work in progress)

I have changed the design of the scripted projectile completely. It will now run in an extra script, with extra commands. Maximum of ScriptedProjectiles is 64 at the moment. You will be able to pass parameters to the script through a script command and when the scripted projectile is created they are passed to it. These parameters will be stored in an array which you will specify with the AddScriptedProjectile(char* type, char* script, char* startorder, char* paramarray); command.
To make a scripted projectile, you first have to make a section in sprojectile.ini which will be similar to the pawn.ini sections.

To give you an example of how a scripted projectile script might look, this is a simple targetting rocket script:

Code: Select all

{

   //Parameter array, will be filled from outside ('outside' is the calling script)
   PARAMETERS
   {
      0   [0]  //calling entity
      1   [0]  //target
      2   [0]  //damage attribute
      3   [0]  //damage amount
   }
   
   COLLISION_TYPE   [0]

   Setup[ () //specified as start order
   {
      SetSpeed(200); //move 200 texels pers second
      SetTarget(PARAMETERS[1]); //target it, move will automaticly move to target
      self.think="Frame";
   } ]
   Frame[ ()
   {
      COLLISIONT_TYPE=CheckForCollision();
      switch(COLLISION_TYPE)
      {
      case 0
      {
         //nothing happend
         return;
      }
      case 1
      {
         //is in liquid, pass through
         return;
      }
      case 2
      {
         //hit actor
         DamageActor(GetHitName(),PARAMETERS[2],PARAMETERS[3]);
         Remove();
         return;
      }
      case 3
      {
         //hit DestroyableModel
         DamageModel(GetHitName(),PARAMETERS[2],PARAMETERS[3]);
         Remove();
         return;
      }
      default
      {
         //hit level or something else that doesn't interest us
         Remove();
         return;
      }
      } //close switch
      Move(); //move with speed texels/second to the target 
      FaceActor(PARAMETERS[1]); //Rotate to target, not needed for Move(), but for better visuals
      //so that rocket always seems to be flying towards the enemy 
   } ]

}

Of course it will also be possible to just move like every other projectile would do.

I will still need a week or two, to stay realistic.
Everyone can see the difficult, but only the wise can see the simple.
-----
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: Topic for enhancements on RF i made

Post by fps »

YEEEEEEEEEEEEEEEESSSSSSSSSSSSSSSSSSSSS!
You are my hero!
:mrgreen: :mrgreen: :mrgreen:
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.
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Topic for enhancements on RF i made

Post by Jay »

Thanks. Progress is good, the scripted projectiles are working even better than i imagined.

Here is an overview over the implemented commands and variables that are accessible through a scripted projectile script:

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));

An AddAttribute(...) command is planned.

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
Everyone can see the difficult, but only the wise can see the simple.
-----
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: Topic for enhancements on RF i made

Post by fps »

I am drooling with anticipation. :o
How easy would it be to have, say; A projectile that does fire damage instead of regular damage.
What would be the BEST WAY of adding that to a pawn script to check for both health and burn attributes.
(just because I will need to update my scripts now)
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.
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Topic for enhancements on RF i made

Post by Jay »

it would be relatively easy. You have a function which does the damage, maybe like this (It's a short version of my own function which i use in TowersOfTrembolon):

Code: Select all

DamageTarget[ (target,attribute,amount,type)
{
   FINAL_AMOUNT=StringCopy(amount)-GetAttribute("r_" # StringCopy(type),StringCopy(target)); 
   //Get resistance and substract it from the damage, the resistance attribute is called r_TYPE
   if(FINAL_AMOUNT<1) //1 is minimal damage
   {
      FINAL_AMOUNT=1;
   }
   DamageEntity(FINAL_AMOUNT,StringCopy(attribute),StringCopy(target));
}
The best place to place this is the scripted player, if you use one.
And then you can use it in any script. If your scripted player's entityname is 'ScriptedPlayer' then you do
ScriptedPlayer.DamageTarget(enemy,"health",5,"fire"); to deal 5 fire damage on the target.

In a scripted projectile, you would also add an explosion for the fire as soon as you hit somthing.


Also, progress on the release:
The release is going to be VERY soon. I tried to get the ParameterList to work the whole week, but i could not get it to work. I now use another idea, which is called GlobalArray. A global array is an array of values which can be read and written to by every script, and every type of script (Pawn,Skydome,Projectile). There are a couple of arrays, namely:

ScriptedProjectileParamList
PawnExchange
SkydomeExchange
User0
User1
User2
User3
User4
User5
User6
User7

The names are only suggestions to what you can use them for.
There are 4 script commands for the arrays, namely:
SetGlobalArray(char* name, (values)); //Sets the array
SetGlobalArrayElement(char* name, int index, value); //sets an element in the array
GetGlobalArrayElement(char* name, int index); //retrieves an element of the array
GetGlobalArrayLenght(char* name); //retrieves the number of items in the array

With those, you can also increase the functionality of other scripts, not only the scripted projectile.
Everyone can see the difficult, but only the wise can see the simple.
-----
User avatar
madness
Posts: 91
Joined: Mon Feb 11, 2008 5:56 pm

Re: Topic for enhancements on RF i made

Post by madness »

but what if we wanted the character to detect fire as a different type of damage and then execute an order like a special death in response?
Somewhere in Nevada...
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Topic for enhancements on RF i made

Post by Jay »

then you use an attribute for the pawn that is damaged that has the type of the last dealt damage. In the Die order you would just check it and procced from there. Or you use a GlobalArray that contains information about the last dealt damage.
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: Topic for enhancements on RF i made

Post by Graywolf »

Hmmm... Want some help?
"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
Post Reply