Tired of setting up KickVelocity? Easy Kicker Mod!

Need some nice Mods? Here, you are right!
User avatar
Gustavo6046
Godlike
Posts: 1462
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Resident Wallaby
Location: Porto Alegre, Brazil
Contact:

Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Gustavo6046 »

Hello guys! :) I don't know if this already have been done (if yes, then feel free to close this thread, unless you don't want to), but I have two cool actors that will probably make a revolution in the way of making JumpPads. It's called EasyKicker and EasyKickerDest. It doesn't replace the default Kicker but allows to set up a destination point instead of having to manually set up the KickVelocity (ah man, how I hate that!). Setting up a jump pad becomes very simple!
  • Make a LiftCenter in the jump pad's location and a EasyKickerDest in the destination of the jump pad.
  • Link the LiftCenter and EasyKickerDest (the latter which is a LiftExit subclass).
  • Copy EasyKickerDest's name in the Object tab and paste it in the DestinationName field in the EasyKicker.
  • Lastly set KickHeight to the height of the apex of the arc, so that e.g. the kicked pawn can overgo obstacles beyond which (or go up the gap above which) lies the EasyKickerDest!
  • Not forgetting you can also set bRandom and bKillVelocity in Kicker tab as you would normally!
And you're done! This time I tested it because I used the fan to provide wind to cool down the PC. However I had to ask too much to family members because they said they wanted it too!

Download Now!

The algorithm is actually pretty simple. This EasyKicker just subtracts the location of corresponding EasyKickerDest by its own location and stores the result in KickVelocity, adding KickHeight to the Z part later. Tadaa! :)

Also, if I shouldn't have posted this, please don't get insane as most people get :( I just wanted to share this solution!

EDIT: To secure the situation, I must argue I didn't found anything like this when searching UT99 using that search bar. So I guess this is safe :)
"Everyone is an idea man. Everybody thinks they have a revolutionary new game concept that no one else has ever thought of. Having cool ideas will rarely get you anywhere in the games industry. You have to be able to implement your ideas or provide some useful skill. Never join a project whose idea man or leader has no obvious development skills. Never join a project that only has a web designer. You have your own ideas. Focus on them carefully and in small chunks and you will be able to develop cool projects."

Weapon of Destruction
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by PrinceOfFunky »

Gustavo6046 wrote:Also, if I shouldn't have posted this, please don't get insane as most people get :( I just wanted to share this solution!
Don't say "please" to people who get insane .o. They might say please to not to be judged, when they get insane :D lol
"Your stuff is known to be buggy and unfinished/not properly tested"
User avatar
Gustavo6046
Godlike
Posts: 1462
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Resident Wallaby
Location: Porto Alegre, Brazil
Contact:

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Gustavo6046 »

PrinceOfFunky wrote: Don't say "please" to people who get insane .o. They might say please to not to be judged, when they get insane :D lol
Great jokel! :loool: (is that a Minecraft sign?)
"Everyone is an idea man. Everybody thinks they have a revolutionary new game concept that no one else has ever thought of. Having cool ideas will rarely get you anywhere in the games industry. You have to be able to implement your ideas or provide some useful skill. Never join a project whose idea man or leader has no obvious development skills. Never join a project that only has a web designer. You have your own ideas. Focus on them carefully and in small chunks and you will be able to develop cool projects."

Weapon of Destruction
User avatar
Gustavo6046
Godlike
Posts: 1462
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Resident Wallaby
Location: Porto Alegre, Brazil
Contact:

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Gustavo6046 »

Double-post (24 hours has passed and I NEED HELP) and....

I decided to make it EVEN EASIER! So

1. You would put a LiftExit near the start, a EasyKicker2 in the jump pad, and a EasyKickerDest in the destination.
2. Match their all's LiftTag and the EasyKicker2's DestTag with EasyKickerDest's Tag.
3. Set bKilLVelocity to true and tweak the collision of EasyKicker2.

However it isn't working! i.e. isn't kicking you.
Here's the code:

Code: Select all

//=============================================================================
// EasyKicker2, the world's easiest UT99 jump-pad.
//=============================================================================
class EasyKicker2 expands LiftCenter;

var				vector	KickVelocity;
var(EasyKicker)	name	KickedClasses;
var(EasyKicker)	bool	bKillVelocity;
var(EasyKicker)	bool	bRandomize;
var(EasyKicker)	name	DestTag;

function float VSizeSq(Vector a)
{
  return a dot a;
}

function PreBeginPlay()
{
	local	EasyKickerDest	A;
	local	float			Closest;
	local	float			SQD;

	Closest = 0;

	foreach AllActors(class'EasyKickerDest', A, DestTag)
	{
		SQD = VSizeSq(A.Location - Location);

		if ((SQD < Closest) || (Closest == 0))
		{
			Closest = SQD;
			KickVelocity = A.Location - Location;
			KickVelocity.Z += sqrt(SQD) / 2;
		}
	}
}

simulated function Touch( actor Other )
{
	local Actor A;

	if ( !Other.IsA(KickedClasses) )
		return;
	PendingTouch = Other.PendingTouch;
	Other.PendingTouch = self;
	if( Event != '' )
		foreach AllActors( class 'Actor', A, Event )
			A.Trigger( Other, Other.Instigator );
}

simulated function PostTouch( actor Other )
{
	local bool bWasFalling;
	local vector Push;
	local float PMag;

	bWasFalling = ( Other.Physics == PHYS_Falling );
	if ( bKillVelocity )
		Push = -1 * Other.Velocity;
	else
		Push.Z = -1 * Other.Velocity.Z;
	if ( bRandomize )
	{
		PMag = VSize(KickVelocity);
		Push += PMag * Normal(KickVelocity + 0.5 * PMag * VRand());
	}
	else
		Push += KickVelocity;
	if ( Other.IsA('Bot') )
	{
		if ( bWasFalling )
			Bot(Other).bJumpOffPawn = true;
		Bot(Other).SetFall();
	}
	Other.SetPhysics(PHYS_Falling);
	Other.Velocity += Push;
}

//=============================================================================
// EasyKickerDest.
//
// Marks the destination location for the corresponding EasyKicker actor.
//=============================================================================
class EasyKickerDest expands LiftExit; 

EDIT: Nevermind, I just found out I FORGOT to set KickedClasses! :loool:
"Everyone is an idea man. Everybody thinks they have a revolutionary new game concept that no one else has ever thought of. Having cool ideas will rarely get you anywhere in the games industry. You have to be able to implement your ideas or provide some useful skill. Never join a project whose idea man or leader has no obvious development skills. Never join a project that only has a web designer. You have your own ideas. Focus on them carefully and in small chunks and you will be able to develop cool projects."

Weapon of Destruction
User avatar
Wormbo
Adept
Posts: 258
Joined: Sat Aug 24, 2013 6:04 pm
Contact:

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Wormbo »

I'd like to point out that, while calculating VSizeSq generally would be faster than calculating VSize if both were implemented at the same level, the UnrealScript implementation of VSizeSq will always be slower than the native implementation of VSize.
Do yourself a favor and follow the two basic rules for optimization:
  1. Don't do it!
  2. (for experts only) Don't do it yet!
You'd be lying to yourself if you already consider yourself an expert, so just stick to rule 1 for now.
But if you are trying to venture into the unknown that is rule 2, keep this in mind: The only justification for an optimization of this kind would be evidence that the optimized version actually is faster. (if you're really lazy, a solid theoretical proof may be just enough, but nothing beats actual measurement)
User avatar
Gustavo6046
Godlike
Posts: 1462
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Resident Wallaby
Location: Porto Alegre, Brazil
Contact:

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Gustavo6046 »

@Wormbo Well since the entire thing is calculated at KICKIN TIME it means it isn't necessary to be very fast. Now I have to determine the height.

EDIT: Problem! I tried

Code: Select all

function PreBeginPlay()
{
	local	EasyKickerDest	A;
	local	float			Closest;
	local	float			SQD;
	local	float			NQD;
	local	float			HQD;

	Closest = 0;

	foreach AllActors(class'EasyKickerDest', A, DestTag)
	{
		NQD = VSize(A.Location - Location);
		SQD = NQD ^ 2;
		HQD = (A.Location - Location).Z;

		if ((SQD < Closest) || (Closest == 0))
		{
			Closest = SQD;
			KickVelocity = A.Location - Location;
			KickVelocity.Z = ((A.Location.Z - HQD) / SecondsToDestination) + ((-Level.ZoneGravity.Z * SecondsToDestination) / 2);
		}
	}
}
but at some jump pads I get launched like twice the power needed! (Exactly twice!!) Who can help? Someone good with Math?
"Everyone is an idea man. Everybody thinks they have a revolutionary new game concept that no one else has ever thought of. Having cool ideas will rarely get you anywhere in the games industry. You have to be able to implement your ideas or provide some useful skill. Never join a project whose idea man or leader has no obvious development skills. Never join a project that only has a web designer. You have your own ideas. Focus on them carefully and in small chunks and you will be able to develop cool projects."

Weapon of Destruction
User avatar
FXANBSS
Skilled
Posts: 231
Joined: Thu Dec 26, 2013 7:03 pm

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by FXANBSS »

Oh no, never, BUT NEVER A CLASS MUST END IN A NUMBER.

It was Waffnuffly's nightmare, if there is a EasyKicker and EasyKicker2 then the "Name" value f*cks itself and sh*t happens.
User avatar
Gustavo6046
Godlike
Posts: 1462
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Resident Wallaby
Location: Porto Alegre, Brazil
Contact:

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Gustavo6046 »

FXANBSS wrote:Oh no, never, BUT NEVER A CLASS MUST END IN A NUMBER.

It was Waffnuffly's nightmare, if there is a EasyKicker and EasyKicker2 then the "Name" value f*cks itself and sh*t happens.
Fixed. Now it is EasyKickerModII instead of EasyKicker2. Just a mistake in putting "mod"...

What information should the destination hold other than LiftTag?
"Everyone is an idea man. Everybody thinks they have a revolutionary new game concept that no one else has ever thought of. Having cool ideas will rarely get you anywhere in the games industry. You have to be able to implement your ideas or provide some useful skill. Never join a project whose idea man or leader has no obvious development skills. Never join a project that only has a web designer. You have your own ideas. Focus on them carefully and in small chunks and you will be able to develop cool projects."

Weapon of Destruction
User avatar
Wormbo
Adept
Posts: 258
Joined: Sat Aug 24, 2013 6:04 pm
Contact:

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Wormbo »

FXANBSS wrote:Oh no, never, BUT NEVER A CLASS MUST END IN A NUMBER.
That's actually more of a guideline than a rule. In fact, there are dozens of UT classes, including the body armor and many decorations, effects and player models that end with a digit.
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by sektor2111 »

They are asleep, else a normal human being awake can see that we don't have any issue at using numbers at end of a class.
User avatar
Gustavo6046
Godlike
Posts: 1462
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Resident Wallaby
Location: Porto Alegre, Brazil
Contact:

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Gustavo6046 »

And why am I launched at double the power at some jump pads without bHalve?
"Everyone is an idea man. Everybody thinks they have a revolutionary new game concept that no one else has ever thought of. Having cool ideas will rarely get you anywhere in the games industry. You have to be able to implement your ideas or provide some useful skill. Never join a project whose idea man or leader has no obvious development skills. Never join a project that only has a web designer. You have your own ideas. Focus on them carefully and in small chunks and you will be able to develop cool projects."

Weapon of Destruction
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Barbie »

FXANBSS wrote:Oh no, never, BUT NEVER A CLASS MUST END IN A NUMBER.
(Isn't that a double negation? ^^)

I can imagine that trouble comes in if you have different classes where their names distinct only in the digits in the end, eg:

Code: Select all

class SuperActor extends WhatEver;
class SuperActor1 extends WhatEverOther;
If you add an instance of SuperActor it will be named SuperActor0. If you add an instance of SuperActor1 it will be named SuperActor10. What class is an instance with the name SuperActor123 then? (I remember dark I've read somewhere that later engines adds an underscore to the class name before numbering to avoid that.)
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by sektor2111 »

Class is just Class and Object.Name is a name assigned to that class in current instance, class stay but name differs because it gets wrapped - class never changes unless you bind some crappy stupid native to mock everything. That's why you fail, my dear coders...
[attachment=0]Class_VS_ObjectName.png[/attachment]
And for extra light
I'm writing
Pawn(Other) != None
Not really
Pawn1343(Other) != None. :lol2:

Honestly I'm feel sorry for coders which are confusing Object.Name with Class. This leads only in a general failure, not exactly that General Failure which sometimes is accessing your drives :mrgreen: .
Attachments
Class_VS_ObjectName.png
Class_VS_ObjectName.png (8.64 KiB) Viewed 4146 times
Higor
Godlike
Posts: 1866
Joined: Sun Mar 04, 2012 6:47 pm

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Higor »

Gustavo6046 wrote:function float VSizeSq(Vector a)
{
return a dot a;
}
Bad UnrealScript for the use you're giving it.
Slow because it causes a function lookup (via a field iterator)
Slow because it causes allocation of a new script stack (uscript function call).
Slow because you're passing (a) three times (one in VSizeSq, two in DOT)
Slow at an order of 10 times i'd say.
Use VSize( vector V)



Gustavo6046 wrote: Closest = 0;

foreach AllActors(class'EasyKickerDest', A, DestTag)
{
SQD = VSizeSq(A.Location - Location);

if ((SQD < Closest) || (Closest == 0))
Bad 'closest element' algorithm.
Your upper limit should be infinity or the engine's max distance.
You should use a single check.
Try this

Code: Select all

]   ClosestD = 100000;

   foreach AllActors(class'EasyKickerDest', A, DestTag)
   {
      Dist = VSize(A.Location - Location);

      if ( Dist < ClosestD )
I'd personally calculate the kick velocity on the fly, and instead cache the destination reference.


Barbie wrote:If you add an instance of SuperActor it will be named SuperActor0
Right
Barbie wrote:If you add an instance of SuperActor1 it will be named SuperActor10
Wrong, digits are chopped off starting from the right until a letter is found.

The name generator generates the same output for both examples.


============================================
XC_Siege_r3.u
(192.98 KiB) Downloaded 99 times
https://github.com/CacoFFF/SiegeIV-UT99 ... README.txt

Lookup XC_TargetedKicker

============================================
This map has a UT3 styled variation of this kicker (and linked nodes allowing good bot usage)
https://www.ut99.org/viewtopic.php?f=5& ... 572#p69578
The variation will enforce speed for a very short while so high air control won't screw up your landing.
User avatar
Gustavo6046
Godlike
Posts: 1462
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Resident Wallaby
Location: Porto Alegre, Brazil
Contact:

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Gustavo6046 »

Oh but mine's power can be scaled, and bots use it well, and here is a AS-Frigate variation with two jump pads!

Annexed are the files needed to run it.
Attachments
EasyKickerMod.zip
Easy Kicker Mod + EKM-II
(2.65 KiB) Downloaded 106 times
"Everyone is an idea man. Everybody thinks they have a revolutionary new game concept that no one else has ever thought of. Having cool ideas will rarely get you anywhere in the games industry. You have to be able to implement your ideas or provide some useful skill. Never join a project whose idea man or leader has no obvious development skills. Never join a project that only has a web designer. You have your own ideas. Focus on them carefully and in small chunks and you will be able to develop cool projects."

Weapon of Destruction
Post Reply