Game Programming in Prolog
The author explores game programming with Prolog, highlighting its logic-based approach, declarative nature, and potential for robust gameplay systems through actors defined by tags and relationships. Future parts will cover dynamic changes.
Read original articleThe article discusses the author's exploration of game programming using Prolog, a logic programming language distinct from conventional object-oriented languages like C# and Java. The author reflects on their journey of learning Prolog, noting its unique syntax and the challenges it presents compared to more familiar languages. They highlight the potential of Prolog in developing complex systems, particularly in game mechanics, by utilizing logical relations as foundational elements. The author proposes that core gameplay mechanics can be effectively implemented in Prolog, emphasizing the benefits of a declarative approach that enhances robustness and modularity. The article outlines the structure of a game world consisting of actors, which are entities that interact within the game. It introduces the concept of tags to define actor characteristics and relationships, using Prolog predicates to establish these connections. The author illustrates how to assign tags and define relationships between actors, such as the ability of a human actor to eat bread or a fungus to spoil decomposable items. The article concludes by indicating that future parts will address how to incorporate dynamic changes in the game, moving beyond static definitions.
- The author explores game programming using Prolog, emphasizing its logic-based approach.
- Prolog's declarative nature is seen as beneficial for developing complex game mechanics.
- Actors in the game world are defined with unique tags and relationships using Prolog predicates.
- The article highlights the potential for modular and robust gameplay systems through logic programming.
- Future installments will address dynamic interactions and changes within the game.
Related
Deconstructing the Role-Playing Video Game
The article explores the creation of rpg-cli, a role-playing game inspired by classic Japanese RPGs. It uses a command-line interface to simulate dungeon exploration with automated battles and draws from RPG design history.
My favorite tools and techniques for procedural gamedev
Casey Primozic shares his procedural game development techniques, focusing on seamless textures, custom shaders, AI-generated textures, and volumetric effects, while exploring future applications like Constructive Solid Geometry for 3D manipulation.
How good can you be at Codenames without knowing any words?
The article examines Codenames, highlighting strategies like using word layout for winning, the potential of a positional bot, and the role of AI in programming and game strategies.
Prolog-rs: Minimal Prolog implemented in Rust
Prolog.rs is a minimal Prolog interpreter in Rust for learning purposes, featuring over 350 unit tests, basic constructs, and data types, but lacking performance optimization and some Prolog features.
The Liberating Experience of Common Lisp
The author critiques modern programming languages for their complexity, praising Common Lisp for its stability, unique developer experience, and creative freedom, making it preferable for software development.
https://thingspool.net/morsels/page-11.html (part 2)
https://thingspool.net/morsels/page-12.html (part 3)
https://thingspool.net/morsels/page-13.html (part 4)
https://thingspool.net/morsels/page-14.html (part 5)
(and keeps going!)
The Youtube link is here: https://www.youtube.com/watch?v=QyMsF31NdNc&t=2354s
It seems like most rule-based stuff in games is just hand-coded, as it's relatively simple and doesn't need to be general. When I asked the author of Baba is You, if he implemented a datalog engine for it, he said 'no'. I suspect it's the same for Breath of the Wild.
But still, I've often wondered if that sort of chemistry engine would be best implemented in a logic language like Prolog or Datalog, for fast experimentation. Just like how we use SQL to keep the flexibility of our queries, and we end up just shipping that. I'm sure, back in the day, lots of people lamented how slow SQL queries were. The flexibility was useful enough that we ended up pouring man-centuries into making them fast. Now, we think that's just the way you ship things, and (almost) never think, "I can hand-roll imperative code that will be faster than this query".
Not sure if I'm missing anything, but nothing yet has been concerned with any kind of user interaction which would seem to be a pre-requisite for a game, although there was a brief discussion about sending messages so maybe that's what he was intending.
Adventures in Rule-Based Programming: A CLIPS Tutorial https://a.co/d/7wVOcZp
I personally experiment in Datascript as a gamestate db, but it's still quite an early attempt to conclude if it's a success. It's great seeing how ideas in this tutorial map 1-to-1 to that idea.
1. https://www.gamedevs.org/uploads/data-driven-game-object-sys...
Bravo!
Or any anecdotes from more experienced prologgers about the experience of writing a real game? At face value it looks like it would be very easy to accidentally tie yourself up in a knot of logical contradictions, but I guess there are tools in prolog land for debugging this kind of thing?
And what prolog implementation should one pick?
Imagine if you can be in "dynamic mode" where you can add rules, facts, etc. in an adhoc way.
Then, once your game is better defined, you can compile the Prolog to native code so that it is highly optimized, executed in parallel, etc. The compiler could apply all sorts of optimizations we see in commercial game engines automatically.
This compiled object could then be embedded into a game engine with native performance.
Done right, this could even outperform imperative game engines, but be very easy to debug and modify.
Related
Deconstructing the Role-Playing Video Game
The article explores the creation of rpg-cli, a role-playing game inspired by classic Japanese RPGs. It uses a command-line interface to simulate dungeon exploration with automated battles and draws from RPG design history.
My favorite tools and techniques for procedural gamedev
Casey Primozic shares his procedural game development techniques, focusing on seamless textures, custom shaders, AI-generated textures, and volumetric effects, while exploring future applications like Constructive Solid Geometry for 3D manipulation.
How good can you be at Codenames without knowing any words?
The article examines Codenames, highlighting strategies like using word layout for winning, the potential of a positional bot, and the role of AI in programming and game strategies.
Prolog-rs: Minimal Prolog implemented in Rust
Prolog.rs is a minimal Prolog interpreter in Rust for learning purposes, featuring over 350 unit tests, basic constructs, and data types, but lacking performance optimization and some Prolog features.
The Liberating Experience of Common Lisp
The author critiques modern programming languages for their complexity, praising Common Lisp for its stability, unique developer experience, and creative freedom, making it preferable for software development.