Free Hero Mesh

Check-in [a4f844ac56]
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.
Overview
Comment:A change in file format, and notes about a hybrid approach
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a4f844ac5676bbc37c61d0da6c7c0f78a61c9191
User & Date: user on 2018-03-08 05:50:08
Other Links: manifest | tags
Context
2018-03-09
01:33
Add key names to names.js and names.h check-in: ceadd9ba47 user: user tags: trunk
2018-03-08
05:50
A change in file format, and notes about a hybrid approach check-in: a4f844ac56 user: user tags: trunk
2018-03-05
09:32
Initial commit with files included. check-in: b152314d28 user: user tags: trunk
Changes

Modified mbtofhm.c from [2264eccb2d] to [fc5168bbe3].

451
452
453
454
455
456
457
458


459
460
461
462
463
464
465
  i=fgetc(stdin);
  i|=fgetc(stdin)<<8;
  levelid[ord]=i;
  sprintf(nam,"%d.LVL",i);
  hamarc_begin(fp);
  fputc(0,fp); fputc(0,fp); // Level version
  fputc(ord,fp); fputc(ord>>8,fp); // Level code
  fputc(29,fp); fputc(21,fp); // Width/height


  i=fgetc(stdin);
  i|=fgetc(stdin)<<8;
  // fputc(17,fp); // Select proportional font
  while(i--) {
    switch(j=fgetc(stdin)) {
      case 14:
        i-=4;







|
>
>







451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
  i=fgetc(stdin);
  i|=fgetc(stdin)<<8;
  levelid[ord]=i;
  sprintf(nam,"%d.LVL",i);
  hamarc_begin(fp);
  fputc(0,fp); fputc(0,fp); // Level version
  fputc(ord,fp); fputc(ord>>8,fp); // Level code
  fputc(28,fp); fputc(20,fp); // One less than width/height
  // (Width/height can each be up to 64 (stored as 63). Bit6 and bit7 of
  //  these numbers are extra header flags, currently unused.)
  i=fgetc(stdin);
  i|=fgetc(stdin)<<8;
  // fputc(17,fp); // Select proportional font
  while(i--) {
    switch(j=fgetc(stdin)) {
      case 14:
        i-=4;

Modified notes from [477e17bf7e] to [4f8ea813c9].

16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
31
32
33
















34
Advantages of using Hamster archive:
* It is a simple file format.
* You can use the "har" program to extract and alter lumps.
* There will be less bugs because it is simpler than SQLite.

Disadvantages of using Hamster archive:
* It is necessary to rewrite the entire file when it changes.


Advantages of using SQLite:
* You can read parts of the file at a time.
* You can alter records without having to rewrite everything.
* SQL can now be used for user queries and user scripts.
* You can use sqlite3 command shell to deal with the file.

Disadvantages of using SQLite:
* There will be extra overhead due to b-trees and other stuff.
* It may be necessary to deal with untrusted database schemas (unsure).
* Now SQLite must be included in this program.
























>











>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Advantages of using Hamster archive:
* It is a simple file format.
* You can use the "har" program to extract and alter lumps.
* There will be less bugs because it is simpler than SQLite.

Disadvantages of using Hamster archive:
* It is necessary to rewrite the entire file when it changes.
* It is necessary to read the entire file to find the lumps.

Advantages of using SQLite:
* You can read parts of the file at a time.
* You can alter records without having to rewrite everything.
* SQL can now be used for user queries and user scripts.
* You can use sqlite3 command shell to deal with the file.

Disadvantages of using SQLite:
* There will be extra overhead due to b-trees and other stuff.
* It may be necessary to deal with untrusted database schemas (unsure).
* Now SQLite must be included in this program.

Another way would be a hybrid approach. Another file containing the user
session data is a SQLite database, which is recreated if it was deleted or
if the level or solution file is newer than it, and stores an index.

Advantages of hybrid:
* It is only necessary to create an index once.
* SQL can now be used for user queries and user scripts.
* User session data can be recorded.

Disadvantages of hybrid:
* SQLite must be included in this program.
* Level/solution files must still be rewritten entirely when it changes.

Hero Mesh will rewrite the puzzle set file only on exit, so it is possible
to do the similar thing in this case, by using the session database.