Skip to main content
GameDev.net gamedev.net
🔒 Locked

Parkour Game

Started by Kingston Creations Jun 8, 2016 at 10:38 PM 18 replies 7.4k views
Original Post
Kingston Creations
Kingston Creations

Hello, I have been thinking about making a game where you jump from building to building exploring massive user made worlds. (With a bit of my own) Now the game will essentially be anything you want it to be. A goal to save someone in a tower far away or to have a race with your friends. I am having some issues. I am in need of a few tutorials on the following things.

  • Super Jump Pads (Basically a pad that launches you in the air.)
  • Some sort of support for scenes to be added by other users (A way for you to launch downloaded scenes)

Now that is the small list of things I need help with. By now you have probably logically decided I am a beginner, you are right. I am in need of any support and or help I can get. If it is a link you have to a video that I requested or you can make your own video on the subject. Anyways if you respond I want to thank you so much.

Tools I Have To Use

-------------------------------------

Properly licensed Adobe Creative Cloud

Very Basic Coding Knowledge

Drawing Tablet

All You Guys

And A Bit Of Enthusiasm

Kingston Creations
Kingston Creations

Okay, I recently found a tutorial on this. It is meant for an FPS but it will work for me.

I was thinking on making it transform the X a tiny bit as well.

Kingston Creations
Kingston Creations

a4pHN0T.png

My latest update on the games progress is here now. I made a small tile texture. Let me know if there is anything I should add to it.

(c) Kingston Creations 2016

Lactose
Lactose

Just as a note: posting updates on projects isn't really what this forum is for. This forum is intended for (technical) questions.

That said, there is also a blog-type of section on gamedev.net, which might be of interest to you, called Journals.

Good luck with your project :)

Hello to all my stalkers.
Gian-Reto
Gian-Reto

On the launch pad thingy: are you using the physics engine of your game engine of choice? If yes, your player character has a rigidbody that makes him react to ingame physics.

Besides reacting to gravity, you can also apply forces to this rigidbody (you most probably do already for making him move IF you are using physics... for a free running game I would strongly suggest you start using physics as long as the platform you build the game for has the power to run the physics engine (no problem on PC and console, don't know about mobile))

You could just have the launchpad apply a force in the upwards direction everytime you character touches the collider of the launch pad (or an additional trigger added to the launch pad). Of course, be careful that you only apply the force once, even if the character does not leave the trigger shape in a single physics frame (maybe the force you apply is not enough to catapult the character away fast enough).

If you are using / planning to use Unity:

https://docs.unity3d.com/ScriptReference/Rigidbody.AddForce.html

Introductions to physics in Unity:

https://unity3d.com/learn/tutorials/topics/physics

A very rough code example in Unity C# (code snippet, to be used in a script placed on the launch Pad in conjunction with a trigger on the launch pad, and a rigidbody on the character(s)):


private List<Collider> launchedColliders;
 
Start () {
    launchedColliders = new List<Collider>();
}
 
OnTriggerEnter (Collider character) {
    if (!launchedColliders.Contains(character)) {
        character.attachedRigidbody.AddForce(transform.up* launchForce);
        launchedColliders.Add(character);
    }
}
 
OnTriggerExit (Collider character) {
    launchedColliders.Remove(character);
}
Kingston Creations
Kingston Creations

Just as a note: posting updates on projects isn't really what this forum is for. This forum is intended for (technical) questions.

That said, there is also a blog-type of section on gamedev.net, which might be of interest to you, called Journals.

Good luck with your project :)

No, I am looking for technical help. I am just making sure that everything is compatible with everything else.

Kingston Creations
Kingston Creations

On the launch pad thingy: are you using the physics engine of your game engine of choice? If yes, your player character has a rigidbody that makes him react to ingame physics.

Besides reacting to gravity, you can also apply forces to this rigidbody (you most probably do already for making him move IF you are using physics... for a free running game I would strongly suggest you start using physics as long as the platform you build the game for has the power to run the physics engine (no problem on PC and console, don't know about mobile))

You could just have the launchpad apply a force in the upwards direction everytime you character touches the collider of the launch pad (or an additional trigger added to the launch pad). Of course, be careful that you only apply the force once, even if the character does not leave the trigger shape in a single physics frame (maybe the force you apply is not enough to catapult the character away fast enough).

If you are using / planning to use Unity:

https://docs.unity3d.com/ScriptReference/Rigidbody.AddForce.html

Introductions to physics in Unity:

https://unity3d.com/learn/tutorials/topics/physics

A very rough code example in Unity C# (code snippet, to be used in a script placed on the launch Pad in conjunction with a trigger on the launch pad, and a rigidbody on the character(s)):


private List<Collider> launchedColliders;
 
Start () {
    launchedColliders = new List<Collider>();
}
 
OnTriggerEnter (Collider character) {
    if (!launchedColliders.Contains(character)) {
        character.attachedRigidbody.AddForce(transform.up* launchForce);
        launchedColliders.Add(character);
    }
}
 
OnTriggerExit (Collider character) {
    launchedColliders.Remove(character);
}

Thank you so much for the help. As should be assumed by the prefix of the main post this is with unity. I greatly thank your help and recourses that you have provided me with.

Norman Barrows
Norman Barrows

>> Super Jump Pads (Basically a pad that launches you in the air.)

Gian-Reto's got you covered there, just add some extra y velocity to the jump.

>> Some sort of support for scenes to be added by other users (A way for you to launch downloaded scenes)

its unity, just let them load their own levels.

>> Properly licensed Adobe Creative Cloud

photoshop looks to be the only truly useful tool there. photoshop's a no-brainer. the rest you can probably live without.

Norm Barrows Rockland Software Productions "Building PC games since 1989"</
Kingston Creations
Kingston Creations

>> Super Jump Pads (Basically a pad that launches you in the air.)

Gian-Reto's got you covered there, just add some extra y velocity to the jump.

>> Some sort of support for scenes to be added by other users (A way for you to launch downloaded scenes)

its unity, just let them load their own levels.

>> Properly licensed Adobe Creative Cloud

photoshop looks to be the only truly useful tool there. photoshop's a no-brainer. the rest you can probably live without.

Thank you for the support. I agree as well. I don't understand the let them load their own scenes.

Kingston Creations
Kingston Creations

We have ran into an issue with the game. We made that script but it teleports you and does not make you fly there. We need your help now to help fix this. We are adding a download link to the game. Please realize that this game is protected under copyright. If you find the fix or a way to make it work better let me know. Also here is some info you will need.

Inside the scripts folder is the script we used.

Inside of the actual 1x1 JumpPad, it has an object called Jumppad in it. That is tagged with the jumpPad tag. Found in the player stats code. That is the secret behind it all of it.

Also, there is a bit of broken code in there. Thank you if you decide to help me.

Here is the download (FIXED)

JEJoll
JEJoll

It's pretty late right now, so I don't have time to look at this in depth, but I can at least fix your broken code and explain why it's wrong. I remember what it's like starting out :).

So, first I'll explain what's wrong.

Your broken code:


function OnTriggerStay (col : Collider) {
	if(col.gameObject.tag=="jumpPad") {
	
		Debug.Log("HOVER");
		
		this.transform.position.y =+5;
		this.transform.position.x =+3;
	}
}

Basically, your syntax is just wrong. You have =+ instead of +=. That's it.

Paste this into your code and it will work:


function OnTriggerStay (col : Collider) {
	if(col.gameObject.tag=="jumpPad") {
	
		Debug.Log("HOVER");
		
		this.transform.position.y += 5;
		this.transform.position.x += 3;
	}
}

Next, I would change OnTriggerStay to OnTriggerEnter. OnTriggerStay will execute as long as the player is within the trigger. This might work in some cases, but in others, it might cause it to execute multiple times.

OnTriggerEnter will only execute once, when you enter the trigger.

So, now your code isn't broken. However, I don't think this approach will work very well. You're using Unity's standard character controller, which deals with physics and rigidbodies, as others have said. You're directly manipulating the object's position, which the physics and rigidbody are also manipulating behind the scenes, so you're effectively fighting the physics engine.

I would strongly recommend you use Rigidbody.AddForce(), as others have suggested. Look into it and try to figure it out. That's the best way to learn. Don't give up though, I remember when I first started--it's not easy.

Also, if you want a good place to practice javascript (and programming in general): codecademy.com is great for beginners.

And once you get comfortable with that, I would consider switching over to C# for Unity, eventually. Take that with a grain of salt though. It's just my opinion.

Kingston Creations
Kingston Creations

It's pretty late right now, so I don't have time to look at this in depth, but I can at least fix your broken code and explain why it's wrong. I remember what it's like starting out :).

So, first I'll explain what's wrong.

Your broken code:


function OnTriggerStay (col : Collider) {
	if(col.gameObject.tag=="jumpPad") {
	
		Debug.Log("HOVER");
		
		this.transform.position.y =+5;
		this.transform.position.x =+3;
	}
}

Basically, your syntax is just wrong. You have =+ instead of +=. That's it.

Paste this into your code and it will work:


function OnTriggerStay (col : Collider) {
	if(col.gameObject.tag=="jumpPad") {
	
		Debug.Log("HOVER");
		
		this.transform.position.y += 5;
		this.transform.position.x += 3;
	}
}

Next, I would change OnTriggerStay to OnTriggerEnter. OnTriggerStay will execute as long as the player is within the trigger. This might work in some cases, but in others, it might cause it to execute multiple times.

OnTriggerEnter will only execute once, when you enter the trigger.

So, now your code isn't broken. However, I don't think this approach will work very well. You're using Unity's standard character controller, which deals with physics and rigidbodies, as others have said. You're directly manipulating the object's position, which the physics and rigidbody are also manipulating behind the scenes, so you're effectively fighting the physics engine.

I would strongly recommend you use Rigidbody.AddForce(), as others have suggested. Look into it and try to figure it out. That's the best way to learn. Don't give up though, I remember when I first started--it's not easy.

Also, if you want a good place to practice javascript (and programming in general): codecademy.com is great for beginners.

And once you get comfortable with that, I would consider switching over to C# for Unity, eventually. Take that with a grain of salt though. It's just my opinion.

Thank you so so so much. Now the game is no longer halted and is almost done with its prealpha stage

Kingston Creations
Kingston Creations

It's pretty late right now, so I don't have time to look at this in depth, but I can at least fix your broken code and explain why it's wrong. I remember what it's like starting out :).

So, first I'll explain what's wrong.

Your broken code:


function OnTriggerStay (col : Collider) {
	if(col.gameObject.tag=="jumpPad") {
	
		Debug.Log("HOVER");
		
		this.transform.position.y =+5;
		this.transform.position.x =+3;
	}
}

Basically, your syntax is just wrong. You have =+ instead of +=. That's it.

Paste this into your code and it will work:


function OnTriggerStay (col : Collider) {
	if(col.gameObject.tag=="jumpPad") {
	
		Debug.Log("HOVER");
		
		this.transform.position.y += 5;
		this.transform.position.x += 3;
	}
}

Next, I would change OnTriggerStay to OnTriggerEnter. OnTriggerStay will execute as long as the player is within the trigger. This might work in some cases, but in others, it might cause it to execute multiple times.

OnTriggerEnter will only execute once, when you enter the trigger.

So, now your code isn't broken. However, I don't think this approach will work very well. You're using Unity's standard character controller, which deals with physics and rigidbodies, as others have said. You're directly manipulating the object's position, which the physics and rigidbody are also manipulating behind the scenes, so you're effectively fighting the physics engine.

I would strongly recommend you use Rigidbody.AddForce(), as others have suggested. Look into it and try to figure it out. That's the best way to learn. Don't give up though, I remember when I first started--it's not easy.

Also, if you want a good place to practice javascript (and programming in general): codecademy.com is great for beginners.

And once you get comfortable with that, I would consider switching over to C# for Unity, eventually. Take that with a grain of salt though. It's just my opinion.

I want to use C# the issue is the tutorial used it and the other guy confused me. I mean i can try to use the code he gave me. Also it says i need an instance of the unity rigidbody I am so sorry but what does in mean by that.

Kingston Creations
Kingston Creations

It's pretty late right now, so I don't have time to look at this in depth, but I can at least fix your broken code and explain why it's wrong. I remember what it's like starting out :).

So, first I'll explain what's wrong.

Your broken code:


function OnTriggerStay (col : Collider) {
	if(col.gameObject.tag=="jumpPad") {
	
		Debug.Log("HOVER");
		
		this.transform.position.y =+5;
		this.transform.position.x =+3;
	}
}

Basically, your syntax is just wrong. You have =+ instead of +=. That's it.

Paste this into your code and it will work:


function OnTriggerStay (col : Collider) {
	if(col.gameObject.tag=="jumpPad") {
	
		Debug.Log("HOVER");
		
		this.transform.position.y += 5;
		this.transform.position.x += 3;
	}
}

Next, I would change OnTriggerStay to OnTriggerEnter. OnTriggerStay will execute as long as the player is within the trigger. This might work in some cases, but in others, it might cause it to execute multiple times.

OnTriggerEnter will only execute once, when you enter the trigger.

So, now your code isn't broken. However, I don't think this approach will work very well. You're using Unity's standard character controller, which deals with physics and rigidbodies, as others have said. You're directly manipulating the object's position, which the physics and rigidbody are also manipulating behind the scenes, so you're effectively fighting the physics engine.

I would strongly recommend you use Rigidbody.AddForce(), as others have suggested. Look into it and try to figure it out. That's the best way to learn. Don't give up though, I remember when I first started--it's not easy.

Also, if you want a good place to practice javascript (and programming in general): codecademy.com is great for beginners.

And once you get comfortable with that, I would consider switching over to C# for Unity, eventually. Take that with a grain of salt though. It's just my opinion.

I want to use C# the issue is the tutorial used it and the other guy confused me. I mean i can try to use the code he gave me. Also it says i need an instance of the unity rigidbody I am so sorry but what does in mean by that.

And it did not work.

JEJoll
JEJoll

This is not going to directly answer your question, but I feel I should offer some advice (not trying to be preachy, just helpful):

It sounds to me like you're very new to coding (no offense, we all were at some point :)). This is going to make things difficult for you during your game development unless you either team up with a programmer, or get serious about learning the programming and other game development stuff yourself.

I don't know how old you are, but if you're serious about game development, I would very seriously consider studying something game development related in college or university (3D modelling, programming, etc., or even a Game Development course itself). You don't need a formal education to become a game developer by any means (practice and experience are the most important things), but a formal education definitely won't hurt. At the very least, it will give you something to put on a resume (which could get you in the door at a studio), show you the areas you should be studying (game development is a huge umbrella under which many subjects fall), and give you access to knowledgeable people who can help you hone your skills.

The most frustrating thing for me when I began trying to learn programming/game development was figuring out exactly what I should be studying. There are a ton of very specific areas that would be useful to know as a game developer (animation, art creation, programming, art theory, game theory, UI Design, etc., etc), and even more places to learn those skills. Trying to focus your learning and trying to find a good resource are extremely difficult.

I think you've made a good choice in using Unity to start with game development. The community is great, the documentation is awesome, there are a billion tutorials, a bunch of free assets and it's free. Not only that, but many many top-notch studios use/have used Unity at some point. It's a great skill to have.

So, I'm going to give you some resources that I think will help:

  1. Ask questions and look for answers at Unity Answers (be specific in your questions, and provide the code you're having trouble with, if it's a coding question)
  2. Subscribe to the mailing list for Unity Certification Training - I have no idea how much it costs, but it should be released very soon, and will undoubtedly be a good resource
  3. Do the Official Unity Tutorials - There are a bunch of complete games to work through, as well as videos on smaller topics
  4. Make frequent visits to the Unity Manual/Documentation - They're always adding new features to Unity. I've been using it for nearly 4 years and I'm still finding things I didn't know existed (hint: do a search for Rigidbodies in the manual)
  5. Check out Unity's Live Training Sessions
  6. Even though this is the last on the list, I have to highly recommend it, especially for a beginner: Ben Tristem's Unity Course on Udemy - It's regularly around $60, but I've linked to a discounted offer for %40 off until June 18th. There's a very active community, the instructor is also active in answering questions, and it has a ton of varied projects included in the course. There are over 50 hours of content, so it's very much worth the price. It won't teach you everything, but it will give you a great overview of Unity's interface and features, and it covers a lot of programming as well. And it's fun! You won't be a pro after completing this course, but I really think it's the best resource I've seen to get started for beginners. After completing it you'll be able to make some decent games, and you'll have a better idea of what to learn next.

Sorry I didn't explain what a rigidbody is. One of the most important skills to have as a developer is the ability to find solutions. Asking questions is one great way to do that, but every answer you can find on your own should be considered a victory. See if you can figure out the rigidbody thing using the manual.

If you still can't figure it out, let me know and I'll see if I can help.

Seriously consider taking that course. It'll make your life easier.

Gian-Reto
Gian-Reto

I want to use C# the issue is the tutorial used it and the other guy confused me. I mean i can try to use the code he gave me. Also it says i need an instance of the unity rigidbody I am so sorry but what does in mean by that.

If you mean me by "the other guy", I gave you an example using the physics engine. Which means it will ONLY work if the characters have a rigidbody and collider attached to them. That is why I included a link to the Unity physics documentation.

As long as you want to use the physics engine, you should really read into how to use it first. (which, given you write a game that needs physics, I highly advise, unless you either a) are bound by limitations of the target device to use as little CPU as possible (physics calculations can be heavy on the CPU), or b) have some very specific physics behaviour you want to go for that PhysX cannot support).

In TL;DR fashion, just add a capsule collider and a rigidbody component to your character and you are set.

Kingston Creations
Kingston Creations

I want to use C# the issue is the tutorial used it and the other guy confused me. I mean i can try to use the code he gave me. Also it says i need an instance of the unity rigidbody I am so sorry but what does in mean by that.

If you mean me by "the other guy", I gave you an example using the physics engine. Which means it will ONLY work if the characters have a rigidbody and collider attached to them. That is why I included a link to the Unity physics documentation.

As long as you want to use the physics engine, you should really read into how to use it first. (which, given you write a game that needs physics, I highly advise, unless you either a) are bound by limitations of the target device to use as little CPU as possible (physics calculations can be heavy on the CPU), or b) have some very specific physics behaviour you want to go for that PhysX cannot support).

In TL;DR fashion, just add a capsule collider and a rigidbody component to your character and you are set.

I have that all in the character. It just won't let me run the game due to the error and i want to bypass it because it will cause no issues in the game.

Kingston Creations
Kingston Creations

This is not going to directly answer your question, but I feel I should offer some advice (not trying to be preachy, just helpful):

It sounds to me like you're very new to coding (no offense, we all were at some point :)). This is going to make things difficult for you during your game development unless you either team up with a programmer, or get serious about learning the programming and other game development stuff yourself.

I don't know how old you are, but if you're serious about game development, I would very seriously consider studying something game development related in college or university (3D modelling, programming, etc., or even a Game Development course itself). You don't need a formal education to become a game developer by any means (practice and experience are the most important things), but a formal education definitely won't hurt. At the very least, it will give you something to put on a resume (which could get you in the door at a studio), show you the areas you should be studying (game development is a huge umbrella under which many subjects fall), and give you access to knowledgeable people who can help you hone your skills.

The most frustrating thing for me when I began trying to learn programming/game development was figuring out exactly what I should be studying. There are a ton of very specific areas that would be useful to know as a game developer (animation, art creation, programming, art theory, game theory, UI Design, etc., etc), and even more places to learn those skills. Trying to focus your learning and trying to find a good resource are extremely difficult.

I think you've made a good choice in using Unity to start with game development. The community is great, the documentation is awesome, there are a billion tutorials, a bunch of free assets and it's free. Not only that, but many many top-notch studios use/have used Unity at some point. It's a great skill to have.

So, I'm going to give you some resources that I think will help:

  1. Ask questions and look for answers at Unity Answers (be specific in your questions, and provide the code you're having trouble with, if it's a coding question)
  2. Subscribe to the mailing list for Unity Certification Training - I have no idea how much it costs, but it should be released very soon, and will undoubtedly be a good resource
  3. Do the Official Unity Tutorials - There are a bunch of complete games to work through, as well as videos on smaller topics
  4. Make frequent visits to the Unity Manual/Documentation - They're always adding new features to Unity. I've been using it for nearly 4 years and I'm still finding things I didn't know existed (hint: do a search for Rigidbodies in the manual)
  5. Check out Unity's Live Training Sessions
  6. Even though this is the last on the list, I have to highly recommend it, especially for a beginner: Ben Tristem's Unity Course on Udemy - It's regularly around $60, but I've linked to a discounted offer for %40 off until June 18th. There's a very active community, the instructor is also active in answering questions, and it has a ton of varied projects included in the course. There are over 50 hours of content, so it's very much worth the price. It won't teach you everything, but it will give you a great overview of Unity's interface and features, and it covers a lot of programming as well. And it's fun! You won't be a pro after completing this course, but I really think it's the best resource I've seen to get started for beginners. After completing it you'll be able to make some decent games, and you'll have a better idea of what to learn next.

Sorry I didn't explain what a rigidbody is. One of the most important skills to have as a developer is the ability to find solutions. Asking questions is one great way to do that, but every answer you can find on your own should be considered a victory. See if you can figure out the rigidbody thing using the manual.

If you still can't figure it out, let me know and I'll see if I can help.

Seriously consider taking that course. It'll make your life easier.

Thank you so so so much it is such a great help. And i will be doing the course I have been looking for one like that for years and also thanks for the cupon code

Gian-Reto
Gian-Reto

I have that all in the character. It just won't let me run the game due to the error and i want to bypass it because it will cause no issues in the game.

Okay... can you give us

1) the exact error message Unity prints out

2) a more exact description of your character setup in the Unity editor

Reading my code again, did you check that the rigidbody and the collider component are on the same gameObject? If they are not, that would explain the error, as the code I gave you blindly assumes that they are on the same gameObject. If they are not, and there is a reason for that, fear not, we can come up with a different way of accessing the rigidbody from the collider.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.