Logika
A downloadable tool for Windows and Linux
What is Logika?
Logika (Logic in Esperanto) is a FSM (finite state machine) implementation for Ren’Py, FSM have a draw (graphic) that is a representation of the logic and the flow of process (label for Ren’Py).
This is a FSM draw
Why to use?
Well, when your history/game have very complex paths, is more easy only change the logic, with that you can concentrate in the writing process. For example you need to add a new scene between two scenes, that need to check the code and validate that don’t break the code, but with FSM (Logika) you only change the logic add a new line and change one.
The logic before change:
IF scene_old1 SEND next GOTO scene_old2 IF scene_old2 SEND next GOTO scene_old3
The logic after change:
IF scene_old1 SEND next GOTO scene_new1 IF scene_new1 SEND next GOTO scene_old2 IF scene_old2 SEND next GOTO scene_old3
How to use?
First, circle in the figure is a script (label and its content), arrows are how they move (flow) and the pharse to continue (return value), for exmple "CH1" is.
label ch1: a "bla bla bla" return "next"
In the "script.rpy" write this.
Label start: $ logic_game=FSM_logic() $ state=logic_game.logic("") call expression state while (_return!="gracias"): #key phrase to finish $ state=logic_game.logic(_return) call expression state # $ print logic_game.read_logger() return
Logika, create the rpy class with the logic you write it.
The logic for the FSM draw is:
START Prologue IF Prologue SEND next GOTO ch1 IF ch1 SEND next GOTO ch2_beginnig IF ch2_beginng SEND next GOTO path1a IF ch2_beginng SEND next2 GOTO path2a IF ch2_beginng SEND next3 GOTO path3a IF path1a SEND next GOTO path1b IF path1b SEND back GOTO path1a ... ...
for this you can use:
START "start scene name"
IF "scene name" SEND "transition condition1" OR "transition condition2" GOTO "scene name2"
START, start |
IF, if |
SEND, send |
GOTO, goto |
License
This work is under a Creative Commons Attribution 4.0 International License.
Version 1.0
- Binary
- Source code (python3)
Version 1.0.2
- Source code (Python 3) https://github.com/badanni/Logika
- fix problem with lexer and token
- graphviz for draw the FSM
Status | Released |
Category | Tool |
Platforms | Windows, Linux |
Author | BaDanNi |
Made with | Ren'Py |
Tags | finite-state-machine, Ren'Py, tool |
Code license | MIT License |
Asset license | Creative Commons Attribution v4.0 International |
Average session | A few seconds |
Inputs | Keyboard, Mouse |
Download
Click download now to get access to the following files:
Development log
- Version 1.0.2Feb 21, 2020
- Logika Version 1.0.1Jan 26, 2020
- Logika "FSM in Ren'Py"Jan 24, 2020
Comments
Log in with itch.io to leave a comment.
This looks like it could be really useful for even moderately complex RenPy VNs. Shame that use seems unclear and was work in progress a year ago. Any update?
fix lexer problem see code here https://github.com/badanni/Logika
is there a way for this to work on mac?
yes i think, use version 1.0 and install python3
later in console (sorry i dont know the name in mac) write:
If you what to use version 1.0.1, do the same and you need to change the code in FSM_logic.py
to
then install graphviz with pip
and maybe download this https://graphviz.gitlab.io/download/
for run go to the path where is the file FSM_logic.py or FSM_logic.pyw all in console and write
or
i dont know if macos admit double click in FSM_logic.pyw
Fantastic! Thank you so much for this, it'll be useful for the community.
Thank you, I hope it