HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

What Would You Like In A Scripting Language For An RTS?

01-14-2003, 08:02 PM#1
Extrarius
NOT REALLY WC3 RELATED, but it seemed like a good place to ask

I'm working on making an RTS-type game (really I'm just starting to program it, but I've got most of how it will work figured out in my head already), and since I'm just starting to create a scripting language for it, I'd like to know what everybody would like to see in a scripting language for an RTS? I'd like to hear anything you think should be allowed with it, even if you don't think it could possibly be implemented because it might give me or somebody else a good idea for something that is possible.

Just list everything you think a good game scripting language should have, even if somebody else already listed most of your ideas (it helps to know how popular any feature would be =-)
If you can't think of anything, just list things you wish the WC3 scripting language could do (or things it does but you wish were easier to do with it)

Of couse, since its just a hobby project, its likely to never get done, but it can't hurt to try =-)
01-14-2003, 08:10 PM#2
SuperIKI
Make it open source, so the modder can modify EVERYTHING!!!
:D
Not like these few things you can do with WE.

Or like Half-Life did it. They released an SDK with tons of source code.
And Descent 3 and Quake 3 released even more source code to mod the game.
01-14-2003, 08:14 PM#3
Extrarius
I plan on making much of the game in the scripting language. It will be more like unreal where instead of getting source for a game dll you get to modify everything via script. The reason I'm going to do it that way is because RTS games are usually modified per map instead of having mods like in FPS do where you have 1 dll and 50 maps to go with that mod. (Though I might make a way to allow that style of modding also, where one script is applied to several different maps)

I just need some help deciding what features the language should have in order to make modding fun instead of a tedious war between the programmer and the language like jass seems to cause. I've seen so many people say "I have a cool idea for a map, but how do you do ___" and the only response they get is "You can't do that" or "You can't do exactly that, but with 50 triggers you can almost fake it" and I don't want that kind of thing being said about the game I plan on making =-)

The game itself probably won't be open source, because I want to prevent cheating and its nearly impossible to do if 'hackers' can compile their own clients and servers modified however they want.
01-14-2003, 10:03 PM#4
magnus99
First-class pointers (and the associated custom datastructure declarations; like a struct). That's the one thing that is missing from JASS that makes it a pain to use for anything substantial. Though there are understandable reasons for omitting it; e.g., no need to worry about garbage collection. Though for a scripting language using something simple like reference counting is usually good enough even if it doesn't work all the time.

Why don't you use an already established scripting language, like perl or python? That's that most open-source and non-commercial games I know of do. Another route is to just use C and write a (or modify) custom compiler that generates dynamically loadable code, like Renderman does with shaders. Afterall, its the API that matters; not the language.

magnus
01-14-2003, 10:24 PM#5
Extrarius
Well, I've thought about using an already popular scripting language, but 5 seconds of looking at python eliminated it as a possibility. I can't stand one of the most basic things of python: whitespace matters. You can't tab however you want because tabbing makes a difference in how the code is interpreted.

I also thought about using perl, but from what I remeber of it (and its been a while) it doesn't support the some things I want, like inheritence. That will probably be important since I plan on the script basically running the game, there will be general classes and specializations(subclasses) that define the specifics of different kinds of things.

Also, its more fun to do everything myself =-) I'll probably get some help making models, but I plan on doing as much of the programming as I can. Part of the reason for doing the scripting language it to learn from the experience.
01-15-2003, 01:52 AM#6
magnus99
For the record, Perl does support classes and inheritance, though it is not really something that can be used very cleanly. (An understatement, but probably accurate compared to the rest of the language :)

But yeah, writing your own language, expecially if it is interpretive and not compiled, is pretty simple. There are lots of toy OOP languages (toy = compiler written in like a week) out there like Cool that have about 10x more expressive power than JASS. My guess is that the hardest part was integrating the scripting language with the netcode, as demonstrated by all the corner cases that cause desyncs. IMO, its not really something you can divorce from the language's interface unless you synchronously ship every op or rely on a strict client-server model where the server is not allowed to die.

magnus
01-15-2003, 04:16 PM#7
Extrarius
I really hadn't thought much about the netcode yet, but it seems like it would be easy enough for the various clients to send eachother basically every action(click, command, etc) of the player, and keep acting on the last several orders until a new one arrives. If there is 1 random seed(and associated generator) per player, it should be easy to predict the path each unit will take(for ex) because the actions of the other players and when they are recieved wont change the random number generator used to control another player's units.

Anyways, for now I mostly care about the scripting language because I have some other (much smaller) projects that could benefit from being scriptable as well. While it is true that its easy to make simple languages (and there are a LOT of tutorials on making such languages, like at gamedev.net and flipcode.com), I need something a little more complex because I want to be able to basically write a game in it. It want the game exe to basically contain the drawing code and the interpreter and none of the logic at all.

I plan on using a VM (probably a stack machine) and pre'compiling' the script rather than interpreting it as it runs.

You sound like you know what you are talking about (and that seems to be rare in the CS field [of course I'm still a lowly student, but still only 1 teacher of the 4 I've had seems to REALLY know what he's talking about]).
I'd love to get your ICQ# (assuming you use ICQ) or email so I can ask you lots of questions =-). My ICQ # is 56475040 and you can send me email at [email protected]
01-15-2003, 10:35 PM#8
dataangel
Look to war3 as a basic model, i.e. support every action/event/condition that war3 does. It has the best RTS scripting language thus far in terms of power.


Some language features:

-Structures/Classes
-Pointers -- DONE WELL. set *player1herofheight = &Flying Height of(hero1) -- now you can just do *player1heroofheight to always have that height available. Basically lets you monitor select values.
-Add values to units feature. Like I can attach the number 1 to a unit, and then I can later ask for the number attached to this unit, and it returns 1. May want to make units structs with the unit themselves and an amorphous linked list for any values the player may want to attach to the unit.
-Recursion (I think JASS supports this anyway, but don't forget)
-GOOD compilation -- i.e. not like WE's where it looks at each trigger individually so you have to declare functions over and over.


GUI features:

-Have a GUI for the noobs, but make it so that the actions/conditions/events/etc. available in the GUI are automatically generated from the code and comments in it, not a separate file defining every one.


Some functions to ship with:

-Keyboard/mouse click detection.
-CurrentCursorPosition()
-Display text at point in game x,y
-Display text at point on screen x,y
-Display image file at point in game x,y
-Display image at point on screen x,y
-ForcePlayerToGiveOrder(order, unit [,location]) <-- to avoid desync problems
-ForcePlayerToPressKey(string) that takes more than just one letter at a time (Which prevents you from being able to set it up for Esc or F1 or something like that)
-Rotate Unit/Dooad on _ axis _ degrees. (to allow leaning towers, units spinning through the air, etc.)
01-16-2003, 01:27 AM#9
Extrarius
I plan on modeling it after C++(so it has classes/structs, pointers, lots of power) and making it use a VM (so code is compiled before its run which speeds up run speed and slows down either loading a map in game or saving a map in the editor).

The unit data type would be defined in the scripting language to have all the fields the scripter wants, and the game won't care at all. Really, what I plan on doing is making the game exe like a graphics library. The script says draw a model at a position if it wants a unit to be visible, and the game complies. The script basically runs the whole game. Of course, usually a mapper won't modify a lot of it, they would just add some events like in WC3. But if they want to, they can, because its all there.

If I can get it working in that style, it means that if you wanted to have every unit have a new stat, say stamina, you would just add "float stamina;" to the unit type, and you could use that in your code however you want.
01-16-2003, 02:31 AM#10
magnus99
Be careful what you wish for; your description sounds an awefully a lot like Java. While I love the language as a developer, I do not dellude myself about the speed of interpreted byte-code (or even JIT/natively compiled byte-code from Java or C#). Graphics are not the only things that need to be efficient, and any non-natively compiled langauge will always be at least an order of magnitude slower. [If I were planning something that was so similar to Java, I would use Java itself in a second; it has standard bindings for native code; there are already several blazingly fast OpenGL/Direct3D JNI implementations, and you get literally everything you could want in a "scripting language" for free -- garbage collection, "transparent" dynamically loadable code, memory protection, and OOP... but enough about Java :)]

I haven't used ICQ in a long time (Mac/Linux person mainly; Windows is just for games :). My aim handle is jqpang, but I go mainly through email (jp at magnus99 dot dhs dot org).

magnus
01-16-2003, 11:58 AM#11
Extrarius
To put it simply, I despise java with a passion. I don't really know why, except I've yet to see a program that used java that wasn't very slow and very buggy. And most Java VMs seem to be buggy too.

Plus, I wouldn't learn nearly as much using something premade for me =-)

And, I know graphics isn't all that needs to be fast, I would put things like pathfinding and terrain rendering using partitioning into native code. My point is that I want as much as possible in the scripting language.

I've been looking around and so far the closest comparison I can find to what I want is UnrealScript. From the looks of it, its a very nice language with a lot of features. I figure if a huge company can do it, so can I =-P At least I know its possible anyways. Not all scripting language are as slow as Java (at least it doesn't seem like they are - I mean quake C sucked as a language and it was implemented poorly [according to id] but it was still fast enough to work a lot of the logic of quake on old P1 machines)
01-16-2003, 06:14 PM#12
algumacoisaqq
Quote:
-Keyboard/mouse click detection.
-CurrentCursorPosition()
-Display text at point in game x,y
-Display text at point on screen x,y
-Display image file at point in game x,y
-Display image at point on screen x,y


Now I think that's the thing I miss the most about Warcraft. you could also try a better spell sistem, make spells scripted, not partialy hardcoded like blizzard ones (of course a lot will have to be hardcoded, but i think it could be more flexible). Let people change the interface too, like making buttons and stuff. And give us better arrays, pointers and stuff like custom queues, stack lists, etc. And a long string variable, blizzard ones are too short.
Also, try to give ascess to all the variables used in game to the modding guy, this would include the mouse position, the keyboard position, but also would give him the possibility to play around with stuff like the queue of units in game, number of units in game, and each stat of unit (They would be stored somewhere, so give the moder the chance change them, think about stuff like the tooltip of a spell, it's stored somewere, so people could change it if they have acsess to it).

Good luck :D on your project, and remember: start small, and with time, make the biggest kickass script engine.

(btw, I know that most what i posted was very hard to acomplish, but you said you wanted a madman wishlist)
01-16-2003, 09:08 PM#13
Extrarius
Quote:
Originally posted by algumacoisaqq
[...]Good luck :D on your project, and remember: start small, and with time, make the biggest kickass script engine.

(btw, I know that most what i posted was very hard to acomplish, but you said you wanted a madman wishlist)
Aye, that I did, and I thank you for your reply. I plan on trying to do all that stuff, and its nice to know people actually want it =-)