Scripting Language for CIV
doomy writes "SLIC the scripting lanugage for Civilization : Call to Power has been released. All all game scripters rejoice and learn this language before the game is out. "
← Back to Stories (view on slashdot.org)
Please, people, SLIC was created to open message boxes and modal windows on the screen, under MS Windows, and react to triggers. Sure, it sucks for anything else, but it was not made for anything else.
... end
Also, there are lot of people missing the mark. Perl? We are not processing strings! Functional languages? Most people hate it. What about something like tinyfugue or tintin++? Not to the point. It seems to me that SLIC does everything it ever aspired to: easy integration into Windows GUI, zero-learning time for the programmers who wrote Civ: CTP, simple syntax for dealing with event triggers.
SLIC does the tutorial. That they have opened it for general use is a great win. I doubt it was ever planned to be a general-use language, and the important thing is: now there is the possibility of a general use language on the next version, if it turns out that a significant number of people like the idea of a scripting language (no matter what they think of SLIC itself).
How about some productive discussion? For instance, their "function" work-around is *not* that bad. It's just an awkward calling convention. For example, instead of writing
procedure example;
begin
you have to write
MessageBox 'example' {
Abort();
...
}
Instead of using
example;
you have to use
message(0,'example');
No parameters? You can work around that through globals (indefinite recursion doesn't seem to be viable, granted).
And, guess what? One can easily use lex+yacc to write a parser that will translate a decent-looking language into SLIC. Or even java-cup, and have it available as a web application. The sole question seems to be who is going to do it, and get all the fame?
cheers,
This Anonymous Person
Javascript might have been a good choice. mozilla.org has a portable Javascript interpreter dual-licensed as NPL/GPL; NPL would work fine here. JS is far less boneheaded than SLIC, it's simple and fairly familiar (C/Java-like), and lots of people use it already in their Web pages. It's also designed for scripting large clunky object systems, which is exactly what's going on here.
Domain-specific languages are lovely but only when you exploit the restricted domain in the language design. SLIC doesn't do that. These "triggers" are just obfuscated event handlers.
Rob
roc@cs.cmu.edu
> 1. domain specific languages can be very expressive
You can create a "domain specific language" by using a subset of an existing language. Have pre-defined commands, variables, etc. You don't *have* to make use of the whole language.
> 2. implementing a new scripting language, and learning a new language, is lightweight to many of us. it requires no effort.
Yes, but *why bother* when a *lot* of work has already gone into making existing languages good.
If the language gets used much, it will eventually grow, and face all the same problems that other languages have. A lot of these mini languages have no new concepts or features, so why burden everyone with yet another knock-off of C or Java or whatever you are emulating?
3. existing languages probably have licensing restrictions.
Tcl, some embedded schemes, as well as python are basically under the BSD license.
4 is the only really valid point here. It's probably fun to write little languages, but I think that it's probably not very productive, if you have real work to do.
Ciao
Activision must have underpaid, glorified hack QA testers writing SLIC scripts.
>When will people start learning that writing their own mini scripting >language is bogus? There are plenty of options out there right now that work >just great, like Python, Tcl, Scheme, Perl, even javascript. Why not use one >of these perfectly fine languages instead of creating the whole thing from scratch?
And while we're at it, why bother with all of this higher-level programming language thing? Real Men program in machine code, but let their Real Women use assembler.
Seriously, if a programming language offers people a new way of looking at how to look at & solve a problem, why not create & let people give it a spin? I, for one, have been wondering when a scripting language for a strategy game like Civ would be created. (I have often wondered why no one has ever added the standing orders features from miniature gaming to computer gaming.)
And if this implementaion sux, well, folks will have something to learn from when they write a perl/Tcl/javascript module for this.
Geoff (forgot my password)
Little languages are easy to implement (thanks to flex and yacc), and in domain-specific cases, they are much easier to learn than their highly general counterparts (Python, Tcl, Scheme, Perl).
Language is a very natural way to communicate both simple and complex ideas to your programs. Also, language is much more compact, powerful, and easier to use than the alternative slew of dialog boxes that could be used.
In short, someone who _doesn't_ regularly program (and even those that do) will have a much better time using a specific little language than an overly general scripting language. Look at Pic or HTML for example.
Me's interested... *What* is this language you are writing (ie. What is it like, why is it necessary, etc.)?
Oh, wait, Windows doesn't support CORBA.
Oh well.
This programming language does not offer a "new way of looking" at anything. It looks like a poor copy of javascript, without a great deal of the functionality. It just offers a number of domain specific functions, that could have just as easily been done in Python, Tcl, Scheme, Perl or whatever bindings to the real C code.
Ciao
Yeah, well Crack Dot Com had a LISP interpreter
to handle the AI in Abuse. It was really sweet,
but look what it got Crack Dot Com... out of
business.
And QuakeC missed a lot of what made C so useful.
That may have been one reason id used C++ in
Quake II?
fuck, I hate it when I automatically use tab for whitespacing in browser forms and end up pressing a random button.
Just ignore the comment. It was just an incomplete outline, which, when I think about it, I would probably never have conciously submitted.
-segfault
I don't think you got the point. There's no reason a little language can't be implemented in a high level extension language, like guile.
What is the actual difference between
-segfault
When will people start learning that writing their own mini scripting language is bogus? There are plenty of options out there right now that work just great, like Python, Tcl, Scheme, Perl, even javascript. Why not use one of these perfectly fine languages instead of creating the whole thing from scratch? Tcl, infact, was invented for this very reason - many people don't seem to care for the language itself, but its C API is a lot of fun to work with, and I highly recommend it. Python's C API also seems pleasant - I'm not quite so sure I like Perl's, and I think it's harder to make a restricted interpreter, but I'm sure it can be done.
Ciao
Guile is an implementation of Scheme designed to be an extension language--- you can link it to your application, and code custom primitives in C.
The documentation was not quite there last time I checked, though.
BTW there is another, non-GNU Scheme extension language: Elk.
---
Posted by FascDot Killed My Previous Use:
Why not Guile like FreeCiv is doing?
That is an...err.. interesting approach to functions. I tend to agree that it would have been better to use an existing language, if only as the basis. Strip down Perl a bit (regexp is probaly not a requirement, for example)...
This sounds like it could be a fun feature of a (I hope) great game. The only way I can think of it is in terms of CIV. I would try to set it up so that I had an early warning system. Whenever one of my units saw an enemy, and I forgot about them, I'd get pissed. Then I'd miss my chance to fight. I think also a good application would be automated production. A dialog could pop up when a city gets a new unit, and allow you to continue pumping out units, automagically.
Man do I want this game.
Yes, I'm still a junky. Are you still a bitch?
> No autosave
The linux beta at least does have autosave.
You just have to manually move the save file to
use it.
Gift horse? Gift horse?
I didn't realize this game was a quadruped mammal. How interesting...
Javascript turns out to be really suitable. It's easy to pare down, has a good native interface, can compile to bytecode at runtime, and supports multiple contexts.
BTW, also worth a look are tinyscheme (which is a nice small embeddable Scheme), Python, Lua, and the fairly obscure ICI. ICI is a very nifty C dialect for scripting but it doesn't seem to be intended for embedded applications.
Nothing wrong with rolling your own, though. Especially if you've got a lot of scripters to support. I'm interested in seeing how Q3A's plans for scripting in ANSI C (using lcc) turns out.
The beta does indeed autosave.
It still beats CivII's very limited event-oriented "scripting" - be happy for small favours, don't look a gift horse in the mouth, etc. :-)
Plus, it seems from postings to csipgs that there is a "rushed" feel to it overall - perhaps there was no time to merge a "proper" scripting language with it.
A few reasons to write one's own language:
1. domain specific languages can be very expressive
2. implementing a new scripting language, and learning a new language, is lightweight to many of us. it requires no effort.
3. existing languages probably have licensing restrictions.
4. not-invented-here
another reason to create a new language: efficient execution of the script. the game should execute smoothly and in real time. the language subsystem should require little of the cpu, and more importantly should have a small memory footprint and minor cache effects. which probably explains all of their compromises. lack of local variables: only one hash table is necessary for lookups. integers don't require forward declarations, but the other types do: cuts down on ambiguity (but why not also require declaration of ints?). no functions: one less language construct to handle.
many past and current languages were designed without regard to implementation. this language could very well be the opposite: concern more for implementation rather than feature bloat and syntax purity.
I like this comment and am very interested in the answer. Do me a favor and post this on http://natas.kfa.cx/~natas/wwwboard/wwwboard.html :)
The Lokisoft guys come in there alot and answer questions. And this is a very nice one
Natas
Natas of
-=Pedophagia=-
http://www.mp3.com/pedophagia
Also Admin of
http://loki.linuxgames.com
Hahhah. Go hit the SLIC link and then say this. That shit is the worst "scripting" language I've ever seen. It reminds me of ObjectPAL from Paradox. NO FUNCTIONS! THERE ARE NO FUNCTIONS! NOT EVEN A GOSUB/RETURN!
Contrast that to something like Object Domain (http://www.objectdomain.com), a CASE tool that has TCL embedded. I was able to write an SQL generator in under 30 minutes that saved me 3 hours of work. If they'd done something like SLIC it probably would have taken several hours.
Writing your own languages is a good idea if you're an expert. Whoever created SLIC should have thought a little longer about their options.
-sunking
Well i got civ3 for *cough* windows, its a really good game, although i miss my city screen from civ2. There are also a few bugs and a lot of unbalancing in the game, but i'm sure that will all be fixed with patches.
Gift horse? Gift horse?
I didn't realize they were giving the game away. How interesting...
--
--
Jason Eric Pierce
I agree. Although I think it is strange that you have not mentioned any lisp dialect here. Guile had been perfect.
And BTW, you don't really mean that you prefer writing AI in C?
-segfault
Why not in assembly? Or even better, "typing" the "scripts" directly on a floppy with a magnetic needle?
Personally, I can't see a single reason for using C as a scripting language, except "I'm going to commit suicide next week, and need to get in the mood".
-segfault
IMHO, I think Activision took a big risk by letting Loki release the Linux version two weeks after the Windows one came out. I mean, I would have bought it off the shelf at Best Buy the day it came out -- sheer force of the reputation of the previous two games. Now, I'll have to see if it sucks or not by talking to my non-Linux-using "friends".
Of course, I'll probably still buy it. I've been playing Civ2 for so long I'm starting to get retinal burn-in of the city screen...
----
Every year during my review, I just pray the words "slashdot.org" aren't mentioned.
I agree. Although I think it is strange that you have not mentioned any lisp dialect here. Guile had been perfect.
I'll agree in theory - although I personally am not a comp sci major and haven't been forced to wrap my brain around functional programming. The idea of say, summing a list via recursion instead of a loop just doesn't feel natural.
I also don't know enough about Guile specifically - how easy is it to interface with code written in other languages?
And BTW, you don't really mean that you prefer writing AI in C?
Just an example, just a theoretical example... but one point I was trying to make is that if you can link to C code, it's possible to write wrappers as a "gateway" to just about any language out there for people who really hate your particular scripting choice.
As a programmer who is currently writing a *very* powerful scripting language that straddles the line between a scripting language and a programming language, SLIC is pathetic. No user-defined functions, no local variables, no objects, no parameter passing, no class inheritance, etc. SLIC makes Perl look great.
SLIC sucks - Activision must have really underpaid programmers working on this game who don't know how to write scripting languages!
DES Khaddafi KGB genetic jihad Uzi Rule Psix Qaddafi cryptographic Peking Mossad Legion of Doom Albanian Serbian Saddam
I'm curious how well the patches will be propagated to Linux. The best we can hope for is that Activision will have LokiSoft do all the patches. But is there any possibility that some patches won't be propagated?
For instance, if Activision has to shell out $$$ to LokiSoft every time an update needs to be done, they probably won't be very enthusiastic about it. Does anyone know what their contract calls for in terms of patches/updates?
Sheesh, evil *and* a jerk. -- Jade
Yet Another Scripting Language, that is.
And not a good one either - what were they thinking? While SLIC does not directly support user defined functions, there is a workaround. I'm sorry; I'll get by without object oriented programming fine, but at least give us functions to work with. I can't even imagine writing a script longer than a couple hundred lines in this. Not to mention the undeclared variables (what do you mean there's a typo in my script? There was no parsing error!), and the lack of locally scoped variables, structures, pointers/references, or many other features of every useful language created in the last 30 years.
They would have had less programmer work, probably earned greater performance, and definitely made the game infinitely more extensible, if they'd added a Perl, Python, or even Tcl interpreter instead of creating this travesty. (Hell, Java, Javascript, etc. would work too if the licensing was OK.)
They also would have tapped in to the vast mountain of existing code out there. Imagine a python script that, at the end of every turn, updates a web page with a summary of the game. Imagine a perl script with the Gimp module, allowing you to make animated GIFs of the battles when you press a button. Imagine writing (and compiling) your own AI in C, then hooking it up to libtcl, perl XS, or whatever...
Not that this is all bad - I mean even crippled user extensible scripts are definitely preferable to no user extensibility at all... but they hit on an idea that could have been as revolutionary to strategy games as QuakeC was to 3D shooters, and it hurts to see they missed the target.
Good news and all, but I'm worried about the negative issues I've seen about CtP on www.gamecenter.com. While the review in general was overall saying good things about CtP, there are some points it brings up:
No autosave
(Which can actually can be addressed with an Aborted() messagebox with a contained SaveGame(...) function... check out the SLIC)
Difficulty in identifying units on the map
(There may be something doable with the SLIC as well, by using a permanent or popup box which labels every unit you select or click on...)
Lack of explore/patrol
(Hmmm... looks like SLIC may be able to do something with this as well, though my be just a bit clunky)
I also wonder if the SLIC allows for the creation of Wonders and new effects...
I guess actually trying the game with some SLIC script would be the only way to find out.
I wonder what CmdrTaco(he does have the Linux port beta, doesn't he?) or other beta testers think of the review and these 'problems'.
AS
-AS
*Pikachu*