🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

C++ and C# compatible script tools?

Started by
4 comments, last by Atlay 20 years, 5 months ago
I''m playing with an idea for a client/server architecture where the server side is done in C#, but the client is a standard C++ app. This is mostly because I already have a significant amount of C++ graphics and sound code that I dont want to throw away, but also because I like C# for the more mundane server side code. So far, it''s working pretty well. I''d like to add in some basic scripting, and thought it would be neat if I could use some of the same script files on both platforms. Therefore, does anyone know of a scripting language that has tools available in both C++ and C#? Thanks in advance. Atlay
Advertisement
What use are you plannig to use your script for? if you just want to load values and initializations an XML parser could be the one for you.
My site Jvitel.com
Python.NET is in a very primitive stage. If you are willing to "port" your client to Managed C++, you can take advantage of the .NET Framework and script your application (on both ends) with C# or any other .NET-compliant language.
Scripting server-side definately stick to C#. Using CodeDom and Reflection you can have your scripts compile at run-time and it produces a really great scripting engine. It is actually what I did myself.

You could do the port to managed C++ as mentioned, but I think your best option is just to write a managed C++ wrapper to your existing system.
Thanks for the replies.

Although this can be controversial, I personally don’t think managed code is a good choice for client side. This is based on the ease of disassembly, and the requirement that the user must have the correct version of the .Net framework installed. The .Net deployment system is not yet mature enough for end user app’s, in my opinion.

As for my intended use of scripting, I must confess that I am in the early stages of even thinking about this. Upto now I have some demo’s that show of specific features, but it’s mostly hard coded in terms of content for each demo. What I want from scripting is to separate out the content and behaviour of a specific game from my code base, so that non-programmer team mates can define/add/change content, without me needed to make code changes. For this reason, I specifically don’t want to use a real programming language for scripting… if you need to be a programmer to write the scripts it defeats the point of having a script, imo. (Because I am not writing an engine for people to mod.)

As I say, I am in the early stages of this, but the kinds of things I imagine I want to cover in scripting are:

- Client pref’s

- Client config data such as GUI layout

- Object attributes (define weapons/characters/etc)

- Game event definitions (triggers, timed events, etc)

- State machine definitions (not sure about this, but I’d like to play with making states and state transitions scriptable)

- AI behaviour

The AI behaviour is probably this only one that needs to be runable on both server and client. All agents will run on the server, but I’d like to allow players to create custom behaviour scripts for agents under their control. This could be done via in game tools that upload a script to the server, which compiles it and feed’s back to the player, but I imagine it would be cool to allow offline tools to allow players to tinker with AI script’s. Hence the question for a scripting language that could be executed in a unmanaged C++ client, uploaded to the server and compiled and run from a C# app’.

As you can see, I’m thinking about this at a fairly high level at this stage. I have a hunch that what I really want is a specific ‘language’ for each purpose (to avoid the language complexity that inevitably comes from needing to be generic), and will end up rolling my own. But I thought I’d at least see what options there were in library land.


Cheers,

Atlay
There are only 2 versions of the .NET framework out atm, and getting the latest version is as easy as running Windows Update.

As for the .NET deployment system, if you use a traditional installer you can hide any of the mess bits manuelly.

Sure this isnt as good as the ~1 click install that .NET potentially offers (single hyperlink), but any one why uses a computer normally has installed something at some point.

Also, you almost always adding more features to the language till you get a rough approximation of an early 1980s native language. And rolling your own is only worth it for learning.

If you plan on making the state machines scriptable, definte an abstract state, and then have that state implemented in a C# class. As for determining the entry state, the states have to have names anyway, and a hashmap is normally good for that type of stuff.

quote:
Because I am not writing an engine for people to mod

Yes you are.

You are writing an engine for you and your team mates to mod.

[edited by - ggs on January 31, 2004 10:02:42 PM]

This topic is closed to new replies.

Advertisement