.cs conversion from A8 to Torque
by Zeph · in Technical Issues · 08/30/2011 (6:34 am) · 6 replies
Through out the years I used the A8 engine to learn from pretty much... I purchased the Torque 3d engine, and I noticed that we can use .cs scripts... The A8 used .cs scripts for pretty much everything since source code was not open... I made an awesome drag and drop inventory system on the A8 in .cs that I would like to port over to Torque..A8 had bad networking code, so my ability to save a players inventory was horrible since it was primarily used for single player games... One of the features that I do like in the Torque is the networking code... Which I hope and if I can do this is to port my old .cs script over to the Torque from A8 engine, so I can continue on with the network side of things where a server can save a players inventory, and all their items...
In the A8 engine .cs files we had includes from the main .cs file.... Which I do not see in the main .cs for torque, so Im a bit confused as to the hierarchy as to how the cs scrips stack, and its flow of order... Also, whats confusing to me in that hierarchy is the setup between .cs files.. In A8 cs the player had one .cs file where as in Torque im seeing multiple .cs files where player definitions are defined, for example datablocks, items, camera, ect.... Where as in A8 items had one .cs file one camera .cs file... The torque .cs files seem scattered so to speak, and much harder to read....
Ive never messed with the source code of an engine before, and the setup on Torque is kinda confusing to me... So my question is:
1)Would transferring the .cs files from A8 to Torque be possible??
2)Pros and cons with .cs vs rewritten new code in c++ in the engine source as far as server security?
3)Do I leave the c++ source alone, and just use the cs files to script my game or was it intended to use the c++ engine source for this aspect?
In the A8 engine .cs files we had includes from the main .cs file.... Which I do not see in the main .cs for torque, so Im a bit confused as to the hierarchy as to how the cs scrips stack, and its flow of order... Also, whats confusing to me in that hierarchy is the setup between .cs files.. In A8 cs the player had one .cs file where as in Torque im seeing multiple .cs files where player definitions are defined, for example datablocks, items, camera, ect.... Where as in A8 items had one .cs file one camera .cs file... The torque .cs files seem scattered so to speak, and much harder to read....
Ive never messed with the source code of an engine before, and the setup on Torque is kinda confusing to me... So my question is:
1)Would transferring the .cs files from A8 to Torque be possible??
2)Pros and cons with .cs vs rewritten new code in c++ in the engine source as far as server security?
3)Do I leave the c++ source alone, and just use the cs files to script my game or was it intended to use the c++ engine source for this aspect?
#2
Both A8 and Torque use the same file extension, though the scripting language is different. This can be confusing since both stand for C Script, meaning a script styled after the C programming language. You would need to completely convert all of the programming logic from A8 to TorqueScript. There is not an easy conversion since they are completely different languages that were developed in parallel by different companies.
With a generic title like "C-Script" and a .cs, it is bound to cause confusion. Microsoft using the .cs extension for C# has added even more confusion into the mix.
Sorry for all the confusion, but hopefully this will help at least untangle some of it.
08/30/2011 (10:10 am)
Hello Zeph,Both A8 and Torque use the same file extension, though the scripting language is different. This can be confusing since both stand for C Script, meaning a script styled after the C programming language. You would need to completely convert all of the programming logic from A8 to TorqueScript. There is not an easy conversion since they are completely different languages that were developed in parallel by different companies.
With a generic title like "C-Script" and a .cs, it is bound to cause confusion. Microsoft using the .cs extension for C# has added even more confusion into the mix.
Sorry for all the confusion, but hopefully this will help at least untangle some of it.
#3
08/30/2011 (10:30 am)
Same file named xxx.cs means different aspects of same object in different folder.can be combined in one file(that is what i do) and will work most of the time without any error.multiple same file in different folder is for organization.see the folder hierarchy in documentation.may be it will help. I am also from A7
#4
I never really knew there was a difference in c-script from engine to engine... I honestly thought it was all the same just a different way of writing depending on a users experience... I looked through the torque .cs files and it really looks more like c++ and when compare to my old A8 .cs its more like I'm writing baby talk lol...
I did however take the time by luck to go over 3D Game Programming Al in One (Finney 2004) Which did explain the hierarchy,of how Torques folders, and files are set up amongst other things... I know its a bit outdated but I was searching for answers to various things..
After reading all the replies it Just might be easier to relearn the .cs Torque way, and remake the whole inventory code which would make things a lot easier to expand on down the road..
08/31/2011 (5:57 am)
Thanks for the prompt responses... I never really knew there was a difference in c-script from engine to engine... I honestly thought it was all the same just a different way of writing depending on a users experience... I looked through the torque .cs files and it really looks more like c++ and when compare to my old A8 .cs its more like I'm writing baby talk lol...
I did however take the time by luck to go over 3D Game Programming Al in One (Finney 2004) Which did explain the hierarchy,of how Torques folders, and files are set up amongst other things... I know its a bit outdated but I was searching for answers to various things..
After reading all the replies it Just might be easier to relearn the .cs Torque way, and remake the whole inventory code which would make things a lot easier to expand on down the road..
#5
08/31/2011 (8:47 am)
TorqueScript is the name of the script. If you're looking for resources on it, that's the keyword (but you'll get far by just visiting TDN).
#6
If you want to keep your original A8 code, you can try converting it to C++ code (which is a super-set of ANSI-C) but I would recommend starting over and just using the A8 code as a guideline for your new code.
09/02/2011 (12:46 pm)
A8 .cs (aka Lite-C) is very close to normal "ANSI-C". If you want to keep your original A8 code, you can try converting it to C++ code (which is a super-set of ANSI-C) but I would recommend starting over and just using the A8 code as a guideline for your new code.
Torque 3D Owner Bloodknight
Bloodknight Studios
That said, torquescript isnt complicated, you should be able to port the logic from one to the other with relative ease, learning the function names to replace the ones you use in A8 is likely the most time consuming part