Game Development Community

Why is it doing this?

by James Dunlap · in Torque Game Engine · 01/18/2006 (8:57 pm) · 10 replies

I recently purchased the Torque SDK 1.4 and I've been attempting to learn how to use it. I've been modifying starter.fps to experiment with stuff. However, I've observed a rather strange and equally annoying phenomenon.

When I opened "C:\Torque\SDK\example\starter.fps\client\config.cs" the text formatting was totally messed up. I opened it in a hex editor and it seems that new lines are being delimited by 0A instead of the 0D0A combination, required by my operating system, Windows XP. I replaced all instances of 0A with 0D0A and that fixed the file formatting issue. However, when I run the game, the 0D charcters mysteriously vanish. Aside from the formatting issue, all other changes remain intact. This is the only cs file, that I have seen, which does this.

Is this a bug of some kind?

#1
01/19/2006 (8:03 am)
OA (newline) is used to wrap a line in *nix file systems (and is historically the way it is done). When Windows came along, they decided that this wasn't enough, and forced ODOA to be used (return+newline).

Most text editors will accept either format, and auto-convert for your viewing pleasure while leaving the actual file representation alone. UltraEdit for one handles this with a few configuration options, and most other editors will as well.

Config.cs is recreated by the executable at runtime every time you run your project, and is using the original OA format for terminating lines.
#2
01/19/2006 (8:11 am)
Thanks for the response. Why is this behavior restricted to config.cs though? I would have expected this to happen to all or none of the cs files.
#3
01/19/2006 (8:19 am)
To quickly reformat the file to windows CRLF format, open in wordpad and save it again
#4
01/19/2006 (8:23 am)
Quite honestly it's probably just the way that particular output was written. It's literally as simple as wether the programmer that wrote that section used a \n or \n\r as part of his line output formatting code.
#5
01/19/2006 (8:41 am)
So, I should be able to modify the output and recompile the engine to fix this?
#6
01/19/2006 (9:02 am)
If you want, but the config.cs file isn't a file that's intended to be viewed regularly in any case, and it certainly isn't one you should be thinking about editing...it's going to be over-written every single time the player runs your executable.
#7
01/19/2006 (9:56 am)
You might just try a different programmer's editor.
Everyone has a favorite, mine is currently CrimsonEditor.
It displays config.cs nicely, while notepad doesn't.
#8
01/19/2006 (8:01 pm)
I think I'm going to go with a different editor. I have better things to do than muck around in the engine for something this trivial.

Thanks for the help!
#9
01/20/2006 (7:16 am)
I have an old version of Tribal ide (Beta 3.9OS), that dont uses Phyton or anything else, it doesn't have debugger or anything.

But its great and fast for editing your CS files.

If you want to check it out, i can email it to you, but anyway there are far much better tools now.
#10
01/20/2006 (5:29 pm)
Jedit seems to be working slick. Thanks for the offer though!

Cheers!