was KC programming ever made available to users?

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

User avatar
mr.bear
Posts: 444
Joined: Sat, 11. Dec 10, 01:38
x2

was KC programming ever made available to users?

Post by mr.bear »

I've just been googling KC, but I can't find whether egosoft ever released it to the public. was it only made available to higher devnet members? frankly.. why? who was going to steal their proprietry mission coding language that they abandonned for being unworkable? am I missing something here?
Rapunzel, Rapunzel, let down your bear...
djrygar
Posts: 1842
Joined: Mon, 10. Aug 09, 02:09
x3ap

Post by djrygar »

there is compiler and decompiler made available to the public by the authors of the 'time of the truth' mod. you must arm yourself with a translator if you don't know russian tho ;> search on their mod forums

but you can fix A LOT of things using this...


nice thing is that ES considers obj files as data files, and does allow messing with it/publishing mods


if i only knew assembler.. ;)
User avatar
Jack08
Posts: 2993
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by Jack08 »

the problem is there are major issues the come along with this compiler/decompiler, all of which are rather annoying...
  • You break savegames every compile
  • You loose all compability with egosoft patches, you may even run into a stage where your KC file becomes incompatible with the game due to a KC engine change and theres nothing you can do about it due to the above problem
  • You must edit it in a rather odd form of assembly
  • It creates unexpected bugs that takes days to figure out (... i mean days, and it happens all the time)
  • dealing with unknown variable names like "read TSCRIPT_EDITOR.var_700_13 " (witch is the cause of most of the problem directly above)
  • it creates much stress due to all of this and more... lol
I dont think the TOTT team made it. Its been around for a very long while.

I would have stopped editing the KC this way but were left with little choice because without the KC changes for XTL the mod would have to be scrapped - i do not look forward to the release of XTL because i know something may to go wrong (darn you Murphy...), and ill have to recompile the KC file and everyone's save games are going to go corrupt... Im really hoping this wont happen :shock:

I really hope egosoft do release it, Bernd already stated once that modifications are allowed (well, enenra stated that Bernd stated that it was ok in a thread somewhere that i can no longer locate...), but... none of the correct tools have been provided. - oh well all we can do is wait, and hope, and wait... and... hope.... *starts begging egosoft for chew-toy & stress reliever* :lol:
[ external image ]
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire
User avatar
RoverTX
Posts: 1466
Joined: Wed, 16. Nov 11, 18:37
x4

Post by RoverTX »

Sorry for my noobness what exactly can be done using KC that can't be done using MD?
User avatar
Jack08
Posts: 2993
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by Jack08 »

RoverTX wrote:Sorry for my noobness what exactly can be done using KC that can't be done using MD?
The MD and KC are not comparable, the only thing that the KC and MD have in common is that the KC holds the implementation for the MD & SE.

They are used for very different purposes; with the KC the limitations of the MD and SE are removed... But editing it (even with the right tools) isnt anywhere near as easy as writing MD or SE scripts. (its basically custom C++ lol)
[ external image ]
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22433
Joined: Sun, 14. Nov 04, 23:26
x4

Re: was KC programming ever made available to users?

Post by Cycrow »

mr.bear wrote:I've just been googling KC, but I can't find whether egosoft ever released it to the public. was it only made available to higher devnet members? frankly.. why? who was going to steal their proprietry mission coding language that they abandonned for being unworkable? am I missing something here?
think you have a missunderstanding what KC is.

its the basic language behind the game, so a large part of the game is made in KC, which included the missions.

but the missions were moved over to the MD.
but the rest of the game still remains KC
Yushatak
Posts: 13
Joined: Tue, 10. Apr 12, 16:14

Post by Yushatak »

The unknown variable name thing sounds like what happens for modding Minecraft - it uses obfuscated code and class names, so over time the community figured out what was what and slowly mapped it all in a table. The table is then used to deobfuscate the code after decompilation, you edit it, and then the original parts are reobfuscated. This way you can work with sensible code, and it still compiles right afterward.

Something similar could be done with this KC language, I'm sure, given the time and inclination. This would also allow you to recompile your mod after necessary edits and make it compatible with the next version - as is done with Minecraft mods. Dunno how save files factor into this, so no idea if they'd still fail or not (I'm new to X modding).
~Yushatak
www.yushatak.com
www.youtube.com/yushatak
(I'm a partner doing LP)
User avatar
Jack08
Posts: 2993
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by Jack08 »

Saves will always fail due to the way the X engine works, i cant come up with a good way to explain it so excuse the code-speak: The save-game is just a dump of the VM's current state, after recompiling the code for the VM all of the memory locations for jumps in the VM change, witch cause it to crash instantly or cause the corrupt save message. The compiler just isn't capable of handling these changes and putting them into the patchtable for the VM to understand

the compiler/decompiler isn't open source, so there's nothing that can be done about it really, just have to wait for egosoft to release the code.

It does already have a translation table, but its very incomplete.
[ external image ]
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire
kurush
Posts: 4320
Joined: Sun, 6. Nov 05, 23:53
x3tc

Post by kurush »

Jack08 wrote:the code-speak:
So, does this mean that Egosoft never releases any changes to the KC code with patches? Or does this mean just that the community does not have good enough tools?
PS. Many thanks to the OP for mentioning KC. I was always wondering what is that crappy interpreter that runs the X3 code and bogs down the CPU :) Now I got a name for it.
User avatar
Jack08
Posts: 2993
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by Jack08 »

kurush wrote:
Jack08 wrote:the code-speak:
So, does this mean that Egosoft never releases any changes to the KC code with patches? Or does this mean just that the community does not have good enough tools?
PS. Many thanks to the OP for mentioning KC. I was always wondering what is that crappy interpreter that runs the X3 code and bogs down the CPU :) Now I got a name for it.
The community created tools are not capable of "patching" the KC like Egosofts tools can ;)
[ external image ]
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire
kurush
Posts: 4320
Joined: Sun, 6. Nov 05, 23:53
x3tc

Post by kurush »

Jack08 wrote: The community crated tools are not capable of "patching" the KC like Egosofts tools can ;)
I C, so every new patch runs some sort of a converter first time it loads an older save and this is something we can't do with the community tools. Makes sense.
User avatar
bluenog143
Posts: 885
Joined: Wed, 26. Oct 11, 23:35
x3tc

Post by bluenog143 »

Sorry lot I don't seem to know but what does KC stand for? I didn't even know it existed until I came across this thread.
Last edited by bluenog143 on Tue, 17. Apr 12, 02:42, edited 1 time in total.
SinisterDeath wrote:This reminds me of something...

"I don't believe in GoD, but GoD sure believes in blowing up my factories."
Dark_Ansem wrote:Seeing your creation in-game and working makes one feel all warm and fuzzy inside.
User avatar
TrixX
Posts: 2035
Joined: Wed, 18. Aug 10, 14:28
x4

Post by TrixX »

Klasse Code, or Class Code, basically a derivative of C++ assuming I got that correct :D
"If you’re not prepared to be wrong, you’ll never come up with anything original."
Sir Ken Robinson
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

kurush wrote:I C, so every new patch runs some sort of a converter
Is this a hint? It is not dated and appears to be ancient, but it also appears to be official EgoSoft information: KC Patching
User avatar
Jack08
Posts: 2993
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by Jack08 »

DrBullwinkle wrote:
kurush wrote:I C, so every new patch runs some sort of a converter
Is this a hint? It is not dated and appears to be ancient, but it also appears to be official EgoSoft information: KC Patching
From X2 or BTF :D
[ external image ]
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

Jack08 wrote:From X2
At least. The url suggests X.

But is there any reason to think that current versions of the real KC compiler behave differently?
User avatar
Jack08
Posts: 2993
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by Jack08 »

DrBullwinkle wrote:
Jack08 wrote:From X2
At least. The url suggests X.

But is there any reason to think that current versions of the real KC compiler behave differently?
No they function much the same way to my knowledge.. the patch tables suggests as such..

But what does it matter? all this is useless knowledge until egosoft release the actual KC code and compiler; i explained in detailed in my previous post why save games go invalid with the community version, lol.
[ external image ]
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

Jack08 wrote:what does it matter? all this is useless knowledge until egosoft release the actual KC code and compiler
Of course. This appears to be more of a curiosity and "X archaeology" thread. :) It would seem that the answer to mr.bear's original question was answered long ago: "Historically, yes. Currently, no, not really. Not in a reliable, supported, way."

Here is another clue that suggests that EgoSoft's real KC compiler was once available under NDA. Again, it is ancient history.

The decompiler described in this thread sounds more like a generic Windows decompiler rather than like EgoSoft's real KC compiler. Hence the assembly language and generic variable names. And the broken saved games.

You probably know most (or all) of this history, Jack. The rest of us are just guessing.
Last edited by DrBullwinkle on Tue, 17. Apr 12, 04:00, edited 1 time in total.
kurush
Posts: 4320
Joined: Sun, 6. Nov 05, 23:53
x3tc

Post by kurush »

DrBullwinkle wrote: The decompiler described in this thread sounds more like a generic Windows decompiler rather than like EgoSoft's real KC compiler. Hence the assembly language and generic variable names. And the broken saved games.
I find it hard to believe it is generic Windows, the code it decompiles appears to be some sort of pseudo-code proprietary for Egosoft. It would be so much easier if they generated the real machine code from that - there are much more robust tools for that. They also wouldn't run into the wall with multiple core support as they did.
User avatar
Jack08
Posts: 2993
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by Jack08 »

DrBullwinkle wrote:
Jack08 wrote:what does it matter? all this is useless knowledge until egosoft release the actual KC code and compiler
Of course. This appears to be more of a curiosity and "X archaeology" thread. :) It would seem that the answer to mr.bear's original question was answered long ago: "No, not really. Not in a reliable, supported, way."

Here is another clue that suggests that EgoSoft's real KC compiler was once available under NDA. Again, it is ancient history.

The decompiler described in this thread sounds more like a generic Windows decompiler rather than like EgoSoft's real KC compiler. Hence the assembly language and generic variable names. And the broken saved games.

You probably know most (or all) of this history, Jack. The rest of us are just guessing.
;)

yes-ish... heres an example of the hell that it outputs, but its definitely got nothing to do with windows, it runs in egosofts propriety machine.

Code: Select all

;
; === SetAutojumpActivated ======================================
; function  SHIP.SetAutojumpActivated(arg1);
;
SHIP.SetAutojumpActivated:
           enter      1, 2
           push       SP[3] ; arg1
           if SP[0]=0 then jump L000A5CBF
           read       SHIP.var_2004_1 ; [13d ; 0Dh]
           pushw      2048d ; 0800h
           or         SP[0],SP[1]
           write      SHIP.var_2004_1 ; [13d ; 0Dh]
           pop
           jump       L000A5CCA

L000A5CBF: read       SHIP.var_2004_1 ; [13d ; 0Dh]
           pushw      -2049d ; 0F7FFh
           and        SP[0],SP[1]
           write      SHIP.var_2004_1 ; [13d ; 0Dh]
           pop
L000A5CCA: push       0
           ret
[ external image ]
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”