Developer Fails of the day

For all other chatting you want to do and that does not fit in another forum you can use this one.

Developer Fails of the day

Postby cjbarnes5294 » Fri Apr 18, 2014 1:00 am

When developing steam locos, I'm prone to overlooking something really simple and getting worked up about it for over an hour, until I spot what I did wrong, and subsequently facepalm. I'm sure I'm probably not the only developer who has moments like this, and sometimes they can be quite amusing. ;) Go on, share your latest developer's fail of the day - we might all learn something from it, and if not, we can all have a laugh instead. :lol:

I'll get the ball rolling:

Spending hours trying to work out why my seemingly flawless code in my script was failing to change a control, I read and reread it about 10 times, trying to find a flaw in the logic, or a rogue undeclared variable messing up my maths. To make matters worse, LogMate wasn't complaining either. It turns out I did this:

Code: Select all
Call("*:SetControlValue", "EngineBrakeControl", gSteamBrakeSetting);


Which the other scripters here will be shaking their heads at, as it should have been:

Code: Select all
Call("*:SetControlValue", "EngineBrakeControl", 0, gSteamBrakeSetting);


:roll:

Lesson to be learnt: to be more careful to check and get the semantics right, at the very least, otherwise it may give you headaches when you can't initially see the problem and debuggers won't help. :D

Chris
The Red Queen Hypothesis, applicable to train sim development?

"Here, you see, it takes all of the running you can do, to keep the same place."
cjbarnes5294
Driver
 
Posts: 398
Images: 82
Joined: Mon Mar 31, 2014 12:40 pm
Location: Gloucestershire/North Yorkshire
Has thanked: 551 times
Been thanked: 187 times

Re: Developer Fails of the day

Postby DominusEdwardius » Fri Apr 18, 2014 1:10 am

One of my all time facepalm moments was when I was working on my vacuum brakes, the line causing some of my problems was this one
Code: Select all
Call ( "*:SetControlValue", "Vacuum Chamber Side", 0, gnReservoir )

Now there is absolutely nothing wrong with that line, apart from one thing I had overlooked I had never technically defined gnReservoir, what was even more strange when I tried searching for gnReservoir in my script I found nothing when I was absolutely sure I had defined it. Turns out I had defined it, but I may have made a slight typo when defining gnReservoir, I had in fact done this
Code: Select all
gnResevoir = math.max( math.min( gnResevoir + ( gnResevoirCreation  * time ), 21 ), 0 )

Have you spotted it :D My misspelling of reservoir caused me a few hours of agony and then some as I had to find every single reference to gnResevoir and alter it to the proper spelling.

sigh another good one is the rogue capital letter but that's for another day :)
regards
Edward
Regards Edward

Meshtools - Scripter and Sound Artist
http://www.meshtools.co.uk
https://www.facebook.com/Meshtools
User avatar
DominusEdwardius
Passed Fireman
 
Posts: 114
Joined: Mon Mar 31, 2014 11:25 am
Location: Loughborough, UK
Has thanked: 10 times
Been thanked: 40 times

Re: Developer Fails of the day

Postby gptech » Fri Apr 18, 2014 2:17 am

Not game related, but I once spent at least half a day struggling to get text on a web page aligned in the centre of the browser window; I'd checked the mark-up and it was perfect...and made sure everybody knew that!

Eventually I had to concede defeat and ask for help........
The guy who stuck his head over my shoulder grinned and spent 30 seconds changing <text-align="centre"> to <text-align="center"> and all was well.

I hid for the rest of the day.......
gptech
General Shed Duties
 
Posts: 10
Joined: Mon Apr 14, 2014 1:23 pm
Has thanked: 0 time
Been thanked: 11 times

Re: Developer Fails of the day

Postby Smokebox » Fri Apr 18, 2014 4:36 am

I'd just added some more gauge lights (instrument lights) and was going crazy trying to work out why they wouldn't switch on. After half an hour searching for the bug in the script, without success, I realised my mistake - there was no error, I'd simply forgotten to turn on the dynamo :oops:
User avatar
Smokebox
Fit for Firing Duties
 
Posts: 29
Joined: Wed Apr 16, 2014 12:30 pm
Has thanked: 11 times
Been thanked: 23 times

Re: Developer Fails of the day

Postby AndiS » Fri Apr 18, 2014 10:37 am

Typos in variable names - I have lost count of them. I resorted to strictly copy-pasting them. It slows down the writing process, but searching for such errors is really too much for my nerves. It is a bad design flaw of Lua to silently assume nil for any undefined variable. I have not found a general remedy.

An advanced version of this disaster was this:

Code: Select all
if state == CLEARED then

This condition never was fulfilled a of course, I searched for reasons everywhere. But the thing is this:
Message - corresponding state:
SIGNAL_BLOCKED - BLOCKED
SIGNAL_WARNING - WARNING
SIGNAL_CLEARED - CLEAR
I tried to stay close to the Kuju code to help people read it. Thus I inherited this curse of an inconsistent definition: cleared vs. clear.
Of course, this again is because I did not copy this occurrence of the constant from Kuju code but edited it consistent with the other cases (being BLOCKED and WARNING), thinking I cannot mistype 5 letters of a single-syllable word.


HTML & CSS can be cited in defence of Lua. They bug me as well. center and color are unavoidable language barriers. But lots of inconsistencies between properties can drive you crazy: vertical-align but text-align, not horizontal-align; HTML equivalents are valign and align. In a way, the RW API looks sane compared to that.


Hacking Lua files in the Assets folder. In particular for small things, I often copy .bin files and .lua files from existing assets and modify them a bit. Recently, I did it again, the script was under 20 lines and just a copy and paste job. Logmate insisted that the signal would not have a script associated with it, which could not be found true even on repeated examination.

The problem was an extra "end" that I inserted in error. Had I exported this object from the blueprint editor, I would have gotten an error message. But since I directly loaded the faulty Lua code into the game, I got no warning at all, the script was decided to be missing.


Not remembering how to test my stuff is also something that curses me. E.g., a signal that only clears as you approach it, or only after you stopped there. I can stare at it in anger, cursing my code, at times.

I resorted to test signals using AI only so I cannot do anything wrong while testing. Does not help an engine developer, of course.

One thing that also helped was adding location markers on the track in approach to signals that tell me what to expect here. Turning F6 on does clutter the display though. But I could recommend that as a way to post notes to yourself for route builders, maybe.
AndiS
Top Link Driver!
 
Posts: 736
Joined: Wed Apr 09, 2014 5:48 pm
Has thanked: 268 times
Been thanked: 308 times

Re: Developer Fails of the day

Postby gonzo2431 » Fri Apr 18, 2014 11:51 am

Most recently, coming to a set of points and laying the track the wrong direction for 15 miles.

Previously, building 10 miles of track with the wrong Trackrule :evil:
Bristol And Avonmouth - Done
Paddington to Cardiff - Coming Soon.
gonzo2431
Engine Cleaner
 
Posts: 9
Joined: Sat Apr 05, 2014 6:04 pm
Has thanked: 1 time
Been thanked: 2 times

Re: Developer Fails of the day

Postby cjbarnes5294 » Fri Apr 18, 2014 2:31 pm

Smokebox wrote:I'd just added some more gauge lights (instrument lights) and was going crazy trying to work out why they wouldn't switch on. After half an hour searching for the bug in the script, without success, I realised my mistake - there was no error, I'd simply forgotten to turn on the dynamo :oops:


Not a fail post from me this time, I'm afraid, but a suggestion for Mike's FEF-3. It would be a really cool effect if the in-cab lights flickered, or the light range increased and colour brightened, as you turn on the dynamo and it starts to wind up, building up the current in the circuits. :)

Chris
The Red Queen Hypothesis, applicable to train sim development?

"Here, you see, it takes all of the running you can do, to keep the same place."
cjbarnes5294
Driver
 
Posts: 398
Images: 82
Joined: Mon Mar 31, 2014 12:40 pm
Location: Gloucestershire/North Yorkshire
Has thanked: 551 times
Been thanked: 187 times

Re: Developer Fails of the day

Postby Smokebox » Fri Apr 18, 2014 6:16 pm

cjbarnes5294 wrote:Not a fail post from me this time, I'm afraid, but a suggestion for Mike's FEF-3. It would be a really cool effect if the in-cab lights flickered, or the light range increased and colour brightened, as you turn on the dynamo and it starts to wind up, building up the current in the circuits. :)

Chris


It's a possibility - there're LUA functions to change the dimensions and colour of the beam, but not the intensity, however I could do the flickering easily enough (activating and deactivating repeatedly). The thing is though that I usually (except when I forget), spin up the dynamo first and turn on the lights once it's going.
User avatar
Smokebox
Fit for Firing Duties
 
Posts: 29
Joined: Wed Apr 16, 2014 12:30 pm
Has thanked: 11 times
Been thanked: 23 times

Re: Developer Fails of the day

Postby cjbarnes5294 » Fri Apr 18, 2014 6:40 pm

Smokebox wrote:
cjbarnes5294 wrote:Not a fail post from me this time, I'm afraid, but a suggestion for Mike's FEF-3. It would be a really cool effect if the in-cab lights flickered, or the light range increased and colour brightened, as you turn on the dynamo and it starts to wind up, building up the current in the circuits. :)

Chris


It's a possibility - there're LUA functions to change the dimensions and colour of the beam, but not the intensity, however I could do the flickering easily enough (activating and deactivating repeatedly). The thing is though that I usually (except when I forget), spin up the dynamo first and turn on the lights once it's going.


A little easter egg for those who set it up with the light switch already on, perhaps. ;)


I have a feeling that I'm about to uncover another fail this evening - my brakes aren't letting go....

Chris
The Red Queen Hypothesis, applicable to train sim development?

"Here, you see, it takes all of the running you can do, to keep the same place."
cjbarnes5294
Driver
 
Posts: 398
Images: 82
Joined: Mon Mar 31, 2014 12:40 pm
Location: Gloucestershire/North Yorkshire
Has thanked: 551 times
Been thanked: 187 times

Re: Developer Fails of the day

Postby AndiS » Fri Apr 18, 2014 8:00 pm

That reminds me of another favourite error of mine: Realising details in scripts or shapes that no one will notice. Or nearly no one.

If you work close with a subject, you generate requests like Chris' one after the other.

My scripting speed generally cannot hold up with my requesting speed, which can result in the fatal error of nothing getting finished.
AndiS
Top Link Driver!
 
Posts: 736
Joined: Wed Apr 09, 2014 5:48 pm
Has thanked: 268 times
Been thanked: 308 times

Next

Return to General Chat

Who is online

Users browsing this forum: No registered users and 4 guests

cron