0

I don't know a lot about declarative languages. I'm looking for simple and minimalistic language to describe objects, their attributes and a way that they react when any environment event occurs. I would like to use, process and write this code from c++.

It would be useful for 2d rogue-like or strategy games, any simulations etc.

Does exist anything like that or similar?

I would like to try to write this on my own, but I don't want to reinvent the wheel :)

Krzysztof Stanisławek
  • 1,267
  • 4
  • 13
  • 27
  • @LightnessRacesinOrbit It's not vague. Let's get typical rogue-like as example. We have friendly NPC, enemies, treasures... Every enemy can have different attack, equipment and tactic... I want to be able to describe all of this in declarative language similar to XML or QML, which will be used by game engine. – Krzysztof Stanisławek Jun 27 '14 at 16:50
  • Why not use an xml parser then? – MikeMB Jun 27 '14 at 16:56
  • Oh, so it's not vague, it's just hopelessly broad. Okay then. With no details about the structures you need to support, scale, types, relationships... there is no proper answer to this question. It's like saying "tell me what software can do what I want" without explaining what you want. The answer, then, is "all of it, or none of it, or some of it". – Lightness Races in Orbit Jun 27 '14 at 17:54

1 Answers1

0

I am pretty sure there are no Declarative Languages that do what you are looking for. Declarative Languages are highly tailored to their problem domain. When you say you want a language that describes "a way that [objects] react when any environment event occurs" makes me think that a Declarative Language is not what you're looking for since that implies side effects.

If you are looking for Embeddable Languages then Lua and Python are both proven. The Warcraft 3 engine used a Lua derivative for its scripting which is very similar to what you are describing, and Python is widely used for embedding in general.

If you are looking for a standard minimalistic data format, JSON is pretty much the way to go, and lord knows there are standard parsers out there.

QuestionC
  • 10,006
  • 4
  • 26
  • 44