View previous topic - View next topic |
Author |
Message |
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Thu Nov 17, 2005 10:33 pm Post subject: Using Tensors for Fun and Profit |
[quote] |
|
I've been studying Einstein's General Relativity theory, specifically the mathematical end of it. Although I have pretty good grasp on the conceptual end of it, I'm still working on the details. Still, I have learned much about how it works, and how it can be modeled in programming.
"GR" as it is called by physics enthusiasts, is built around the concept of "tensors". To imagine what a "tensor" is, first consider the "vector", which we in programming call a one-dimensional array. A tensor is basically a grouping of vectors (think multi-dimensional array) whose values are all the result of some kind of function. The value of every index in a "tensor" must be calculated this way.
Tensors, like arrays, have dimension. The number of dimensions in a tensor is called its "rank". So for example, a tensor who's dimensions are "<1,2,3>" (where "<" and ">" correspond to "[" and "]" in the C language) has a rank of 3, and is referred to as a rank 3 tensor. Once again, the difference between a tensor and a vector/matrix is that the vector/matrix's values can be arbitrary. A tensor's values MUST be the result of some kind of function.
General Relativity works by assigning a rank 4 tensor of four elements per rank (<4,4,4,4>) to every point in space. These elements each correspond to a possible state that that space could exist as, variously charged, warped, magnetized, or even charged AND warped AND magnetized all at once.
To idealize what this effect is, think of a tile map. Each tile on the map has its own properties: obstruction, impedence (if we want to slow the player down when they cross), rules for interaction with the player when the player attempts to cross over it, maybe even an alpha channel overlay effect. (say, a red transparency of 25% opacity) Each of these properties, in the context of the game engine, exerts a function on the game world whose magnitude and nature is dependent upon the value assigned to the property. This is what point tensors do: depending on the value of the tensor's elements, corresponding functions are exerted in space whose effects are proportional to the values of their corresponding elements.
There is more to tensors, but I can't claim to understand it all now. More to come as I learn of it.
|
|
Back to top |
|
|
Bjorn Demon Hunter
Joined: 29 May 2002 Posts: 1425 Location: Germany
|
Posted: Fri Nov 18, 2005 12:32 am Post subject: |
[quote] |
|
So how exactly is it useful to think of a tile map in terms of a tensor? Or are you just using a tile map as an example to explain what a tensor is? There's a lot to be read about tensors on for example Wikipedia, and I'm sure it's very interesting to some people, but I just fail to see its relevance in designing and programming of independent RPGs.
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Fri Nov 18, 2005 12:51 am Post subject: |
[quote] |
|
Yes, I neglected to link to Wikipedia at the appropriate points. Thank you for that note Bjorn. :)
The relationship of tensors to RPGs, is the very notion that by attributing functions to points, a world may be built completely of its own justification. This was the greatness of Einstein's contribution. He used tensors, through GR, to emphasize that upon the simple premise of attributing functions to points, an entire cosmos may be constructed that is incontrovertibly true in itself. The entire world modeled in an equation: this is what he is famous for.
The legacy of tensors to RPGs, and to virtual worlds in general, is that through simple mechanics, fantastic effects may be generated not only visually, but physically. Using tensors, it is possible to generate a world where black holes and white holes exist, wormholes and even transdimensional portals. This concept is unheard of even in the highest ranks of professional gaming; much simpler, Newtonian-based modeling is used instead. Final Fantasy VII, for example, has fantastic effects, but all of them are merely scripted arrangements of imagined images and movements.
What I'm saying is, tensors as a method of controlling phenoma are simple to apply, and limited only by the imagination and CPU speed in what they can acheive. They are the next great frontier for RPGs and games in general. This point alone was the tenant of my post; however, as my mind continues to examine the possibilities, new horizons are taking shape that may make it easier to connect events in RPGs to each other. For example, using a tensor, the same data that controls the degree to which a marsh tile causes poison may also determine the degree to which the marsh is overlayed with green.
What do you think?
|
|
Back to top |
|
|
LeoDraco Demon Hunter
Joined: 24 Jun 2003 Posts: 584 Location: Riverside, South Cali
|
Posted: Fri Nov 18, 2005 2:00 am Post subject: |
[quote] |
|
LordGalbalan wrote: | The relationship of tensors to RPGs, is the very notion that by attributing functions to points, a world may be built completely of its own justification. This was the greatness of Einstein's contribution. He used tensors, through GR, to emphasize that upon the simple premise of attributing functions to points, an entire cosmos may be constructed that is incontrovertibly true in itself. The entire world modeled in an equation: this is what he is famous for. |
Beyond the first sentence (and, even then, not really), that really doesn't explain much.
Quote: | The legacy of tensors to RPGs, ... think? |
So, rather than have pre-made, static content, you are, essentially, advocating PCG, which is nothing new. (Perhaps it is to those that still think QB is a fantastic language? Hmm...)
Also, on your last point about the marsh thing, that can pretty simply be done sans your tensor construct. _________________ "...LeoDraco is a pompus git..." -- Mandrake
|
|
Back to top |
|
|
bay Wandering Minstrel
Joined: 17 Mar 2004 Posts: 138 Location: new jersey, usa
|
Posted: Fri Nov 18, 2005 3:30 am Post subject: |
[quote] |
|
i think it's better to say that tensors, like other methods, can be used to create a dynamic game world. it's not to say that tensors may be "better", as that is just an opinion. however, once written into a game engine, tensors could become a very useful tool.
i encourage the usage of new and/or forgotten techniques and/or the applications of knowledge in one domain into the other. with that said, i hope to see (in code) an application of tensors for RPG map generation from LG.
.02$ _________________ INTJ
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Fri Nov 18, 2005 9:43 pm Post subject: |
[quote] |
|
LeoDraco wrote: | LordGalbalan wrote: | The relationship of tensors to RPGs, is the very notion that by attributing functions to points, a world may be built completely of its own justification. This was the greatness of Einstein's contribution. He used tensors, through GR, to emphasize that upon the simple premise of attributing functions to points, an entire cosmos may be constructed that is incontrovertibly true in itself. The entire world modeled in an equation: this is what he is famous for. |
Beyond the first sentence (and, even then, not really), that really doesn't explain much.
Quote: | The legacy of tensors to RPGs, ... think? |
So, rather than have pre-made, static content, you are, essentially, advocating PCG, which is nothing new. (Perhaps it is to those that still think QB is a fantastic language? Hmm...)
Also, on your last point about the marsh thing, that can pretty simply be done sans your tensor construct. |
I never said it was anything new, I just said it wasn't used. Plus, I'm very confident there isn't a professionally made game out there that claims to build universes in their own right. Can you provide an example, LeoDraco?
|
|
Back to top |
|
|
LeoDraco Demon Hunter
Joined: 24 Jun 2003 Posts: 584 Location: Riverside, South Cali
|
Posted: Sat Nov 19, 2005 7:41 am Post subject: |
[quote] |
|
LordGalbalan wrote: | I never said it was anything new, I just said it wasn't used. Plus, I'm very confident there isn't a professionally made game out there that claims to build universes in their own right. Can you provide an example, LeoDraco? |
I'm not sure you can call it professional, but there is always .kkrieger, which is all procedurally generated. On the other hand, there is the professional game Spore, which is also procedurally based.
Now, if, by "universes", you are referring to a more cosmic scale, I can point out MoO3, which, while not procedurally generated at all, does produce the galaxy within which a game plays out procedurally. I'm also working on a project (which is not "professional", in the sense that it is a hobby project, not something I intend to sell) that will contain galaxies/ships/effects that are procedurally generated.
Now, if you are referring to actually replicating our universe down to the smallest sub-atomic particle, I don't think that would be physically possible. (I've heard the argument made that you would need at least an atom to represent an atom, which would, in turn, require a universe to represent a universe.) _________________ "...LeoDraco is a pompus git..." -- Mandrake
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Sat Nov 19, 2005 7:53 pm Post subject: |
[quote] |
|
I think we're having a misunderstanding over what I was meaning by "tensor-based". I didn't mean procedurally generated; what I meant was, making some events dependent on others through physical means, as opposed to script. I didn't mean to imply random generation of data as a function of tensors, although it certainly is.
What came to me last night, was the idea of representing say, a magic field by permeating the map with the property. This would imply that position is as important in the casting of magic as the caster's own skill, adding a dimension to the gameplay.
|
|
Back to top |
|
|
LeoDraco Demon Hunter
Joined: 24 Jun 2003 Posts: 584 Location: Riverside, South Cali
|
Posted: Sun Nov 20, 2005 7:41 am Post subject: |
[quote] |
|
LordGalbalan wrote: | I think we're having a misunderstanding |
I find that difficult to believe, given your tendency for asinine, over-worded posts.
Quote: | over what I was meaning by "tensor-based". I didn't mean procedurally generated; what I meant was, making some events dependent on others through physical means, as opposed to script. I didn't mean to imply random generation of data as a function of tensors, although it certainly is. |
Right. But, as far as I could tell from your original argument (which was poorly worded), you were essentially advocating creating a multi-dimensional array of function pointers. Whether the functions that are bound to each index do anything with noise is moot.
Quote: | What came to me last night, was the idea of representing say, a magic field by permeating the map with the property. This would imply that position is as important in the casting of magic as the caster's own skill, adding a dimension to the gameplay. |
That's been discussed around here before. I'm far to lazy to look for the exact thread, but it has been mentioned. _________________ "...LeoDraco is a pompus git..." -- Mandrake
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Sun Nov 20, 2005 9:07 pm Post subject: |
[quote] |
|
LeoDraco wrote: | LordGalbalan wrote: | I think we're having a misunderstanding |
I find that difficult to believe, given your tendency for asinine, over-worded posts. |
Strange... I could say the same for your own.
[quote]
Quote: | over what I was meaning by "tensor-based". I didn't mean procedurally generated; what I meant was, making some events dependent on others through physical means, as opposed to script. I didn't mean to imply random generation of data as a function of tensors, although it certainly is. |
Quote: |
Right. But, as far as I could tell from your original argument (which was poorly worded), you were essentially advocating creating a multi-dimensional array of function pointers. |
What do function pointers have to do with tensors!?!?!? Having the discipline to not assign values to an array index with anything but the result of a single function in code is enough to implement the concept of tensors.
|
|
Back to top |
|
|
LeoDraco Demon Hunter
Joined: 24 Jun 2003 Posts: 584 Location: Riverside, South Cali
|
Posted: Mon Nov 21, 2005 7:08 am Post subject: |
[quote] |
|
LordGalbalan wrote: | What do function pointers have to do with tensors!?!?!? Having the discipline to not assign values to an array index with anything but the result of a single function in code is enough to implement the concept of tensors. |
Which just goes to show that you have absolutely no idea what a function pointer is. Do some research. You wouldn't even have a static set of values for a given point in space, as each execution of the function located at a particular index of the point could potentially yield a different, distinct value. Much more useful than your silly tensor construct. _________________ "...LeoDraco is a pompus git..." -- Mandrake
|
|
Back to top |
|
|
bay Wandering Minstrel
Joined: 17 Mar 2004 Posts: 138 Location: new jersey, usa
|
Posted: Mon Nov 21, 2005 6:51 pm Post subject: |
[quote] |
|
LeoDraco wrote: | Which just goes to show that you have absolutely no idea what a function pointer is. Do some research. You wouldn't even have a static set of values for a given point in space, as each execution of the function located at a particular index of the point could potentially yield a different, distinct value. Much more useful than your silly tensor construct. |
sounds interesting to do it that way, however i dont know how useful that would be overall for say, a map implementation. not saying you're endorsing it as such however..
.02$ _________________ INTJ
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Mon Nov 21, 2005 10:50 pm Post subject: |
[quote] |
|
LeoDraco wrote: | LordGalbalan wrote: | What do function pointers have to do with tensors!?!?!? Having the discipline to not assign values to an array index with anything but the result of a single function in code is enough to implement the concept of tensors. |
Which just goes to show that you have absolutely no idea what a function pointer is. Do some research. You wouldn't even have a static set of values for a given point in space, as each execution of the function located at a particular index of the point could potentially yield a different, distinct value. Much more useful than your silly tensor construct. |
Function pointer = (*function), yes?
|
|
Back to top |
|
|
janus Mage
Joined: 29 Jun 2002 Posts: 464 Location: Issaquah, WA
|
Posted: Mon Nov 21, 2005 11:40 pm Post subject: |
[quote] |
|
LordGalbalan wrote: | LeoDraco wrote: | LordGalbalan wrote: | What do function pointers have to do with tensors!?!?!? Having the discipline to not assign values to an array index with anything but the result of a single function in code is enough to implement the concept of tensors. |
Which just goes to show that you have absolutely no idea what a function pointer is. Do some research. You wouldn't even have a static set of values for a given point in space, as each execution of the function located at a particular index of the point could potentially yield a different, distinct value. Much more useful than your silly tensor construct. |
Function pointer = (*function), yes? | A function pointer points to any executable block of data that has a particular signature.
|
|
Back to top |
|
|
LeoDraco Demon Hunter
Joined: 24 Jun 2003 Posts: 584 Location: Riverside, South Cali
|
Posted: Tue Nov 22, 2005 7:34 am Post subject: |
[quote] |
|
bay wrote: | sounds interesting to do it that way, however i dont know how useful that would be overall for say, a map implementation. not saying you're endorsing it as such however..
.02$ |
Depending upon how automated the map editor was (assuming a tile-based engine), and how integrated aspects of the map engine were into the editor, it could be pretty simple to implement. I don't really think it would be a good idea (at least, not with pure function pointers, as there is very little flexibility therein).
Galbalan wrote: | Function pointer = (*function), yes? |
As a the following links will hopefully show, function pointers are pointers to, as janus said, blocks of code; in C/C++ (and a few other languages; delegates in VB.NET, for instance), you are limited to a distinct subset of functions that may be pointed to with a single function pointer (as the pointer is dependant upon the exact footprint of the class of functions you want to call). FPs are generally only directly useful when you are dealing with a language that has relatively poor support for inheritence. A couple of those links detail more object-oriented approaches. (Although, that said, there is a direct analog to the function pointer in C++, the method pointer (which is discussed in the third link).)
So yes, naively, a function pointer is a pointer to a function. At some point or another, depending upon the exact syntax needed by the language you are coding in, you will have to dereference the pointer to be able to execute the function. But the idea is link an actual function --- i.e. an executable bit of code --- in an abstract way, to introduce flexibility into the system. _________________ "...LeoDraco is a pompus git..." -- Mandrake
|
|
Back to top |
|
|
|
Page 1 of 2 |
All times are GMT Goto page 1, 2 Next
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|