RocketX3.JumpDetectorVX

Tutorials and discussions about Mapping - Introduce your own ones!
Post Reply
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

RocketX3.JumpDetectorVX

Post by Barbie »

I recently tried the map "MH-DinoPlanet2011[THUNDERBOLT]FIX02" on my test server and got spammy log entries like this:
ucc.init.log wrote:JumpDetectorVX MH-DinoPlanet2011[THUNDERBOLT]FIX02.JumpDetectorVX3 (Function RocketX3.JumpDetectorVX.Tick:000C) Accessed None
I inspected the code (look at the last line)

Code: Select all

/** Used for jump detection, so we can eject riders and
	gunners. Checks for jump boots in the inventory and tries to manage
	the bCountJumps variable which we need to be set to true. After jump
	boots where off they set it to false.

	Only used in standalone games.
*/
class JumpDetectorVX extends TournamentPickup;
...
/** We could make this a timer but it's for standalone games only,
	and even for just that one split second you wouldn't have been
	able to eject, it'll be worth it.
*/
function tick(float delta) {
	Pawn(owner).bCountJumps = true;
}
So if owner is None, an error message is written to log every tick for every "JumpDetectorVX". Is this a known misbehaviour?
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
SC]-[WARTZ_{HoF}
Adept
Posts: 426
Joined: Tue Feb 21, 2012 7:29 pm

Re: RocketX3.JumpDetectorVX

Post by SC]-[WARTZ_{HoF} »

This is a RocketX3 issue most likley. Mappers seem to not take into account that some versions of RocketX still have unresolved issues. Feralidragon, ][X][~FLuKE~][X][, and maybe =(V)=Mar could probably help you better with more details.
Last edited by SC]-[WARTZ_{HoF} on Sun Feb 14, 2016 8:10 pm, edited 1 time in total.
Image
Image
Image
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: RocketX3.JumpDetectorVX

Post by sektor2111 »

Cough - fake codes, man, fake coders...

Code: Select all

function tick(float delta) {
   Pawn(owner).bCountJumps = true;
}
Pretty stupid by default. When you wanna debate a value from something, make sure about its existence first. If you do this crap in C++ = the mostly will result in instant crash (unless M$ will apology for inconveniences caused by dumb coding).
And that's all about two digits suffix "fix02".

Code: Select all

function tick(float delta) {
if (Pawn(Owner) != None)
   Pawn(owner).bCountJumps = true;
}
I'm not sure if it doesn't need a little revision... related to Health > 0 or other kinda incompatible states. Also a self check would be priceless.

Code: Select all

function tick(float delta) {
if ( bDeleteMe ) return;
if (Pawn(Owner) != None && !Pawn(Owner).bHidden && Pawn(Owner).Health > 0 ) //this line might be longer
   Pawn(owner).bCountJumps = true;
}
My rules = My MH won't have such things any more, I have cleaned the ground 2 years ago - and I'm happy without 0 Owners Accessed in Ticks, LOL.
You can screw original file because it's a log spammer. For God I never understood why tick errors have been released, they are not isolated and rare - are crap loading hard drives and disk-space was a problem in the past for many admins.
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: RocketX3.JumpDetectorVX

Post by Barbie »

Found another candidate with a JumpDetectorVX that causes Access Nones on every tick: MH-SkyCorebeta5+fix3.
In both maps I simply remove them while map is loaded.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: RocketX3.JumpDetectorVX

Post by sektor2111 »

An XC Actor can spawn in such a "Level" calling another function rather than "awesome" original garbage. I'm doing this with Shrimp's Titans (rotating boulders in such a Level is a MUST-HAVE for me)...
nogardilaref
Masterful
Posts: 577
Joined: Tue Jun 20, 2017 1:00 pm
Personal rank: ⚋⚊⚌☰⚞⌖⚟☰⚌⚊⚋

Re: RocketX3.JumpDetectorVX

Post by nogardilaref »

sektor2111 wrote:

Code: Select all

function tick(float delta) {
   Pawn(owner).bCountJumps = true;
}
Pretty stupid by default. When you wanna debate a value from something, make sure about its existence first. If you do this crap in C++ = the mostly will result in instant crash (unless M$ will apology for inconveniences caused by dumb coding).
I know this is pretty old, but since this topic was bumped I just want to address this: checking for something's existence first is NOT what you always want to do.
By always "checking" something you are potentially hiding a bigger problem in your code.

In places where it's really expected that something might be None (or null or nil in other languages), which is this case as a matter of fact (you never control what the Owner might be in the next tick since Owner is something any actor can and will change over time), then yes, you should validate.

However, if you happen to have a reference that only you control and is never expected to be None, validating would mean that you doubt your own code and you could be hiding a bigger problem in it by doing such a check.
Not only that, for whoever else reads the code, is led to believe that a null reference is indeed an acceptable value for the program, when that might not be the case.

Warnings should be avoided, but they exist for a good reason, and that is debug, and in the case you're not actually expecting something to be a null reference, the correct fix is not to validate the input, but actually to check why it's a null reference in the first place and fix the underlying problem.

In UScript, 95% of the cases you will need to validate the references since all properties are public by default, so they can be changed by any actor at any given time, specially common ones like the Owner.
However, if you're going to bring things like C++, or even C# or Java, you will actually want to validate something in just a few cases, not only because of performance, but because in such languages most properties and methods are not public so all the calls are generally in your control, and in these cases you really want for the program to crash (naturally or through an assertion) if something weird happens that causes something that you expected to hold a valid reference to not actually hold one.

The same goes for scalar values (integers, floats, strings, etc): if you're not expecting a string to ever be empty, you should not validate this use-case. At most, you should assert it for debugging.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: RocketX3.JumpDetectorVX

Post by sektor2111 »

nogardilaref wrote: By always "checking" something you are potentially hiding a bigger problem in your code.
By Always checking target actor before accessing it you will never deal with a NONE and then you can deal with the other situation as well - when is equal to None. These ticks were spamming me for years loading a crapton of data in server logs making other things harder to be read, and even finally crashing due to large file open heavy to handle for those machines and lazy drives - not to mention if something says "ScriptWarning" in Uscript, that is not for fancy lines, there is a problem and it's pretty much visible for this case. This function is a tick and ticks with no sanity checkers = spam crap like those garbage zombies filling drives with errors :loool: . So these are bad codes by default you cannot convince me about them as being quality because they are not. I'm not gonna mention when you are losing rocket in water and HUD problems - all this class is messed up. Else EPIC forgot their None check resulting in crashing servers, best sample is PlayerCanSeeMe native fixed by Higor - that is just a fart proving that you need to write sanity checkers all time because they doesn't hurt at all - else prove what is wrong at this point.
Things which are not need always checkers might be owned actors spawned - is just a... presumption. Why ? Simple answer: Some dumb mappers are adding these non-mapping actors in their levels doing shit. So, by Not using wrappers you are in for some surprise - another great sample is AssaultRandomizer when is not used in Assault game-type. As conclusion, you'll never see me with not using sanity checkers...
As for my "gratitude" around these brain-farts rushed in noob style, I have removed any "MAP" having string "KongLauncher" inside, no more headaches. Bot will never handle that fart, so I will have no support - good night, ideas, and sweet dreams at bottom of RecycleBin.

Aside for hidden issues in mods, using LOG lines for debugging is another way of doing stuff, they are very helpful in finding why weapon X did not fire or such... more stuff can be written correctly by USING Sanity Checkers and LOGS on demand. Perhaps you need a sample ? Watch this... editing...

Code: Select all

function tick(float delta)
{
	if ( bDeleteMe ) return;
	if ( Pawn(Owner) != None && !Pawn(Owner).bHidden && Pawn(Owner).Health > 0 ) //this line might be longer
		Pawn(owner).bCountJumps = true;
	else
	{
		log (Self@ have no Owner...);
		Disable('Tick');	//Stop crapping Engine useless
							//enabling it when is being touched / picked up
	}
}
There are always multiple solutions, but no one cares - they only love to do "stuff" finding different excuses for crap released in public. Perhaps the bigger problem in code was executing an useless tick which doesn't make sense here...
nogardilaref
Masterful
Posts: 577
Joined: Tue Jun 20, 2017 1:00 pm
Personal rank: ⚋⚊⚌☰⚞⌖⚟☰⚌⚊⚋

Re: RocketX3.JumpDetectorVX

Post by nogardilaref »

Consider the following:

Code: Select all

abstract class UOperator extends Object;

function float calculate(float X, float Y)
{
	return 0.0;
}

Code: Select all

class SumOperator extends UOperator;

function float calculate(float X, float Y)
{
	return X + Y;
}

Code: Select all

class OperatorsMap extends Object;

var private SumOperator sum_operator;

function UOperator getSumOperator()
{
	return sum_operator;
}

Code: Select all

class Calculator extends Object;

function float calculate(name Operation, float X, float Y)
{
	local OperatorsMap operators_map;
	local UOperator u_operator;
	
	operators_map = new class'OperatorsMap';
	if (Operation == 'sum') {
		u_operator = operators_map.getSumOperator();
	}
	
	if (u_operator != None) {
		return u_operator.calculate(X, Y);
	}
	return 0.0;
}

Code: Select all

calculator = new class'Calculator';
number1 = calculator.calculate('sum', 10, 5);
number2 = calculator.calculate('diff', 10, 5);
This code has 2 big problems, both caused by the extreme kind of sanitization checks you advocate.
Can you figure them out?

In programming, there's generally something called a "contract" or "interface" (it has even other names), in which if you say "function F always returns X" you should trust that it will always be so, because that's what the contract that was defined enforces.
If F does not return X for some reason however, your code should not attempt to sanitize the output and continue to run as if nothing happened, the code should "fail" as quick as possible with a clear message of what happened.

By "fail" it can be a crash (natural or through an assertion) or it can be something more graceful as long as the program doesn't internally pretend that everything is just fine.
Do you understand what I am getting at?

Because, the moment an expectation fails to be met, and you keep running the code like absolutely nothing happened, you will endanger yourself into entering an "undefined" state, which will lead to further problems and weird behaviors, which you won't be able to trace back to the real origin and thus you will have a hard time to debug.
Even a more dangerous situation would be when the expectation fails to be met, but you never know about it because "apparently" everything works fine, until it "randomly" stops working.

The latter one is the kind you're actually advocating for, whether you're aware of this yourself or not, because you're so blindly focused in avoiding the logs and crashes themselves, that you don't seem to care at all "why" they happen in the first place, and then end up calling honest developers "dumb", "lazy" and whatnot.

Sanitizing something for the sake of sanitizing is just as bad as never sanitizing at all, there's actually a middle-ground.


Having that said, in UScript itself, like I mentioned previously, the very fact that the vast majority of the references are public and can be freely modified by other actors in runtime, grants that in most cases you just have to account for the fact that the reference might be None, even when spawning actors (not only because of the reasons you highlighted, but even because a valid actor might spawn in a non-valid location).
So what you're doing in this specific case is NOT wrong at all, on the contrary.

Maybe most of the fixes you do are the correct ones in UScript itself, due to its nature, I am not saying otherwise.
It's just the overall idea of what you're advocating is simply not right, specially when it comes to other languages such as C++.

Also, sanitization checks are not free, so there's always a performance hit when doing them, although it's not nearly as significant as the actual problems it causes down the road.


TL\DR: Do checks, yes, but don't do it just for the sake of cleaning the logs.
Like you said, they're just not fancy lines, they serve a purpose, however you're actually treating them as such.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: RocketX3.JumpDetectorVX

Post by sektor2111 »

You can use whatever mods (original MH included trying to assign a score for an unexistent PlayerReplicationInfo), for me that chapter is closed and... amazingly game runs more stable than I ever ran...
I have lost interest to look at logs having 20 MB in a few minutes, so you will not convince me to leave warnings just for some "safety".
Right now I was coding some Navigation stuff for some map, imagine that it will not include anything like a ScriptWarning, and BTW I was clocking (using XC_Core) how much time takes a sanity checker - doesn't hurt even an old rig at 1 GHz... it's more faster than a blink...
By trying to setup something which doesn't exist is way more exhaustive that simply checking proximity. I'm not gonna stop you to not use checks if they "hurt" that much, but... in my case will not gonna happen because right now I'm not gonna quit my stability because of some "innocent ScriptWarning"s - those things are not innocent, are messages telling you: Hey, you have a problem here...
More or less, ticks spamming these are not only annoying, but are even trouble makers. And, I'm not fooling with Objects in this Engine which sometimes is unable to collect garbage properly.
This is just my simple way of doing.
Edit:
About using term "honest developers", let me quote someone who made TeamCannon from Team=0 to hunt players from the same team - yeah... very honest, no wonder. Since all A.I was f...ed up, what exactly is the reason to not say that guy is an ass who think he was helping. By making a code-soup community goes nowhere, the mostly annoying people rather than making them to have fun... The comment was - : P - with meaning tongue out probably having fun - oh dear how much I would like a hammer slapped on that tongue - for fun too... just a reward for damaging original rules.
nogardilaref
Masterful
Posts: 577
Joined: Tue Jun 20, 2017 1:00 pm
Personal rank: ⚋⚊⚌☰⚞⌖⚟☰⚌⚊⚋

Re: RocketX3.JumpDetectorVX

Post by nogardilaref »

I am not sure if it's a language barrier or if it's just me who's being unclear, but you're clearly not understanding what I am saying at all, as that's not what I am saying at all.

You took my example waaaaay too literally (I used Objects for simplicity, to make a point in a way you could easily understand), and I never said that the warnings were "innocent", I have been stating the polar opposite of that in fact, and I am not even trying to stop what you're doing, and I am not even saying that what you're doing is wrong, at all.
I am not saying to never check for things either, you're twisting so hard what I say in such a way that in the end this is not really being as productive as I would like to.


All that I am saying, and this is as short and as clear as I can make it: you're sanitizing everything, and it's working out for you, and that's great and all, but you're doing it for the wrong reasons, and there are situations where not sanitizing is actually the right thing to do.
Only because a program is not logging errors and is not crashing, does not mean it's working as it should. And you won't really know the way it should work if you're focusing in single calls and in single problems.


On an unrelated note: keep in mind that calling other developers "dumb", "asses" or "fakes" due to a few mistakes here and there while overlooking the bigger picture, does not make yourself any better than them. I would even go as far as argue the opposite, because it's very easy to spot the problems, but without them you wouldn't even have the very content to fix problems on.
Never bite the hand that feeds you.
Otherwise, you're free to recreate everything that gives you trouble in your own way, to show everyone "how it is done", instead of fixing what others did.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: RocketX3.JumpDetectorVX

Post by sektor2111 »

nogardilaref wrote:Only because a program is not logging errors and is not crashing, does not mean it's working as it should
I know this, I was facing this problem and... harder enough I could see the root of problem...
Else about calls to "coders", perhaps those making mods as Serverkill, helios, ATF and the rest of garbage - are indeed "angels of love" - "developers ?". Let me explain something simple for me, when exist a sort of stuff announced with whistles and bells and later causing problems this is what I call TrojanHorse - a trap - let admins to mess up with our untested software, yeah... Why fixing ? Because we have good maps dependent of those Bad things. If you wanna run that one for players, you have to work at problem without to be payed by anyone, and yes, X GB of crap needs ages... and why I'm probably a bit aggressive toward these works ? Because these mods are messed up for years and Not so many coders are intended for return to fix what they did - because mainly they probably have no clue how to fix problems. So what we have ? Something similar with I'm writing books but I don't know the most of letters, c'mon. Community goes down this way.
TammT was right in his posts, everyone is only singing nice songs with green horses on walls while main things are low quality but is important to be so nice smiling at trash as much as possible. Checkout mods hosted + used in maps + settings:
- weapons with no meshes - stuck at firing;
- bullets having speed almost beyond 32 bits boundaries;
- timers set for a century;
- stupid codes called multiple times per row - infinite recursions crashing immediately;
- creatures unable to aim a player at 300 UU range;
- Titan slapping player on other country away;
- List is longer - spam like, I don't need recalls because I'm gonna throw up.
Can you call these coders or just plonkers guessing and being a constant trash supply ? Yeah I'm entirely "grateful" for such content...
All these are doable way better with checkers and proper animations called rather than reinventing a square wheel which will never get a proper rotation.
As for the topic on purpose, as you can see, Barbie is one of those which doesn't love such "stuff" but is using a bit of diplomacy by not sharing what is thinking - just for preventing any storm, and is mainly more advanced at programming generally than me - which I'm a cable guy not an IT guy, but which is trying harder to write stuff better as possible.
Else I can also do much better fixing content and... saying nothing, by using this way nobody will be disturbed and I can breath relaxed...
nogardilaref
Masterful
Posts: 577
Joined: Tue Jun 20, 2017 1:00 pm
Personal rank: ⚋⚊⚌☰⚞⌖⚟☰⚌⚊⚋

Re: RocketX3.JumpDetectorVX

Post by nogardilaref »

Well, this topic has been derailed enough (sorry about that Barbie, my fault here), so this will be my last post on this issue, at least in this topic.

So I am going to put it into a spoiler and everything (it's a bit long, sorry):
Spoiler
You are a cable guy, and I know you do your best around here to fix things and although you might not have as much programming experience as some others, I respect your effort in doing these things, I really do.

Me, on the other hand, happen to actually do programming for a living (being a team leader at and all in a growing company for several years), but it does not mean in any way that I cannot learn one thing or two from people who do programming as a hobby, or even from people who just happen to read about it, either here or elsewhere, we can all learn from each others regardless of the field if everyone is enthusiast enough about it, and everybody wins.

Having that said, I do perfectly understand where you're coming from, as even my own team is not particularly talented for the most part, even because the area itself (PHP) is overflowing with developers, and the vast majority of them aren't good at all, since PHP is very easy and accessible and is not really a great language in itself, and since most PHP developers fully rely on external frameworks to do everything for them, so they end up racking up years of "experience", doing the same thing over and over, and then almost none of them pass my own test.
So it's really really hard to have good quality code even at a professional level, even from seniors, and even from my own team.

I cannot count the number of times when my reaction is the same as yours, like "wtf, this is really stupid", sometimes it does frustrate me.
However, instead of lashing out on them, I simply call them, point out their mistakes, while giving them the opportunity to explain why they did it, and even discuss it with me, even because I might be the one who missed something and be the one wrong (which does happen sometimes).
The result is that they start to improve over time, some more than others, but they become competent enough to the point that I can trust them and I don't have to review their code as often.
And I as developer also improve with them.

Would I just call them dumb or whatnot, it wouldn't be very productive (to not mention unprofessional, but that's beside the point), even because they themselves often do not realize they are doing something wrong. Hence discussing it out with them even leads me to understand the kind of logical thinking they were going through so we can identify where it went wrong.
Sometimes is just a misconception of the facts, sometimes just a lack of bases, sometimes lack of information, sometimes just lack of talent to do any good programming at all, sometimes it could be just a mistake or a mistype.

Regardless, these people are generally in the programming area since they genuinely like to create programs, and useful ones for the most part, and they may simply lack the real experience and knowledge to do a good job at it.


Having that said, and going back to the fact that you're a cable guy: most of the developers in UT aren't professional programmers either.
There's a huge range of what these people do for a living: distributing mail, lawyers, firefighters, police, cleaning the street, accountants, taking care of children, maybe even just living in some basement somewhere. They are in no way different from you in that regard, and I bet most of them develop things for UT for 3 reasons alone:
1 - They love the game;
2 - They like programming;
3 - It's a way for them to truly relax from their everyday work or hassles through the free creation of things they want to see in the game.

Most of them will do a very lousy job at it, at least at first (we all did too at some point), resulting in the kind of stuff you see, no doubt about it, but that doesn't invalidate the fact that their intent is generally not to harm the game, but to build upon it, and I think you quickly forget this little fact or simply choose ignore it, by thinking the worst of these people.
And it's by doing so that the community gets harmed in a way, since if the very first newbie developer comes along gets tackled by your remarks immediately, that developer might as well be a goner by how hostile and petty someone who's probably supposed to be a "veteran" is, and never really blossom.

You don't need to keep your opinions to yourself, I think you should keep being honest to yourself and towards everyone as you have been thus far, as that's a great virtue to have and most appreciated, but I think you should reflect on your own stance about things and put yourself in the shoes of these developers for a moment, and appreciate the value they bring, even if that value is not that great at first.


Furthermore, PHP also suffered from similar problems as UT in the past, in terms of code quality, until people over the years gathered and created things like PSR (guidelines to create code), started to use design patterns (factory, proxy, façade, adapter, dependency injection, etc) and even got its own full dependency manager (Composer).

UT needs something similar, but it's very hard nowadays, perhaps even too late I would argue, specially with the small amount of developers around nowadays.
The main problem is that there is no standard for how to code things, how to name things, patterns to follow, guidelines to respect, etc, in UT, but this is not the fault from the developers you complain about, this is the fault of the community as whole, and no one ever pursued or is willing to pursue such a thing (as far as I know).

But we can all discuss this latter point in a different topic if you like.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: RocketX3.JumpDetectorVX

Post by sektor2111 »

There is a topic related to coding, I don't recall exactly the title started by Mr. LoathSome with coding hints checks, etc. We can bump a bit stuff there because probably others need to find what I have messed up without to even have error logs but because I did not write an additional reporting, I was finding issue based on a map... in which simply weapon went vaporized...
Post Reply