Developement with C#?

Discussion in 'Plugin Development' started by connorcpu, Jan 6, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    connorcpu

    I believe I saw a mention about multi-language developement for bukkit plugins? I would like to know more about what this means. Are you guys going to release a .NET version of the API? that would be awsome to be able to develope plugins with C# as that is my most fluent programming language. There will not be any hurt feelings if you don't, but it would be awsome :).
     
  2. Offline

    Justin B

    C# developer here who dabbles in Java. Java is as close to C# as any language can really claim to be, and Eclipse is at least as good as VS for an IDE. Since Minecraft is written in Java, expect Java to be the path of least resistance for any sort of mod/plugin development.

    Here are some links to get you started:
    http://it.toolbox.com/blogs/codesharp/java-for-c-developers-21248
    http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Java
    http://www.25hoursaday.com/CsharpVsJava.html

    Run through those, look over some existing mods, and start hacking.. Grab a book if you need it, (I've heard 'Headfirst Java' is good for developers picking up java as a new language) but you probably won't...
     
  3. I am a c# dev who only recently started java with hmod, it is surprisingly easy to pick up.

    There are a few deviations like a foreach loop

    for(Player p : onlineplayers)

    vs

    foreach (Player p in onlineplayers)
     
  4. Offline

    matejdro

    I'm also C# developer and i found java to be almost the same.
     
  5. Offline

    robhol

    Except a lot less smooth and lacking quite a lot of features it's easy to take for granted after "long-term" C# programming.
     
  6. Offline

    matejdro

    Well I'm starting in both langugaes so all features that i need, are there.
     
  7. Offline

    LynxofCP

    I've been thinking about this for quite a while (as part of a job I had a year ago) and I have yet to find a good way of calling c# code from Java without having some rather elaborate system involving native plugin loaders, overhead of running two VMs and Java <-> C# object marshalling (passing objects between the two). Certainly my knowledge of C/C++ and JNI is insufficient to create this bridge, and I'm not skilled enough to even consider doing it in a cross-platform manner, for example, loading Mono instead of .NET on linux.

    Another way of going about it is to have a plugin-host server in c# that uses TCP or something to communicate with CraftBukkit, this too has the overhead of two VMs and the TCP communication layer.

    On the other hand, if you're going the other way, calling Java from .NET code, there is always the IKVM project which allows you to run Java code in the context of the .NET VM which is really cool and easy to do.

    I have had some luck running the official minecraft server using IKVM, but it adds a layer of unknown to the solution. I have not tried hey0 and loading other plugins for example, so even if you did run CraftBukkit on IKVM and introduce your own .NET plugin loader, I'm not convinced that would be the easiest solution. I would argue that learning Java would be far simpler for everyone involved.

    I'm tinkering and planning to write my own minecraft server with the Bukkit API in c# for this reason (Calling a Java plugin is easy if the rest is in c#). Dunno if anything will ever come of it, but I'd like to see a few more 3rd-party SMP servers around and it would sure be fun to tackle :)

    If anybody has any further information about calling c# code from Java, I'd love to hear about it I'm always up for being proven wrong if it allows me to do funky cool stuff.
     
  8. Offline

    feverdream

    I code in C# all the time, but I honestly hope that Bukkit diesnt support it.

    To be blunt, I want to be able to run this on my dedicated minecraft linux server.. and adding C# bindings will just complicate things and actively hurt performance anyway on top of making that impossible.
     
  9. Offline

    connorcpu

    Thanks for the help, I probably won't worry about linking these two unless I can learn enough java that I can make a C# interface :p if I do figure it out, you can be sure I will share it with everyone :D. The big part would be making sure I got ALL the hooks and server calls. I will probably start figureing out how to though once bukkit is complete with full documentation.
     
  10. Offline

    CryADsisAM

    I know C# very well ;). Been using Visual Studio. Then I tried to develop a plugin in Eclipse but no luck (I have been learning from Adam11s tutorial but I always have errors) I just can't understand Java. :(
     
  11. Offline

    ItsHarry

    Eh.. You realise this post is like 10 months old?
     
  12. Offline

    coldandtired

    So far I've only seen about two minor differences in the way I wrote the plugin in Java, and the code to do the same thing with C#. Everything else is pretty much identical.
     
  13. Offline

    randomman159

    For the main usage of the code, you will find very few differences. Given the fact that a majority of what you'll end up doing is using the bukkit (and other plugin) libraries, as well as basic logic, not much of it is effected by the change in language. It took me a day to get my first test plugin up and running, using chat, player, block and command listeners.
     
Thread Status:
Not open for further replies.

Share This Page