Author Topic: rl oriented scripting language features.  (Read 41993 times)

siob

  • Rogueliker
  • ***
  • Posts: 64
  • Karma: +0/-0
  • blit(brain)
    • View Profile
    • gamejs
Re: rl oriented scripting language features.
« Reply #30 on: June 25, 2011, 09:59:05 AM »
i'm wondering, does speed really matter in roguelikes? maybe for the AI?

i haven't finished a rogue yet, but we're happy with scripting a complex Java machinery with JavaScript at work. Certainly made our team more productive :)

Z

  • Rogueliker
  • ***
  • Posts: 905
  • Karma: +0/-0
    • View Profile
    • Z's Roguelike Stuff
Re: rl oriented scripting language features.
« Reply #31 on: June 25, 2011, 01:33:47 PM »
Consider something like ADOM's animated forest, which contains something like 1500 monsters. Each of them move each turn. If you calculate FOV for each of them, and it covers the whole level, that is 2000 cells. Let's say you do 20 simple operations on average for each cell. Then you get 60 millions operations per turn. Current computers do about 400 million simple operations per second, so if you would get a slight lag. If you use an ineffective script language, or notify each monster whenever a monster in its sight moves, or your monsters have equipment and bodyparts which affect the strategy of other monsters, or something like that, then it will be too slow.

So it seems that you cannot have a roguelike which features heavy expressive-but-inefficient scripting, huge armies of monsters, large FOVs, and complicated AIs.

But huge armies and large FOVs are things that (in most cases) you can remove easily once it turns out that the game is too slow.

TSMI

  • Rogueliker
  • ***
  • Posts: 65
  • Karma: +0/-0
    • View Profile
    • Email
Re: rl oriented scripting language features.
« Reply #32 on: June 25, 2011, 11:36:52 PM »
Consider something like ADOM's animated forest, which contains something like 1500 monsters. Each of them move each turn. If you calculate FOV for each of them, and it covers the whole level, that is 2000 cells. Let's say you do 20 simple operations on average for each cell. Then you get 60 millions operations per turn. Current computers do about 400 million simple operations per second, so if you would get a slight lag. If you use an ineffective script language, or notify each monster whenever a monster in its sight moves, or your monsters have equipment and bodyparts which affect the strategy of other monsters, or something like that, then it will be too slow.

So it seems that you cannot have a roguelike which features heavy expressive-but-inefficient scripting, huge armies of monsters, large FOVs, and complicated AIs.

But huge armies and large FOVs are things that (in most cases) you can remove easily once it turns out that the game is too slow.


The sane policy would be to write that bit in C, instead of the whole thing :D

The overhead for C modules (for Ruby at least) is quite small, for a big C function that does  alot of grunt work you can't even pick it up.

linux_junkie

  • Newcomer
  • Posts: 28
  • Karma: +0/-0
    • View Profile
    • Email
Re: rl oriented scripting language features.
« Reply #33 on: June 26, 2011, 12:34:00 AM »
i'm wondering, does speed really matter in roguelikes? maybe for the AI?

i haven't finished a rogue yet, but we're happy with scripting a complex Java machinery with JavaScript at work. Certainly made our team more productive :)

I can speak from experience with this one, having produced two nDRLs, both primarily written in Lua, using C++ calls to libtcod.  While Lua is a very fast scripting language (most benchmarks place it as a serious contender among the fastest), some frequently called operations caused significant speed issues.

This was a particular problem for Zombie Swarm, which featured large numbers of zombies, as well as up to three allied AIs.  The allied AIs weren't very complex, and the zombie ones were downright simple.  But repeated calls to these routines (I should note the game was in realtime) resulted in significant slowdown, even on fast machines.  So even with most of the heavier lifting being done by libtcod, like with pathfinding, I just found a scripting language inadequate.  But after moving the AI primitives (move-to-player, attack-player, etc) over to C++, the speed quit being such an issue.  It still wasn't fast enough overall, but I also had lighting effects and other such things further slowing things down.

All in all, I'm still definitely in favor of utilizing scripting languages, but believe that they should be used for what they're good for, and core engine behavior isn't it.  After my experiences embedding Lua in C++, I can't imagine ever writing a roguelike in anything else.  It made my coding sessions far more productive, as well as allowing me to painlessly make minor balancing tweaks, that would have been a chore in C++.  Not having to recompile every time you change a couple values is a huge blessing.

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: rl oriented scripting language features.
« Reply #34 on: June 26, 2011, 08:17:00 AM »
Not having to recompile every time you change a couple values is a huge blessing.

That's what modern IDEs are for, they only compile files you change and compile times are pretty close to zero. Linux users however may be unaware of such modern tools... and they have to use scripting.

daver64

  • Newcomer
  • Posts: 16
  • Karma: +0/-0
    • View Profile
    • Indigo
    • Email
Re: rl oriented scripting language features.
« Reply #35 on: June 26, 2011, 10:42:46 AM »
Hi,

I've been a bit busy over the last week or so and have only now just caught up with the thread. Very interesting discussion with much to ponder :).

In fact there is so much material I'll need quite a bit longer working out a proper coherent response!, however one thing I would like to add is that ultimately I don't think it matters too much whether you script or don't script as long as the job gets done.

Cheers
Dave
 

linux_junkie

  • Newcomer
  • Posts: 28
  • Karma: +0/-0
    • View Profile
    • Email
Re: rl oriented scripting language features.
« Reply #36 on: June 26, 2011, 12:59:42 PM »
Not having to recompile every time you change a couple values is a huge blessing.

That's what modern IDEs are for, they only compile files you change and compile times are pretty close to zero. Linux users however may be unaware of such modern tools... and they have to use scripting.

You don't even need a modern IDE for that, since makefiles have been doing it for decades now.  Regardless, I use a modern IDE, and recompiling still takes longer than simply saving a script file.  That's not even to mention the fact that scripts can be edited and saved while the program's already executing, which also saves you the time of having to restart your application.  Good luck doing that with C/C++, regardless of how modern your IDE is.

And as for your silly, pointless, uneducated comment regarding Linux users, well, that actually was about what I expected from you anyway.  Most good IDEs are cross platform, and from my experience, the IDEs that are not cross platform tend to suck anyway.  I can't imagine having to do any serious work on a Microsoft system.

Xan

  • Rogueliker
  • ***
  • Posts: 78
  • Karma: +0/-0
    • View Profile
Re: rl oriented scripting language features.
« Reply #37 on: June 26, 2011, 01:11:00 PM »
That's not even to mention the fact that scripts can be edited and saved while the program's already executing, which also saves you the time of having to restart your application.  Good luck doing that with C/C++, regardless of how modern your IDE is.

I'm not taking any sides here, but I do want to point out that Microsoft's Visual Studio has had an edit-and-continue feature for quite some time...

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: rl oriented scripting language features.
« Reply #38 on: June 26, 2011, 08:50:59 PM »
Regardless, I use a modern IDE, and recompiling still takes longer than simply saving a script file.

Yeah, but it can't be other than matter of couple of microseconds. Unless the IDE or compiler is awfully slow.

Quote
And as for your silly, pointless, uneducated comment regarding Linux users

They are silly, those stone age linux users.

Quote
I can't imagine having to do any serious work on a Microsoft system.

Well, actually, all serious work is done in Windows systems. You can't work with linux, because it needs constant updating and it's unreliable. Linux is mainly for hackers who want to do everything the hard way.

TSMI

  • Rogueliker
  • ***
  • Posts: 65
  • Karma: +0/-0
    • View Profile
    • Email
Re: rl oriented scripting language features.
« Reply #39 on: June 27, 2011, 04:07:36 AM »
Considering linux runs on the 10 fastest super computers in the world, I'd say that the most serious work gets done on linux :) Windows is probalby only good for writing gui's and facebook apps.

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: rl oriented scripting language features.
« Reply #40 on: June 27, 2011, 08:10:20 AM »
Considering linux runs on the 10 fastest super computers in the world

It's not work, just some crazy scientists playing with simulations.

purestrain

  • Rogueliker
  • ***
  • Posts: 172
  • Karma: +0/-0
    • View Profile
Re: rl oriented scripting language features.
« Reply #41 on: June 27, 2011, 10:57:57 AM »
That's not even to mention the fact that scripts can be edited and saved while the program's already executing, which also saves you the time of having to restart your application.  Good luck doing that with C/C++, regardless of how modern your IDE is.

I'm not taking any sides here, but I do want to point out that Microsoft's Visual Studio has had an edit-and-continue feature for quite some time...

Which doesn't work under 64Bit-Systems if you don't specifically target 32bit. And compile times are horrible in c#/.net compared e.g. to java =) Its very annoying if you practice tdd.

siob

  • Rogueliker
  • ***
  • Posts: 64
  • Karma: +0/-0
  • blit(brain)
    • View Profile
    • gamejs
Re: rl oriented scripting language features.
« Reply #42 on: June 28, 2011, 10:52:29 AM »

Well, actually, all serious work is done in Windows systems. You can't work with linux, because it needs constant updating and it's unreliable. Linux is mainly for hackers who want to do everything the hard way.


serious work is serious!! :D

daver64

  • Newcomer
  • Posts: 16
  • Karma: +0/-0
    • View Profile
    • Indigo
    • Email
Re: rl oriented scripting language features.
« Reply #43 on: June 28, 2011, 01:17:22 PM »
I have too - scheme can buy you loads IMO, once you know how to get some power from it.

It may interest you to know that Guile, which was designed to embedded, has finally reached version 2.0, and is appareantly much improved.

Hi,
 I keep a modified copy of S7 scheme to hand ( https://ccrma.stanford.edu/software/snd/snd/s7.html ). It's a bit basic , well extremely basic actually :), and lacks the features of a full blown scheme like Guile or DrRatchet, but I've found it very handy for providing a good bit of intelligence to a couple of C++ apps I maintain for work.

Cheers
Dave