Some progress

ScummVM engine progress:
1. FLC/MOV/FLZ support has been implemented including sound
2. Script parser has been rewritten from scratch (in FreeGAG source I did Bison/Flex grammar which is too complicated for ScummVM)
3. “Event” script command implementation started

(development will go much faster now, I have more free time)

ScummVM

It was decided to continue FreeGAG development under SCUMMVM. There are a lot of advantages in using ready framework, and not to reinvent a bicycle. Unfortunately I am still busy with real life things, but Winter is coming, and I hope I will have more time for this project.
Anybody who want to contact me, please send me mail, I am not monitoring this WordPress blog ;).

Script

Moved to CMake. Integrated script parsing to main project. Implemented two test script commands. Time to fill the rest.

Full commands list:

Catch, Class, Command, DriveSpeed, Event, Exception, ExFiles, FadeMask, Flags, Font, Image, Inventory, Language, Layer, List, Load, Local, Mouse, Object, Params, Path, Source, SubLocation, Template, Text, Try, Volume, Zone

Theoretically 100% implementation of this list is 100% implementation of the game.
Practically I don’t see any references to Tetris and i18n.
Stay tuned.

Script progress

A little update:

Formal grammar definition for GAG script is 99% finished.

It was found out, that scripts are somewhat dirty, with a lot of commented out code. From what I see, legacy GAG script parser was written by hand (without parser generators and lexical analyzers), and due to this, a lot of script errors were undetected. I implemented a lot of workarounds to support broken constructs, hope that’ll mimic original script parser behaviour, we’ll see.

Here’s flex definitions, if anybody interested. Full Bison and Flex sample is in SVN.

%option noyywrap
%option nounput

%{
#include "gag_script.tab.h"

extern int bison_line_num;
extern void flex_read_callback(char *, int *, int);
#define YY_INPUT(buf, result, max_size) flex_read_callback(buf, &result, max_size)
%}

%%

[ \t\r]                 { ;                               }
\/\*[^ ;\n]*            { ;                               }
\*.*\n                  { ++bison_line_num;               }
\[END\]                 { return FOOTER;                  }
[\[\]=;/\(\)]           { return yytext[0];               }
:+                      { return SEP;                     }
[a-zA-Z0-9_\.\-!#\+]+   { yylval = yytext; return STRING; }
,\ *                    { return COMA;                    }
\n                      { ++bison_line_num;               }
.                       { return UNDEFINED;               }

%%

Blog launch

FreeGAG project is an attempt to rewrite engine of old Russian quest game “GAG: The Impotent Mystery”. I was thinking about that idea around 2-3 years ago. Year ago I started reverse-engineering of Windows version of game. Later I had some delays, and in the end of 2012 I contacted Auric Vision, company which published game (http://www.auricvision.ru, seems ceased to exist, as last update on site dated by 2008), and asked whether is there an possibility to open original game sources. Fortunately for me, I got an answer, that my proposal interesting, and they need to think about this. I was waiting long enough for that simple answer (2 months), but looks like they forgot / weren’t willing, and I wasn’t contacted since. Anyway, I am happy, that they haven’t answered, because it was an additional impulse for me to continue my development.

So, here’s what I have now:

  • CDI archive extractor
  • FLC animation decoder with support of custom sound stream and special picture frame encoding (*.MOV, *.MVZ files, which aren’t standard FLC animations and were developed specifically for gag)
  • loading of game backgrounds
  • support of game audio
  • structure of all game formats is 100% known

Remaining to do:

  • script parsing
  • i18n support
  • rewrite XTETRIS (embedded minigame)
  • connect everything together

Game is script-driven, which is work-in-progress, thus I am unable to show some meaningful game as of now. Entire game engine is implemented using SDL 1.2, C++. I am developing everything in Linux, but it should work on any OS which support SDL and C++11 compilation. Code is under GPLv3. In future I am planning to consider moving game support to ScummVM.

In this blog I’ll be reporting on development progress.

 

Проект FreeGAG это попытка переписать движок популярного, в своё время, российского квеста “ГЭГ: Отвязное Приключение”. Идея вынашивалась ещё 2-3 года назад. Где то год назад, был начат реверс-инжениринг Windows-версии. Позже была некоторая задержка, и в конце 2012-го я обратился к издателям игры, компании Auric Vision (http://www.auricvision.ru, полагаю ныне мёртвая, так как последний апдейт на сайте 2008-го года) с вопросом, не смогли ли бы они открыть исходники. На это я получил ответ, что предложение интересное – надо подумать. Я ждал достаточно долго, но ответа так и не получил, видимо забыли. Тем не менее я рад такому стечению обстоятельств, так как это было своеобразным толчком возобновить работы.

Итак, вот что имеется на сегодняшний день:

  • экстрактор CDI-архива
  • декодер FLC анимаций с поддержкой аудиопотока и специально кодированных фреймов (*.MOV, *.MVZ файлы, которые нестандартны и полагаю были разработаны специально для гэга)
  • подгрузка игровых бэкграундов
  • поддержка игрового аудио
  • структура всех игровых форматов полностью известна

Что осталось сделать:

  • парсинг скрипта
  • поддержка локализации
  • переписать XTETRIS (встроенная игра)
  • связать всё воедино

Сама игра это по сути скрипт, так как работы над парсингом скрипта только начинается, то показать что-то вменяемое на данный момент не представляется возможным. Все части движка реализовано на SDL 1.2, C++. Код под GPLv3. В будущем, если всё будет хорошо, планирую включить поддержку игры в ScummVM.

В этом блоге будет описыватся процесс разработки.