🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Stargate-like Background... How?

Started by
5 comments, last by Ajay47 4 years, 4 months ago

So, I'm trying to build a game like Stargate, using Godot:

https://www.youtube.com/watch?v=N4BW5GcRW44

The screen and map repeat themselves. So, for instance, if I move far enough in one direction or the other I will eventually arrive back where I started--from the opposite direction. I'm using a parallax background currently, which gives this illusion through mirroring. And, the background does repeat like I want, but the other objects (like enemy units and such) never reappear unless I reverse back to them the way I came.

I've seen plenty of tutorial on how to wrap your player sprite or other objects from one side of the screen to the other, but this is not the same and i can't find an example for it.

I'm hoping there's a simple explanation or a tutorial, etc… that can show me how to make this work.

None

Advertisement

The trick with games is that it's all smoke and mirrors just like magic tricks. You can use any trick you like, as long as the illusion stays intact. So if the standard solution fails, think outside the box, how can you make it look like that to the player without actually doing it?

A few suggestions:

One way is to split everything in N horizontal sections (numbered from 0 to N-1). Everything in the game is not at an absolute position, everything is in one of the sections, at some offset from the left. When you cross the left or right edge of a section, you go to the previous or next section, possibly wrapping if you go outside 0..N-1 .

You display one or more sections at the same time to the screen. If you display eg section 3 and section 7 next to each other, the likely doesn't make much sense, but if you display eg section 0 and section N-1 next to each other, that should work, since everything is in one of the sections.

Another solution is to have sections like above, but wide enough to fill the entire screen (or longer). You can have absolute coordinates in the world. You duplicate the first section at the end, ie the first and the last sections are the same. When you are in the first or (duplicate) last section and you're close to the edge of the world (ie left in the first or right in the last section), transpose everything to the duplicate section at the other end between two frames. As the sections are duplicate, the user will not see it.

As you see, I am cheating in both options (and there are likely many more), but smoke and mirrors, eh?

Other games uses this too, Starbound for example. In Starbound you can surround the whole planet and reach the beginning where you started from if you run far enougth left or right. It is like already mentioned, just a thing of scene management.

I think the old games have had one benefit over modern hardware, they were limited in memory, so if you travel long enougth into one direction, it is very likely that you encounter a pointer address swap that teleports you back to the beginning of the memory section where your initial scene lives

@Alberth Thank you. I'm still a beginner with this app, but I'll try to implement this. It makes sense.

None

Thanks.

None

@Shaarigan Thanks.

None

This topic is closed to new replies.

Advertisement