Sign in to follow this  

Just for thoughts - Dynamic Campaign

This topic is 4302 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I'm n00b, I like "simulations" and am interested in implementing a Dynamic campaign type thing. Similar to Apache Vs Havok's system - but more involved. The desgin intent is to have two sides that basically just fight. I'm sad but I'd just love tweaking the stats/script for each side - to try and balance it. My "Story" would be a sort of Armaggedon 2 style thing but that is only to give a flavour to the "Stats". To start with the objects would be just OBBs traveling over a large Plane firing Rays or little ballistic OBBs/Spheres at one another - at the moment I am only interested in the AI. The graphics dont matter and the collision is already written - this is more a fun academic AI exercise! OK - People say that proper projects use scripting for the "Game" - or in my case the AI bits. That suites me fine - writing a command line parser - or command interpreter is right up my street. But about data and constants and the AI script interface in general. You'd have your "data" in a text file - (Like Rome Total War) - I'll really want to put all my data away in external files - including "model" data as well - as per normal - fine. With AI stuff and the scripting though - I don't really know what i'm working to achieve - I can remember looking at the Duke Nukem Scripts back in the day - and noticed that they compilled before the game ran. Is that the prefered method? Or would the scripts be more like raw data and just fill structures that sort of "Bias" tendancies. Can anyone give me any pointers or ideas on what a scripting system might look like. I know what I want to do - I just dont want to do the AI in C and have to compile it all the time when I change a behaviour. Cheers - any Ideas would be really welcome. Background: I've been programming in total for 11 years, I am degree educated and work a crap IT job. In my spare time I program. I am comfortable in C++, can program ole db, basic windows stuff, and am ok when it comes to Direct X. My A level project of 1998 was a 3D program in Blitz Basic on Amiga - it was flawed - but did present a 2D image of a 3D model - and allowed the user to manipulate that object in real time (4 fps!!!) - it could manage about 20 polygons. I liked it even tho it sucked (hard). I already have a full collision system and physics system - its most extreme capability is to collide dynamic OBBs and have several objects come to rest on top of one another in a realistic fashion. My system has two basic 3D objects - Sphere's and OBBs - that can dynamically collide - and interact correctly - and rays, planes, and points to do static intersections and picking - with a vector, matrix and quaternion class backing it all up. In speed tests the system works well - returning results for Dynamic obb collisions in 0.1 Microseconds in a worst case scenario on a P4 2.8 GHz - returning time interval, distance to collision and point of impact - the system is scaleable to work with BV trees. I don't do "Games" as such - I just like tinkering with bits and peices - Like I wrote that collision library - I wrote an OLE db wrapper for some reason - A windows wrapper - a custom string class - a singleton error manager - a texture manager - etc - etc - I am really looking forward to doing a script interpreter when I figure out exactly what I want it to do.

Share this post


Link to post
Share on other sites
Quote:
Original post by BinaryStylus
OK - People say that proper projects use scripting for the "Game" - or in my case the AI bits. That suites me fine - writing a command line parser - or command interpreter is right up my street.

But about data and constants and the AI script interface in general. You'd have your "data" in a text file - (Like Rome Total War) - I'll really want to put all my data away in external files - including "model" data as well - as per normal - fine. With AI stuff and the scripting though - I don't really know what i'm working to achieve - I can remember looking at the Duke Nukem Scripts back in the day - and noticed that they compilled before the game ran. Is that the prefered method? Or would the scripts be more like raw data and just fill structures that sort of "Bias" tendancies. Can anyone give me any pointers or ideas on what a scripting system might look like. I know what I want to do - I just dont want to do the AI in C and have to compile it all the time when I change a behaviour. Cheers - any Ideas would be really welcome.


There is no preferred method to handle scripts, nor any right or wrong way to do it. The only common factor is that you have a way of treating data as logic, so that your logic can be changed more easily. How you link this into your system will depend on what sort of language you want to use (high level vs. high-performance, plus syntactical preferences), how often the scripts need changing (during gameplay or not), who needs to change them (programmer/designer/player), what changes you need a script to be able to make, and so on.

Essentially all you're doing is exposing your data to another language, which then acts on that data when you tell it to. The data you choose to expose is up to you and when it acts is up to you.

Perhaps you could read the forum FAQ for the Scripting Languages and Game Mods forum here on Gamedev.net for a little more information, and perhaps browse some of the threads in there to get an idea of what is common and what is possible.

Share this post


Link to post
Share on other sites
Ok here is the plan.

I intend to use a State based system - with each entity also having a message queue - Max 8 messages or something. The state system can govern basic stuff such as target, travel destination, etc - and maybe mission type stuff - patrol - intercept. The little robot should then trundle around and do its stuff based on its state registers.

Each frame each object will have an entry function launched - and this entry function will govern its behaviour based on its state registers and also handle the messages on the object's message queue - by launching its message handler - similar to windows's message handler.

Each object can transmit messages - such as a request for help - to other entities - or information about enemies that they have spotted, etc.

There will be a large AI - that is the "Commander" or "Brain" object of each side - and this doesn't physically exist - but is none the less an entity that has an entry function executed each frame - and this too can have a message queue.


Any ideas?

Share this post


Link to post
Share on other sites
I mean - in this scenario - there are basically two functions that I could lift out and script - The AI that is called every frame - and the message handler.

There would need to be a C function call that would do the basic physics and stuff - that would be called each frame - and that would then call the scripted AI call and the Scripted Message handler.


Does that sound acceptable?

Share this post


Link to post
Share on other sites
Yes, it sounds acceptable. The proof will be in the detail however. If all you are doing is reading messages and dispatching messages or changing values in response, that's great. If not, well, the suitability of that would depend on what you need to do. Can you narrow down exactly what this "AI that is called every frame" is going to do?

Share this post


Link to post
Share on other sites
Well here is how I percieve it being built up.

Scripted behaviour
==================
The basic desire is to have objects that can be dropped into the world and then start to interact with the world and one another. These interactions will be physical (Collisions, Gravity, forces) and behavioural (communication between objects). It is the desire that these objects be self contained and free running.

// Data
Each object would contain data - Physical data (position, velocity) behavioural data and 'State' data (desired velocity, desired destination, objective) game data (Ammo, Fuel) and graphics data (Model data) and registers to store messages(message data).

// Function
Each object will expose an entry function - that will run the physics system, update any physical parameters (position, velocity) and add the object's graphics to the renderer. The entry function will also execute an AI script for the object's behaviour and repeatedly run an AI script to handle any messages in the message queue.

// Ideas for script
The scripts will use a catalogue of functions built into the objects ie (X)GetNearestFriend, (X)GetNearestEnemy, IfLessThan(X,Y), Target(X), Protect(X), SetGameData(X,Y), PostMessage(X,Y), etc these can be called in the scripts by a code number, with the parameters being filled with either data or other function calls. IE Target(GetNearestEnemy()) might be 12 (traget), 13(Get Nearest Enemy).
The Known data - such as the behavioural data and physical data - can be accessed through numbers - 128 might be xposition 129 might be zposition etc. etc.
This would let people produce text files like
125, 14, 156
188, 264, 235
45, 125, 15
Etc
That an editor could quickly turn into english and that the program could read quickly and store ready for to be "Called".

The specifics would obviously need tweaking - as each parameter might need a qualifyer to say if its data, "Game data" (custom variable), or the output from a function, a global variable even.

// Stuff
Basically - with out any "Scripts" the object would just do nothing other than be affected by physics.

// More thoughts
The system could be made scalable as what is described could become a standard/base - and a derived "Class" might offer more data registers and more "Script instructions" and more "Messages" for more advanced classes. It could also allow the base class to be reduced - I.E. a missile is very primative - an NPC would be non-trivial - and NPC interaction would require protocols (in the message handlers) that would not be needed for more primative entities.

Share this post


Link to post
Share on other sites

This topic is 4302 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this