Unity RPG Tutorial: Leveling and Stats
Вставка
- Опубліковано 1 сер 2024
- In this tutorial we're going to build some core components for the leveling and stat side of an RPG. We'll setup an XP tracker which can easily support different ways of mapping experience points to level. We'll also look at how to setup our stats to make it easy in future to have equipment or other factors influence those stats.
🎞️ Chapters
00:00 Introduction
01:15 Planning the levelling experience
02:45 Setting up our key scripts
10:20 Table-based levelling curve
21:50 Linear levelling curve
34:10 Setting up our UI
47:30 Adding character stats
📂 Grab the full project ➠ github.com/GameDevEducation/U...
If you've got questions add a comment below or send them in for the next Q&A video
🤔 Send in your questions ➠ forms.gle/ToyvqPaBFvpFLtNbA
📁 The searchable video archive is at ➠ www.iainmcmanus.dev/gamedev-e...
Looking for other ways to get involved?
🟠 Support the channel on Patreon ➠ / iaintheindie
🟡 Get the code for all the projects on GitHub ➠ github.com/orgs/GameDevEducation
🟢 Check out my games on itch.io ➠ iaintheindie.itch.io/
🟣 Follow me on Twitter ➠ / iaintheindie
🎉 Thankyou to all of the Patrons 🎉
➔ Manuel Baptista
➔ Grant Coble-Neal
➔ Kasper Enwall
➔ Adam Ercanbrack
➔ Tylah Heil
➔ Ian Kehoe
➔ James McCarthy
➔ Kalvin Pearce
➔ Bradley Seymour
➔ Seriphis
➔ SiliconOrchid
➔ Callan Syratt
➔ Daniel Williams
#Unity #Tutorial #GameDev
This was my first time following one of your tutorials. Awesome tutorial! I really appreciate how you planned this out to be able to fit into any project. So many tutorials are nearly impossible for newbie coders to implement in practice. I'll definitely be checking out more of your videos. Liked and subscribed 🙂
Thankyou! Happy to help!
Digging your tutorials! I'm interested to see more RPG stuff. In particular, a buff/debuff system has puzzled me. Idk if Coroutine would be the way to go for temporary increases or decreases to stats. Would love to see what you come up with.
Adding in a buff/debuff system is definitely something I would like to do in the future. For things like that I generally don’t have them coroutine based. I’ll often use things like scriptable objects and have them manage their timing.
Coroutines I largely use for something that’s a one shot over time (eg a fade) or something that’s more a background task. Main reason I wouldn’t use them for a buff setup is to make it easier to influence the time. Eg. A character could have a buff/stat that impacts the duration. Which that will be a lot easier if managed outside a coroutine
your videos are great and your tutorial style is just so nice
thanks for making these videos
I hope you turn your tutorials and make courses like Udemy tutorials
a more structured content would be really interesting
something like a step by step tutorial teaching a sims clone for a tycoon style game
I would be the first person to buy that course
Thankyou. At times I do want to do series on building a specific small game or pieces of ones. I’ve done a couple of those so far. And some more structured series are also a possibility.
I’ll always make those freely available here on UA-cam though. While I do have a patreon I think it’s important for folks to be able to access educational resources for free. I don’t want folks to ever feel they need to or are expected to pay for the content I create.
Absolutely fantastic video! Totally began to demystify how to handle such a thing in unity! My only question is, would there be an efficient way to have only specific stats increase on specific levels? I've debated exploring the use of a ScriptableObject and a table similar to the XPTranslation_Table that allows me to set how much each stat increases on each level. A scriptable object would be quite helpful, I imagine, if I wanted different party member to grow differently (ex; a small mage might get more magic power but not as much defense compared to a knight in heavy armour).
Do you believe this would be the best approach, or am I overcomplicating something that could be done far simpler.
Thankyou! I'd agree with going for the scriptable object based table. I think it would work out a lot easier in the longterm.
Hi Iain, great tutorial! I've been expanding on this by adding more stats (attack damage, speed, ect) however I've been trying to add attribute points system based on level for instance each level you can spend a point in Strength, Intelligence,Dexterity which also gives stat bonuses.
Any tips you have or able to point me in the right direction?
Thankyou! I think for something like that I'd probably look at tracking an 'available points' variable for the player and each level up that gets added to. Then if there are points available give the player access to a level up/stat UI where they can see how many points they have and allocate them to a particular stat. You could also keep track of the initial stats to support them resetting at a later point as well.
How do I add this to a third person controller and gain the ox buy killing enemy’s
I've tried to keep the code fairly modular so you could either directly copy the script files or export them as a package to import into another project. You'd need to be detecting the death of an enemy and then use that to run the function to add XP. It's something I do intend to add into the project in the future but it won't be for a little while.
ua-cam.com/video/b4uEy7_fhYo/v-deo.html
For a reverse For loop, you can type forR(everse)
forr (tab tab) will autocomplete in VS.
NOT sure for your IDE.
That's cool to know, I didn't realise there was a built in snippet/autocomplete for it. I'll check it out.
I don't understand how you are coming up with the values in the table.. I have a need case where I know the XP that I need to gain per level. For example, a level 1 character would need 500 XP to get to level 2 and then 1000 XP for level 3 and then 2250 to get to level 4 and so on. The XP continuously grows per level but it's by specific values..
I thought by table you meant I could fill out the amount of XP needed per level.
It could be converted over to that approach. What I've currently gone for is tracking the total amount of XP the character has gained and so the table is the total amount of experience points needed for each level.
So much for simple things like exp and leveling. there are so much easier ways to do it than this complicated way. For fresh Devs and news ones.