It all started five months ago when I was asked to make an IF game.
IF games are games in which the interaction with the player takes place using textual information. There are 2 options for interaction: entering text or choosing from the options already proposed.
The Dictator game was chosen as an example . it was similar to what was planned to be implemented. Dictator is a political simulation computer game developed by Don Priestley and released for the ZX Spectrum computer, and was later ported to different platforms.
The main character, the ruler of a banana country, is trying to hold on to power with all his might. The gameplay is pretty simple. The dictator, that is, the player, must choose one of the proposed options for action. The task is to hold out as head of state as long as possible.
For the development of the game, I chose Twine. On the Internet, you can find similar tools, but after poking around a couple of options, I decided to stop at Twine , because he liked the interface more and was free.
A little about implementation
The game is called Political games. At the beginning of each month, one of the political factions asks a question, and the player must choose an action that, possibly, will improve the situation. For example, to sell land, or buy a helicopter, so that in case of failure, you can get out of this godforsaken place.
Creating a game comes down to writing html in paragraphs: each paragraph is a separate page that can be further styled. As a developer, I can choose which paragraph the story begins with. I added 2 paragraphs: one for the variables that will be responsible for the points and the month counter, and the second for the list of questions. And then I used the display of these two paragraphs in the initial one. Transitions between paragraphs are carried out using links. The next paragraphs implement the markup of how the page will look.
As a result, we got something like this tree:
The paragraph marked with a green icon is the initial one. The number of paragraphs could have been reduced, but I never managed to do it.
About Twine
Twine is an open platform for writing interactive literature, text games and visual novels. Allows you to publish games in the form of html pages and does not require deep knowledge of programming from the author.
You can work with it both in the online version and download the software to your computer.
The big advantage of the online version is that after changing and clicking on the "Play" button, the already open history tab will reload. In the desktop, after several dozen changes and the launch of history, 100,500 tabs appear.
Twine has several engines, or as Twine calls it, game formats.
Each game format has differences in terms of syntax as well as differences in terms of functionality. There is a dock for each of them, and you can also find the source code on github. SugarCube 2 seemed to be the most optimal for me. It has both convenient syntax and good debug.
The project can be both exported and imported. But, if you suddenly want to change the file in the editor, and then import it back, these changes will not be saved, because Twine will rebuild the file when the game starts, and everything added will simply be removed. This creates a slight inconvenience in cases where you need to add meta information, favicon or third-party css and js files. In this case, you have to add them via JavaScript. The action is simple, but it would be better to simply add the tag to the head section.
Another problem in Twine is the lack of autocomplete, so all markup, property names must be written by hand. And this at a time when it is present in all code editors!
Outcome
Twine works well for small projects or prototypes. You can quickly file down an IF toy. Personally, this tool was enough for me, with the exception of some disadvantages.
Disadvantages of the technology:
- There are problems with the desktop version
- No autocomplete
- It is not convenient to work with the head section, you have to do it through js
- There is no live-reloading, so during development you have to constantly restart the game by clicking on the "Play" button
Pros:
- Free tool
- Clear and simple
- There are enough opportunities to do something interesting
If someone wants to try himself in the role of a dictator, to pull the country out of poverty to unprecedented heights, or, conversely, to plunge it into the abyss of a civil war, then you are welcome . I would be glad to receive constructive criticism.
UPD
Snuux in the comments threw off examples of Twine compilers with live reload.