C# - need someone to poke around

Friendly conversations, and everything that doesn't fit into the other forums.
  • 1
  • 2
17 posts Page 1 of 2
LukasPJ
Site Admin
Posts: 348
Joined: Tue Feb 03, 2015 7:25 pm
 
by LukasPJ » Mon Dec 05, 2016 4:20 pm
Hey guys,

So, I've implemented T3D into C# in order to provide a C# scripting interface for the engine. It's still very much a work in progress, so it's not nice or anything. It's more or less a proof of concept.

So I'm looking for someone interested in downloading the attached binaries, opening it up and taking a stab at it just doing different things you are curious about and reporting any marshalling errors for me.

I will provide more information about this whole Torque3D and C# thing in a blog, when the project is more mature.

Be advised, that this is not polished in any way and you should know your way around TorqueScript, C# and Torque itself in order to figure out how to use it.
The attached code file delivers the following:
  • The Empty project with a compiled DLL
  • A folder "c#" with the following:
    • A C# project "Game" with a file program.cs which initializes the engine and TestScript.cs which is a translation of the main.cs file
    • A C# project "Torque3D" with all the interop-code and proxy classes in order to interact with Torque3D.

You can download it at: http://lukasj.org/TorqueSharp-0.3.0.zip
Feel free to ask any specific questions about how it works and report all bugs you find. Thanks a ton!

Edit:
In case anyone is curious, here is a comparison between main.cs in C# and TorqueScript and there's also a bit more information to be found in the now-inactive Torque6-C# wiki: https://github.com/lukaspj/Torque6-Embedded-CSharp/wiki
RasterRon
Posts: 53
Joined: Sun Oct 25, 2015 7:36 am
 
by RasterRon » Tue Dec 06, 2016 10:55 am
This looks interesting Lukas, so basically you can still use both TorqueScript and C#? nice. :)
deathbravo
Posts: 50
Joined: Mon Feb 01, 2016 7:06 am
by deathbravo » Wed Dec 07, 2016 6:51 am
when i first run it in cmd console, it gives :

Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object.
at Torque3D.GuiCanvas.showWindow() in D:\GameDev\Torque3D-Hobby\Torque#-Alpha
\c#\Torque3D\Torque3D\Engine\GuiCanvas.cs:line 940
at Game.TestScript.entry() in D:\GameDev\Torque3D-Hobby\Torque#-Alpha\c#\Torq
ue3D\Game\TestScript.cs:line 142
at Torque3D.Torque3D.Initialize(String[] args, Libraries libraryNames) in D:\
GameDev\Torque3D-Hobby\Torque#-Alpha\c#\Torque3D\Torque3D\Torque3D.cs:line 121
at Game.Program.Main(String[] args) in D:\GameDev\Torque3D-Hobby\Torque#-Alph
a\c#\Torque3D\Game\Program.cs:line 17

then I tried it in visual studio, it works. Then it can work in cmd console without the exception thrown.
LukasPJ
Site Admin
Posts: 348
Joined: Tue Feb 03, 2015 7:25 pm
 
by LukasPJ » Wed Dec 07, 2016 10:58 am
RasterRon wrote:This looks interesting Lukas, so basically you can still use both TorqueScript and C#? nice. :)

Yeah, TorqueScript works just like it has always done. C# is just an optional layer on top of that.. It doesn't even have to be merged into the official repo!

@
User avatar
deathbravo
Huh, that's really odd. Thanks for reporting the issue! :) I'll have a look at it, seems like it might just be some outdated binaries or something though.
RasterRon
Posts: 53
Joined: Sun Oct 25, 2015 7:36 am
 
by RasterRon » Wed Dec 07, 2016 11:37 am
Yeah, TorqueScript works just like it has always done. C# is just an optional layer on top of that.. It doesn't even have to be merged into the official repo!


Got it and that's awesome! I'm also getting the same error as
User avatar
deathbravo
.
LukasPJ
Site Admin
Posts: 348
Joined: Tue Feb 03, 2015 7:25 pm
 
by LukasPJ » Wed Dec 07, 2016 4:00 pm
RasterRon wrote:
Yeah, TorqueScript works just like it has always done. C# is just an optional layer on top of that.. It doesn't even have to be merged into the official repo!


Got it and that's awesome! I'm also getting the same error as
User avatar
deathbravo
.



Just had a chance to look at it, and apparently the precompiled .exe file is outdated. So recompiling it through VS should fix it. I'm updating an updated .zip file soon :)
Monkeychops
Posts: 17
Joined: Wed Feb 18, 2015 11:53 am
by Monkeychops » Fri Dec 09, 2016 2:49 am
Seems to run for me, although not sure how to do much except start the blank scene.
This is really cool - I have to say I've kinda given up on Torque because TS is too quirky and not a lot of open source libraries and such out there for it.. but C# would be a whole new story.
RasterRon
Posts: 53
Joined: Sun Oct 25, 2015 7:36 am
 
by RasterRon » Fri Dec 09, 2016 5:01 am
LukasPJ wrote:Just had a chance to look at it, and apparently the precompiled .exe file is outdated. So recompiling it through VS should fix it. I'm updating an updated .zip file soon :)


Ah ok thanks. Apparently I still have to do a VS2015 reinstall and my latest working here is 2010 but anyway, looking forward to it. :)
LukasPJ
Site Admin
Posts: 348
Joined: Tue Feb 03, 2015 7:25 pm
 
by LukasPJ » Thu Dec 15, 2016 5:30 pm
Monkeychops wrote:Seems to run for me, although not sure how to do much except start the blank scene.
This is really cool - I have to say I've kinda given up on Torque because TS is too quirky and not a lot of open source libraries and such out there for it.. but C# would be a whole new story.

Honestly, I don't mind TorqueScript, but yeah the reason I'm doing this C# thing, is because of a Hackathon I want to hold at my University, and I don't feel like asking people to learn TS in a day :)

On another note..

New release!



This release features:

Properties


All SimObjects static fields can now be accessed like regular C# properties:
StaticShape coin = Sim.FindObject<StaticShape>(obj);

ParticleEmitterNode emitterNode = new ParticleEmitterNode
{
DataBlock = Sim.FindObjectByName<ParticleEmitterNodeData>("CoinNode"),
Emitter = Sim.FindObjectByName<ParticleEmitterData>("CoinEmitter"),
Position = coin.Position
};
emitterNode.registerObject();
emitterNode.schedule(200, "delete");


They are all going through the console, so they are converted to and from string which of course is sub-optimal. But it's something!

Furthermore, I added some more sample C#. scripts.. Namely first and second part of this tutorial:
http://wiki.torque3d.org/scripter:coincollection
I still haven't fixed creation of datablocks, so they are eval'ed atm but small steps all the time!
JeffR
Steering Committee
Steering Committee
Posts: 750
Joined: Tue Feb 03, 2015 9:49 pm
 
by JeffR » Thu Dec 15, 2016 11:05 pm
You sexy beast! ;)

Very awesome. I need to give this a proper run-down.

So outside of obvious, improvements like cutting back on how much string interpretation we use and whatnot, what do you think is still missing at least an initial implementation?

It's sounding like it's pretty close to at least the 'everything runs' level.
  • 1
  • 2
17 posts Page 1 of 2

Who is online

Users browsing this forum: Google [Bot] and 3 guests