playMaker

Author Topic: How to create a 3d matrix  (Read 1308 times)

ElProfessor595

  • Playmaker Newbie
  • *
  • Posts: 19
How to create a 3d matrix
« on: April 07, 2019, 11:20:52 AM »
Hello, I want create a 3d matrix in a scene, for a level editor (like a Mario Maker in 3d),but I don't know how to do it. Someone can help me please ?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to create a 3d matrix
« Reply #1 on: April 08, 2019, 02:32:22 AM »
Hi,

unfortunatly, PlayMaker can not run during editing, it can only run when the scene is playing, so you'll have to resort to regular scripting to build your level editor.

 PlayMaker will be able to parse your data to create the world at runtime, but it won't be able to give you editor time features.

if your level editor is inside your game, then it's a different thing and for this, you have several options.

One of which would be xml ( and datamaker from the ecosystem), to record every block, with their positions and properties.

the other would be a plain text format where each line is a block, if your block properties are simple, why not, but it will have shortcomings very quickly.

 the other is using a database of sqlite or something, but this already will likely require regular scripting

Bye,

 Jean




ElProfessor595

  • Playmaker Newbie
  • *
  • Posts: 19
Re: How to create a 3d matrix
« Reply #2 on: April 09, 2019, 07:40:26 AM »
(Hi, unfortunatly, PlayMaker can not run during editing, it can only run when the scene is playing, so you'll have to resort to regular scripting to build your level editor.)

Thanks Jean for yours answers, I will look the solutions the solutions you gave me.
But first, I must specify : I just want know how to create a 3d matrix and how, possibly, interact with it.

Thanks





jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to create a 3d matrix
« Reply #3 on: April 11, 2019, 02:43:51 AM »
Hi,

a 3d matrix is a like a 3d grid, where you reference a value using 3 indexes.

depending on how you want to read and write and search in this grid, you might get away with a simple ArrayMaker Hashtable with the key being formatted like this

"x y z" if you follow this format, you can easily read the value for a given grid cell, for example "1 4 5" would return the value at x=1 y = 4 z = 5

and when you create a new item, you construct the key accordingly.

 now this could be a lot trickier if you want some advanced search within your grid, like, so before you decide if you need to go for a more complex system, you need to define your needs properly as to ho wyou want to access your matrix.

 one big leap towards this would be to define your matrix using xml. you have then many ways to define your data, and you benefit from the very powerful and all mighty xpath search system which can get you anything from your xml data.


here's two example of how your matrix could be define

Code: [Select]
<root>
<Matrix>
<cell x="0" y="0" z="0">value of cell 0,0,0</cell>
</Matrix>
<Matrix>
<x index="0">
<y index="0">
<z index="0">Value for cell 0,0,0</z>
<z index="1">Value for cell 0,0,1</z>
<z index="2">Value for cell 0,0,2</z>
</y>
<y index="1">
<z index="0">Value for cell 0,1,0</z>
<z index="1">Value for cell 0,1,1</z>
<z index="2">Value for cell 0,1,2</z>
</y>
<y index="2">
<z index="0">Value for cell 0,2,0</z>
<z index="1">Value for cell 0,2,1</z>
<z index="2">Value for cell 0,2,2</z>
</y>
</x>
</Matrix>
</root>


 To work with xml and playmaker, DataMaker is the way to go and it's available on the ecosystem.

Bye,

 Jean


ElProfessor595

  • Playmaker Newbie
  • *
  • Posts: 19
Re: How to create a 3d matrix
« Reply #4 on: April 11, 2019, 02:09:18 PM »
Hi jean, thank you, now I understand what is a matrix. Can you tell my where found
XML and DataMaker please ?

Bye and thanks.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to create a 3d matrix
« Reply #5 on: April 12, 2019, 02:03:45 AM »
Hi,

 It's on the ecosystem and wiki: https://hutonggames.fogbugz.com/default.asp?W1133

Bye,

 Jean