How to make an infinitely big level?
Ctrl 5
Member Posts: 18
I'm trying to make a space game that is viewed from the top, and I want the ability to fly infinitely in any direction, and I don't want to use wrap either. Is this possible? If so, then how?
Thank you.
Comments
Space ship stays in the middle of the screen (or in an area) centred in the screen . . . and you spawn objects off screen and move them in.
I thought about that, but it wouldn't give the complete effect of moving since the space ship can move freely not just in one direction.
Make a very large scene of stars....depending in direction...make scene(background) move at a speed of about 3-5 in relation to ship. I have even made a background once of 5000x 5000 Give a good effect of moving in a large starfield
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
Oh ye of little faith It'd work fine, honest ! There is nothing in my post that mentions 'just in one direction', you've added that caveat yourself.
Let me make you a basic demo of what I mean . . . .
Here's the basic idea, just spawn your environment off screen as you move around - so you can go in any direction for as long as you like and you never get to an edge !! There's probably lots of different ways of doing this, this particular way might not work for what you have in mind, but the basic concept is adaptable.
Left and Right arrows are for steering, Space Bar is for firing.
Link: https://www.mediafire.com/?5k66vp0m3cicopm
Socks, thanks for taking the time to make this great example! I learned a lot from it - very simple but effective.
Cheers Chucky.
Thank you for that example, but i don't understand how this was pulled off. like, how are the stars spawning and moving in the same direction?
They simply move in the opposite direction to where the spaceship is pointed.
And they aren't stars, they are 'space crap', you can't shoot stars, but you can shoot space crap.
XD I love the name. Thanks for the help, but there is one last thing. There will be the main ship, the stars, and the enemy ships. The enemy ships will be moving also. How do I do that and still make it seem like an infinite space?
I don't understand the question.
Ok. In the example you gave me, the effect is that the stars are stationary while the ship is able to move. How would I be able to pull off the same effect but with enemy ships that can also move anywhere?
The question kinda' invites arbitrary answers (maybe I still don't quite understand it), can you say what literally happens on the screen, what this enemy actually does, saying it can move anywhere is (to me at least) analogous to wanting to do anything (as in "hi guys I have an enemy spaceship, I want it to do anything it wants, how would I set that up?") You'd need to be more specific.
Ok. The main ship can move, turn, and shoot exactly like the example you gave. The stars in the background won't move but they will probably rotate at different speeds just for the effect. The enemy ships will be able to move, shoot, and turn. But how do I make all of this possible and still make it seem like and endless amount of space? The example you gave only has the main ship and the stars, or space crap.
Mr, i think you need to think of it on another level.
Your creating an illusion. The ship NEVER moves. it says in the middle, You make everything else spawn and move around it to make it look like the ship is moving.
A big part of making games is creating illusions that 1 thing is happening, but really its something else that has created that effect.
To create such an illusion, you usually have the "movement" of your ship instead impart motion on everything else in the scene equally.
Sorry if I sound like I am being wilfully awkward or unhelpful, I'm not, honest !! But I'm still a little lost, maybe I am being stupid but I'm not thinking of it as you describe it . . I am looking at this as a GameSalad project being made by a developer rather than from the audience's perspective, it's just easier on my brain ! To me the main ship is static, it does not move, it's in the centre of the screen, always, and the space crap does move, always in the opposite direction to the way the main ship is pointed . . they're the basics, if we want to work out how to have an enemy interact and work that out in the language of how the illusion is perceived (rather than how it is) things get confusing quickly (for me at least) !
There is an actor in the middle of the scene - and there are some other actors randomly spawned around the place that slowly move in the opposite direction to where the main actor is pointed . . . . in this context (and in this language) what do you want this other actor to do ?
Sorry if I am being dumb !
Yep ! This !
I don't think you guys understand my question. I know that the ship stays in the middle the whole time while everything moves around the ship. I know that what I have to do is make everything move in the opposite direction that the ship is facing. But that only works if the illusion is to make the ship look like it's moving in an infinite amount of space whilst everything else stays still. But how do I do the same thing but pull off the illusion that the main ship is moving, the stars aren't moving, and the enemy ships are moving relative to the stars.
I'm sorry If this still doesn't make sense. I'm trying to make it as simple as possible for you guys to understand. It's a bit hard to do through text.
+1,000,000
I think explaining this as it actually is . . . i.e. a static actor that rotates + some other actors that move in the opposite direction to where the static actor is pointed . . . rather than explaining it via the illusion it gives, would make it a little easier (maybe it's just my preference).
If you could describe what you want in this context it would be a little clearer (for me at least) - i.e. I want this new actor to appear at the top of the screen and move towards the actor in the middle - or I want this new actor to always appear in front of the actor in the middle - in the direction the actor in the middle is pointed . . . . . that kind of thing, hope that makes sense.
Ideas like 'I want this new actor to be able to move anywhere' doesn't mean much to me, I need to know where it is going to move !
Ok. I want there to be a main actor, stars, and enemy ships. I want the main actor to be able to move, rotate, and shoot. I want the stars to just rotate slowly but not move anywhere. I want the enemy ships to spawn outside of the screen and move around untill it is visible on the screen. Once the enemy ship is visible I want it to move twards the main actor and shoot at it. But I also want there to be an infinite ammount of space
I think explaining this as it actually is . . . i.e. a static actor that rotates + some other actors that move in the opposite direction to where the static actor is pointed . . . rather than explaining it via the illusion it gives, would make it a little easier (maybe it's just my preference).
. . . or of course you can stick to the idea that the space ship moves . . .
The main actor does not move.
The stars move, this is what creates the illusion of movement for the main actor.
Why would you want them to move about around off screen and out of sight of the game player ?
Then move it towards the main actor using whichever behaviour you want, interpolate, move, move to, accelerate, change velocity etc etc . . . . and factor in the movement of the stars.
This effect is achieved by spawning objects and moving them in the opposite direction to where the spaceship is pointed, I think we've been over this a few times now
Anyhow, I don't think I am being much help here, I feel like I am trying to force you into seeing this method in one way (as it is, with a static main actor) and you refuse and keep discussing it how you see it (the main actor moving), which makes it a little difficult for me to squeeze actual, literal details of the behaviour of enemy ship out of you in the context I'd prefer, so I'll let someone else take over, good luck, hope you sort it out !
I think this thread might be enclosed in a loop behavior. Get out if you can!
You can still rotate, shoot, and give the illusion of moving with whats been laid out here.
Spawning off screen and moving on screen is still possible with whats laid out here.
Attacking the main character when certain conditions are met that give the illusion of the ship being within a range or an "Aggro" is very possible with what's been laid out here.
I can think of multiple ways of achieving this. @Socks has provided a very elegant solution for the core systems and that can easily be modified to include enemies that shoot and move and/or form off screen at random or under some sort of control as well.
For example, the "stars" could be modified to be ships that spawn. With a static Main Ship, you can easily make things move towards it, such as enemy ships. Literally as simple as a "Move to" and input the main actors x and y, no variables needed. Same with the bullets to attack the main ship. Hell you could even create complex movement patterns given the ships static position and not have much trouble.
You could further break this down and start creating conditionals. Such as a non-stop interval counter that would equate to distance traveled, and at certain amounts of distances harder enemies spawn. Or even create an equation to automatically get harder, or spawn more often.
for some alternatives;
You could make the main ship actually move, but that would be quite a hassle for an infinite game unless it was scene wrapped (meaning you go up top and end up on bottom, etc). You could also create a very large scene and create boundaries, or a collider that causes you to spawn elsewhere in the scene randomly on collision and with enough randomness to enemies and stars it would appear infinite. You could take socks idea and execute it without a spawn and using a static star BG or one that moves slowly and wraps/changes pos. You could probably use tables to give you great orchestrational control over many elements on a static scene as well. The list goes on and on.
The point is it's all in your imagination. There isn't a right way to do things (but this thread contains a very good way to do things )
I have to say that I've found this very useful even if no-one else has!
Had something similar as a bonus stage in my game, but the way this is done is much simpler (e.g. no wrap X/Y to worry about).
Thanks @socks
QS =D
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
>
Cheers QS, al you need to do is add a few pipes and a flapping bird (and maybe lose the space ship, and stars) and you've got the basics of a good game.
You could try making a relative set of coordinates... Your ship stays in one place, but when it is moved in a direction, you change the relative coordinates, and everything else is constrained to them.
That way, everything can have it's own movement while taking into account your ship's movement.
constrain the ship's fake position to a global, then save the enemy spawn relative start coords.
if your ships fake Ypos is 40,000 and the enemy spawns at 40,100, you can constrain the enemy pos to
(shipRelYPos-enemyStartYpos)+(however you want the enemy to move)
this will have it anchored to y = 100, and will change depending on how you move your ship and how they move theirs.
Some nice ideas ! I took the same file as the space ship one I posted the other day - and the same basic idea (static 'hero' and moving BG) and tried what you said: "execute it without a spawn and using a static star BG or one that moves slowly and wraps/changes pos" . . . I think that could work too . . . here's a very rough demo, of course you wouldn't want the BG simply repeating like in the video, but as a concept it works . . .
The sound is all out of sync and the GS capture is pretty choppy (usual crappy screen capture issues) - but it runs super smooth (and the bomb FXs sync with the impacts) in real life.
Thanks so much socks
No problem, one additional benefit I thought of that this method (static rotating actor) gives you is that you can set up a fairly complex collision shape by stacking rectangular and circular actors together - as all you have to do is to rotate them together as one unit (either with a bit of simple trigonometry or a standard rotation).