Example

Custom Data Editor

5

moechofe 2020-08-06 12:15 (Edited)

A couple of (months/years?) ago, I wan't to create a game that will use a lot of data like numbers and strings. So I started to create an editor for that. Then I forget about it.

Then I remember it and decide to share it with you. So, I redo this tool entirely and add the possibility to customize it.

It probably not a good idea to launch this program in the web player because It's meant to be executed as a tool.

What can this do?

It allow to store numbers and strings into a file instead of the code using the BASIC instruction DATA.

For what purpose?

Imagine... a game where you need to build buildings, those will cost money and resources. Thoses cost numbers can be stored in a file and this tool can help you to provide some sort of custom editor. Also this game can have an unlock mechanics, each building can have a rule to unlock it, like an other building already unlocked. This tool also allow you to select a value form a list of predifined values.

How does it work?

It store the numbers as binary and the strings as pascal string (limited to 255 characters). The data stored are identified by a record id and the numbers and strings are part of a field for each records. Each records as a type and this type will define a set of fields. Finally, those fields can be: number, string or a item from a list.

How to use it?

The program of this tool as a lot of explaination and a step by step procedure inside it. Just read it.

How to read thoses data in my game?

You'll have to copy/pasta ~50 lines of code to your program and gosub to a label. it's also explain in the program.

How it is implemented technically?

It use a 1st file to store all fields for all records. It use a 2nd file as a toc (table of content) to help reaching the record address in the 1st file. It was design to be fast to read.

Is it safe?

Not sure about this. Even if the process is simple enough to not fail. I cannot guaranty this version is polished enough. It lakes some checks to prevent from deleting previous record data. For instances: changing the type of the fields for data that was already stored in a file can break (maybe). I will continue to develop it.

CustomDataEditor.nx | Open in app
2020-08-06 12:15

Log in to reply.