RPG game engine reflexions

Page 4/4
1 | 2 | 3 |

By Grauw

Enlighted (7405)

Grauw's picture

17-05-2018, 17:58

For the record, I didn’t mean string references, but actual assembler symbols (pointers). Yes if you have to compare then you do need to compare two bytes, but usually you don’t want to do that, rather you want to look up the associated object, and if you have a reference you just dereference it directly.

E.g. in Tiled I can set custom string properties on tiles, so if I’d e.g. add "openDoor" to the "collision" property of a tile, then my tools can convert that to a Collision_openDoor reference in the Tile objects that it outputs, and then if I have a tile I can directly retrieve the Collision object from it.

By Metalion

Paladin (968)

Metalion's picture

17-05-2018, 21:14

Grauw wrote:

E.g. in Tiled I can set custom string properties on tiles, so if I’d e.g. add "openDoor" to the "collision" property of a tile, then my tools can convert that to a Collision_openDoor reference in the Tile objects that it outputs, and then if I have a tile I can directly retrieve the Collision object from it.

Nice, I didn't know Tiled could do that ...

By DarkSchneider

Paladin (748)

DarkSchneider's picture

18-05-2018, 09:51

Grauw wrote:

For the record, I didn’t mean string references, but actual assembler symbols (pointers). Yes if you have to compare then you do need to compare two bytes, but usually you don’t want to do that, rather you want to look up the associated object, and if you have a reference you just dereference it directly.

E.g. in Tiled I can set custom string properties on tiles, so if I’d e.g. add "openDoor" to the "collision" property of a tile, then my tools can convert that to a Collision_openDoor reference in the Tile objects that it outputs, and then if I have a tile I can directly retrieve the Collision object from it.

Ah right references (pointers). It was another option, the used initially. But is not so intuitive or good for changing them or assign in real time. As you must hardcode it in the code, any change must go in the script itself. With numbers, you can change things generating values from external, like in the own object data (generated on the editor), which can contains the numbers to change to.

By santiontanon

Hero (593)

santiontanon's picture

18-05-2018, 19:47

I also like using references, rather than having some complex system for describing the effects of different game events, I find it much easier to just have references to functions that will do the effects, for example. It makes things much simpler.

Also, I don't think references need to be hardcoded in the code. References are just the same as numbers, except 16bit ones. So, they can be set in the same way as numbers.

By DarkSchneider

Paladin (748)

DarkSchneider's picture

19-05-2018, 13:37

santiontanon wrote:

Also, I don't think references need to be hardcoded in the code. References are just the same as numbers, except 16bit ones. So, they can be set in the same way as numbers.

Not exactly, they are addresses, that in the code are symbols (names). To change a reference, you have to write the symbol name in the code.

By Grauw

Enlighted (7405)

Grauw's picture

19-05-2018, 14:38

I guess if you don’t generate assembly code in your scripts (where you can reference symbols), you could still work with a fixed-address jump table like the BIOS entries.

By DarkSchneider

Paladin (748)

DarkSchneider's picture

19-05-2018, 14:51

Ugh fixed-address not please oO

Also notice that you are already using a LUT, simply with another aspect. As you are using a LUT, you are already using numbers, but in another way.

By Grauw

Enlighted (7405)

Grauw's picture

19-05-2018, 15:06

True...

Page 4/4
1 | 2 | 3 |
My MSX profile