# [Technical test] Applied Theory of Relativity

Show us your works in progress and request feedback

### » Wed Apr 16, 2014 5:13 am

Hi. So this is something I've been thinking about for a while, and that is, how do you create an actual functioning relative game world?

Well, I sat down today and made it, and was surprised when it didn't take very long at all.
Relativity.jpg

AToR.capx

What it does and why
It basically finds a "center" of the universe. It means that the actual origin which in most games is at (0, 0) is not constant, but determined by the location of every other object, the average. In this way no-one can really say they are at the center of the universe, because the center is not literal, it's just where everything else seems to be.
And as for the reason, this demonstrates that there can in fact, logically, be a center of the universe. Trouble is we would need to first explore the entire universe and find the density of everything just to find it.

The processes
This is such a simple idea I'd be surprised if no-one had tried it before.
It's basically 3 steps.
1. For each object, add the object's coordinates to a global variable.
2. Divide this global variable by the amount of objects to find the average position.
3. Take away this average from the current positions of every object, and add a constant offset value to keep it centered rather than in the top left corner at (0,0).

And that is all there is to it.
You do not have the required permissions to view the files attached to this post.

Take a look at my itch.io games
B
45
S
14
G
3
Posts: 167
Reputation: 5,204

### » Thu Apr 17, 2014 8:34 am

Interesting, but what would be the practical application?
My first game, Swingy Angie, available now on

Let us honor the desire to work, for it is a movable holiday occuring up to three times a year.
B
85
S
23
G
11
Posts: 51
Reputation: 9,707

### » Thu Apr 17, 2014 9:32 am

Pretty much not a whole lot, though it could be useful in making a game set in space that had a lot of moving objects over a long period of time, in order for the actual objects to not move too far away from the origin point or more accurately to move the origin point to wherever. The actual xorigin and yorigin coordinates could be useful in calculation for spawns and such, e.g. distance away from the center (which would have the highest density of objects) determines the chance to spawn something, such as a black hole.
It works with scroll too I believe, but I'll have to try that one out. Right now it's practically useless though, since there's no real need for it in anything I'm thinking of working on.
This is mainly just a proof of concept for some metaphysics. Well if ever I create a space RPG it'll be useful though! =P

Take a look at my itch.io games
B
45
S
14
G
3
Posts: 167
Reputation: 5,204

### » Thu Apr 17, 2014 2:04 pm

That's how boids usually start.
Btw if you set it to unbound scrolling then 0,0 really would be the center of an infinite universe, if you don't mind a few rounding errors of course.
B
178
S
50
G
206
Posts: 8,686
Reputation: 127,715

### » Thu Apr 17, 2014 7:57 pm

I can take the smell of a gameplay mechanic of something really unique and cool but just can't pinpoint it...
B
18
S
4
G
1
Posts: 332
Reputation: 3,149

### » Fri Apr 18, 2014 1:51 am

@Windwalker
Well, a massive scale - no, infinite - universe destroyer god game might be interesting!

Hmm. Not a bad idea actually, might be my next project.

@newt
I suppose it would be pretty easy to make this into a boid. All you would have to do is apply some varying forces instead of setting position.

Take a look at my itch.io games
B
45
S
14
G
3
Posts: 167
Reputation: 5,204