6

Have any commercial video games ever used Prolog? With is rules-based logic based model it seems like it have some place in the industry.

PS: as odd as this question is it still meets all the criteria for a question on SO.

Sled
  • 18,541
  • 27
  • 119
  • 168
  • 1
    I suspect some games might embeed a prologue like language for handeling dialog/quest giving. Morowind had a kinda of query based lanauge for its dialogue, but it was no where near that advanced. Thus I can see a more advanced system potentially existing. – Frames Catherine White Mar 24 '14 at 03:24

2 Answers2

6

Not a commercial game, but I was in a game jam just this last weekend, and we wrote the entire game (a small MMO) in Prolog. It's probably only a fantasy, but we discussed expanding the game into a game engine. That game engine would be rule based.

I guess I should add that I've worked on prolog systems that were near real time.

Anniepoo
  • 2,152
  • 17
  • 17
4

I work in the game industry and I doubt it very much. I have seen only one guy use prolog and it was for a build bot rule to automerge git branches into subproducts and overversions, and not in a game company.

That said, it could make sense for some fuzzy AI, but everything related to AI in the business is far from the research papers in practice. Real game developpers and producers hate unpredictability, basically for business reasons, today games are merely interactive movies.

Everything is on rail, scripted and controlled. Artists are very uncomnfortable with algorithmical rules, and game designers are artists. In my programmer's opinion, games with sophisticated AI must have beneficiated from a high ranking programmer in the company to push for it.

Or the game really required it, for example hitman. However if you see some of their talks (they have presentations at GDC, Cedec...) they say most of their work is empirical, and I tend to think by that, made in typical imperative programming.

Thirdly, you also get the problem of maintenance, and people knowing the language, which is.. few. Most of computer science graduates will have heard of it, followed some tutorial at the school/university but quickly forgotten about it anyway later. And you see, in game companies, a good percentage of programmers are self made, and even drop outs ! This leaves little room for prolog I can tell you that.

Lastly, you need to think about a technical point : performance. prolog underlying execution machine is somekind of a danger to real time. Because it has this simplex solver based on tree branches elimination heuristics which can run for god knows how long. Most games make scarse use of multi threading because of platforms limitation, or because of synchronization problems with the game data which has to be in synch on a by-frame basis for lots of things.

v.oddou
  • 6,476
  • 3
  • 32
  • 63
  • 1
    Hmm, I was thinking that in games based on board games or turn-based RPGs it might be easier to express all the rules in Prolog since it'd better match they way in which they were written. – Sled Mar 24 '14 at 13:55
  • @ArtB: I'm not one to argue against that ! Prolog will make sense on a technical (mathematical/philosophical) level, but it rarely makes enough sense to justify the business side, is all I'm saying. The same way that sometimes lisp would make sense in a partical software place, but C is used instead because programmers are more comfortable in C, or because it is a pain to make work together. (eg SWIG)... – v.oddou Mar 25 '14 at 00:46
  • I'm not surprised that many don't use it, but that no one seems to have that's is a surprise. I understand the reasons, but especially in game dev there are lots of renegades. – Sled Mar 25 '14 at 03:14
  • 1
    @ArtB: Bit of news, I have stumbled accross this excellent article series about the making of crash bandicoot. The main programmer did develop his own lisp interpreter and extended over it to make GOOL. If you are a strong willed, technical oriented, working until 4AM, and executive-level responsible project manager, you may use esoteric languages in game making after all : http://all-things-andy-gavin.com/2011/03/12/making-crash-bandicoot-gool-part-9/ – v.oddou Jun 30 '14 at 06:22
  • You might be able to use subsets of prolog such as datalog in a game though, since many queries could be compiled to relational joins that the ECS system can already do efficently. But in that case you have to throw out the backtracking semantics – saolof Apr 10 '21 at 17:34