Adding Rooms (Godot Retro Text Adventure Tutorial #7)

  Рет қаралды 9,379

jmbiv

jmbiv

Күн бұрын

Пікірлер: 52
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
IMPORTANT: starting in Godot 3.4, the keyword "Room" is reserved in Godot. That means you can't make a class name called Room anymore. Because of that, I would recommend changing "Room" to be something like "GameRoom" or "GameArea" - whatever you want it to be. This will help fix any errors that say "Room shadows a native class" you might be seeing. Hope that helps!
@mushroomcrepes4780
@mushroomcrepes4780 2 жыл бұрын
thanks for the heads up :D
@josephmarsh5031
@josephmarsh5031 2 жыл бұрын
I feel like Godot should change that. I find it hard to believe that this choice making anyone's life easier...
@AtomicBananaPress
@AtomicBananaPress Жыл бұрын
Lol I should have scrolled down before googling, but I came up with the same solution, so that's something at least!
@Oli_the_Alien
@Oli_the_Alien Жыл бұрын
PoolStringArray is called PackedStringArray() in Godot 4
@Oli_the_Alien
@Oli_the_Alien Жыл бұрын
In Godot 4 it's command_processor.response_generated.connect(handle_response_generated) instead of command_processor.connect("response_generated", self, "handle_response_generated")
@jordaniel8156
@jordaniel8156 Жыл бұрын
😚
@jmbiv_dev
@jmbiv_dev 10 ай бұрын
Thanks for providing this very helpful Godot 4.x update!
@themonamoua
@themonamoua 6 ай бұрын
In Godot 4 9:02, you add @ to export and take off (String). This should be the updated format example below: @export var GameRoom_name = "Room Name" @export var GameRoom_description = "This is the description of the room."
@dreamhollow
@dreamhollow 2 жыл бұрын
Thanks for the video series. I never though I'd be making a text adventure game in Godot, but I'm really happy this series exists and is easy to follow.
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
So glad to hear you're still enjoying it! I've got the next few videos for this series coming out in the next couple weeks, so hopefully it helps you with your own game.
@nosdregamon
@nosdregamon 3 жыл бұрын
Awesome as usual. My own implementation of rooms so far was just a JSON-like "dict" inside the command processor, but it's complexity escalated quickly, when I tried to make connections between rooms. Also these connections became far more complex once I noticed, that I needed some kind of "locks" - which became a hard coded mess just as quickly, too. Even something as simple as "Corridor [A,B] only crossable, if Door[1] is opened, which requires Key[1]" can become quite complex. Trying different scenarios and looking forward to the next video :)
@jmbiv_dev
@jmbiv_dev 3 жыл бұрын
Thanks, glad you liked it! And really interesting, thanks for sharing. The challenge with stuff like this is always trying to keep the complexity down haha, so I definitely feel that. It took me a few tries to find a method I was happy enough to use for this video (and it still is far from perfect). I think you'll enjoy the next two videos (exits and creating an exit resource) and will be curious to hear your thoughts/feedback on the system I chose compared to yours!
@danielrose1998
@danielrose1998 Жыл бұрын
In Godot 4, when using the .join() function on a PackedStringArray, it needs to be formatted like so: var strings = " ".join(PackedStringArray([ "You are now in: " + new_room.room_name + ". " + new_room.room_desc, "Exits: " + exit_string ])). Not sure why they changed it so that .join() is before the PackedStringArray but this is the formatting that worked for me in Godot 4 _/(^^)\_
@roundninja
@roundninja 6 ай бұрын
Thanks, that worked for me!
@julesyoung6571
@julesyoung6571 3 жыл бұрын
Yay for rooms, looking forward to this episode.
@jmbiv_dev
@jmbiv_dev 3 жыл бұрын
They've been a long time coming, haha. Enjoy!
@adventuresoftext
@adventuresoftext Жыл бұрын
Very awesome tutorials! I'm excited to see if I'm able to bring over my Python Open World Text Adventure into an actual GUI (it runs in Windows CMD). Surprisingly there's still quite a bit you can do in CMD, like I had basic text colors for the tiles (display view/map) and for lightning storms you could flash the CMD black and white really fast. So I'm just curious how much Godot could do for it. Been working on the Python adventure for about 7 years, lots of functionality built into it (and love lol) with all kinds of things to do like Mining, Farming, Fishing, Crafting, Building, Blacksmithing, A Forge that you fuel and light, heats up overtime with the Ore inside smelting at certain temps. Everything randomly generated, an entire world of 1 million tiles that I would generate on a hierarchy system I made, where I'd generate water first, then dirt and grass so on. Each tile that generated onto a previously generated tile would store it into a list so if it changed, it can revert back to the exact same tile. This was for say, maybe you dropped a Sword on a grass tile and you built a Forge on top of that grass. You could push the Forge and retrieve the Sword still. Items dropped had a decaying system as well as buildings, food, and other crafted objects like a Forge, overtime receiving very small damage. This was to help free up objects and items made, dropped, and forgotten about, as this text adventure had the potential for the Player to generate a lot of content. Cooking/Food Prep was a recent thing added, where you could prep ingredients like potatoes, chopping them or dicing them, things like that. Not much description needed on cooking but it was going to be pretty in-depth like everything else lol. Mines, as you mine, you chip away at the Rock Tiles until they crumble, they dropped an Item called Rock Shards. When the Rock Wall finally crashes down you get a Cave Floor tile, so you're working your way in. You could find Ore Veins like Iron, Silver, Copper, and Gold, which had about 5,000 hits on them and drop the Ore Types. Everything was also based on Quality and Skills, so Ore Veins had a base Quality Tier system, where they can produce either low quality, or higher quality. The Quality of your Pickaxe and your Mining Skill Level also played into how much Quality you'd actually receive. So if it was an Utmost Quality Iron Vein (Up to 99 Quality Ore), but your mining with a 30 Quality Pickaxe and only Mining Level 20 for example, you'd only be able to produce around 25 quality ore max give or take, which was all RNG as well. Mines also had a chance to randomly cave in if an open tile (Cave Floor) wasn't supported. Also added Multiprocessing to it so I could do some sounds in the background, cause the main process was handling the basic player sounds and music. Plus it being a text adventure, the game was basically paused waiting for player input, so I was only able to play random animal sounds once for example until the player did something. I wanted the game to feel more "alive" so I checked into Multiprocessing. So now I was able to randomly play birds chirping and flying around, even if we wasn't doing anything. I then added other Animals like Cows, Horses, Chickens, Roosters, Dogs, and Turkeys (where I left off lol) and was able to also put them on a process to randomly play. It helped it feel more alive, though the Animals didn't move unless the player did something. But it was still cool, I even made the Turkey special by making it so if there's more than one, and one decided to gobble, any other Turkey within so many tiles would also gobble. So this meant I could fill an area of Turkeys, and one could cause a cascading gobble to happen dynamically. Also had AI for them and other NPCs. I also created Mother Nature Function, which will randomly decide if it wanted to plant flowers and trees, spawn Animals, you know. It would also keep track of the tiles and some of their properties. Grass and flowers had a Forage option where you could either find a random item or not. Mother would determine if the item was there or not and keep track of the cool down for when you can Forage again. Mother also governed the Gods that the Player could follow. The Gods had the ability to Bless any walking tile with a random Stat Boost that would buff you when you walked on that tile. They could Bless up to around 250 tiles a day, and the Blessings decayed after 2 in game weeks. You could pray to your God at an Altar once a day also for a Stat Boost and Leveling up your Devotion to them which Unlocked Powers at certain levels. Gods aren't all fun though, they had likes and dislikes which effected your Devotion Level. Some Gods may not like you chopping Trees down, or others dislike Fishing. Losing your Devotion Level also meant you could lose the Powers they granted if you fall below the requirement. It was my monster baby for 7 years, I put a lot of devotion into it. This is only some of the features explained. So yeah, gonna see if this could work in Godot, maybe not 1 million tiles but surely I can get at least most of the functionality into Godot. If you made it this far, thank you for reading! I shared some gameplay on this channel if you're curious about it. Haven't been working on it in a while though. Really miss developing it, but had to take a break. Also I'm no KZbinr, so poor presentation but you get the idea lol. Thanks again for these tutorials, coming from Python I have no idea how to use game engines at all, but learning the coding aspect is always easy. You're just the push I needed to get in the right direction.
@matteaparker4165
@matteaparker4165 Жыл бұрын
I had an issue with adding .join(" ") at the end of the packed string array and was able to work around it by adding it to the emit_signal line instead. It looks like this now: var strings = PackedStringArray([ "You are now in " + new_room.room_name + ". It is " + new_room.room_description, "Exits: " ]) emit_signal("response_generated", " ".join(strings))
@adventuresoftext
@adventuresoftext Жыл бұрын
Thank you so much! This was throwing me off from an error "Cannot convert argument 1 from PackedStringArray to String." Adding join as you suggested made this error go away.
@ThePotionKnight
@ThePotionKnight Жыл бұрын
Saved me from a massive headache. Thank you!!
@chillinjesus1013
@chillinjesus1013 9 ай бұрын
just a heads up for anyone else who makes this mistake. I accidentally typed "/n" instead of " ", so make sure you type it correctly. I started getting a headache just to realize I typed it wrong lol.
@jmbiv_dev
@jmbiv_dev 9 ай бұрын
That would be tricky to debug haha. Glad you were able to figure it out!
@Tylorva
@Tylorva 11 ай бұрын
I was having a weird error at the class_name part. I named the class as instructed, and tried to call it in the change_room function, but got an error saying "Could not find type in the current scope". After an hour of googling and swearing, I eventually found that the solution to the problem is the time-honoured Turn It Off And On Again. Restarting Godot fixed the problem. I have no idea why. But writing it here in case anyone else has the same issue.
@Eihcrum
@Eihcrum 2 ай бұрын
Thank you so much! Almost tore my hair out wondering why it didn't work.
@Kimajita
@Kimajita 2 жыл бұрын
Hellooo, these tutorials are really helpful and beginner-friendly (I just started using the engine). After the chapter "Printing out Current Room Room Details" I tested my game and got the error: "The class "Room" shadows a native class". Tried to google it but couldn't find how to fix it. Did anything change in the newer Godot Version? Thanks a lot
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
So sorry about this issue! I just learned that Godot 3.4 added a built-in "Room" class, so that isn't a valid class name for us to use anymore. If you change your "Room" class to be something like "GameRoom" (really anything you want), it should work.
@Takiro_Ryo
@Takiro_Ryo 2 жыл бұрын
Hey, when I add a new Room from the controls menu (with ctrl+A, then selecting the custom room class) the panel is empty (doesn't even have the default text and ignores the minimum size too for some reason) and trying to change any of the texts gives an error that the node paths are wrong. that doesn't happen when duplicating a room with ctrl+D and I wonder why that is. I'd expect the node to work the same no matter how it was added to the node tree. I assume it has something to do with having a tool script? I tried it with your code from GitHub and it happens there, too. Great tutorial by the way, the idea to make rooms nodes is great. I would have hard coded everything otherwise just out of habit.
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
Hmm, weird. I think your intuition is correct - sometimes tool scripts can be a bit funky with how they appear in the editor. If you try hitting the eye icon twice, that usually fixes it, but not sure why you're seeing that.
@thomaseubank1503
@thomaseubank1503 2 жыл бұрын
I called my rooms zones instead for the reason you highlighted above
@samthesupreme5752
@samthesupreme5752 2 жыл бұрын
Epic video, well explained, however I'm getting an error that I can't seem to figure out since I practically copied your code. In the Game script under the handle_response_generated function, it says that the identifier "response" isn't declared in the current scope. The particular line I'm getting this error on is 'response.text = response_text'. I'm a complete beginner and I have no idea what I'm doing so any help would be appreciated
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
Sorry for the delayed response! That error is telling you that you ever created a variable called "response." Before you can use a variable, you first have to declare it somewhere (which you see in other lines here when we say "var some_var" - you create a variable by using the keyword "var"). So, this means that you never say "var response" anywhere, but instead just start using "response" without creating it. I forget where we actually create response (whether it's inside the function you're talking about, or as a script variable at the top), but just make sure you also included the line, wherever it is, where we declare "var response = ...". Hope that helps!
@rik0904
@rik0904 Жыл бұрын
oh Im gonna have to jump through so many hoop in c# for this
@charlythompson9281
@charlythompson9281 Жыл бұрын
Would a List do the same thing?
@rik0904
@rik0904 Жыл бұрын
in c shar there is a StringBuilder that can do similar thing as a PoolStringArray
@ZorothTheAwesome
@ZorothTheAwesome Ай бұрын
The number of Errors I now have in Godot 4.3 isn't even funny. Think it might be time to consider remaking this series for the new version.
@jeux1d100
@jeux1d100 2 жыл бұрын
Hello, thanks for these videos, really helpfull for total noob like me. Have an issue however, at 20:40 the game crash at launch. Invalid get index `room_name` (on base `Nil`). I think i triple check everything, but still can’t find anything different from your video... Maybe something changed because i’m using godot 3.4 ?
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
That error indicates that, on whatever line you're trying to access "something.room_name," the "something" in question is actually null. Check and make sure that, whatever that variable/object is, you're setting it correctly and that it isn't null at the time the error is being thrown. Hope that is a helpful start!
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
@VoirXAsh If you're getting the same "base 'Nil'" error, it means that whatever variable is causing it is null - try tracing that variable back to where you set it, and make sure that you're actually setting it to something valid. You might have to do some investigation or debugging to figure it out. If you join our discord server, we can help you out more + you can post pictures of your code!
@TazzEdit
@TazzEdit Жыл бұрын
Did you ever find a solution to this?
@jeux1d100
@jeux1d100 Жыл бұрын
@@TazzEdit Me, no, i gave up soon after.
@kosm460
@kosm460 Жыл бұрын
where do you call the initialize function you made?
@kosm460
@kosm460 Жыл бұрын
i found it but i'm having a problem. the game still thinks that current_room is null and i dont know why
@erikfabbri291
@erikfabbri291 Жыл бұрын
I have a problem with line 22, with godot 4 it gives me this error Invalid call. Non-existent function 'initialize' in base 'Node()'. What does it mean? EDIT: fixed for now
@MelanieSmitsMel
@MelanieSmitsMel Жыл бұрын
I know it's an old comment, but for anyone scrolling through in the future, in godot 4 it's .instantiate(). So Response.instantiate()
@ZorothTheAwesome
@ZorothTheAwesome 2 жыл бұрын
I wanna display pictures along with text every once in a while.
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
That's a great feature to add! You can use a TextureRect to show images that follow the layout of its parent container pretty easily. Give it a try, and ask around in the Discord server if you're having trouble getting it to work!
@CBusschaert
@CBusschaert Жыл бұрын
I wouldn't recommend eagerly creating visual assets you don't need. The whole "It's okay to have panels outside of the frame" doesn't sit right with me. They might be out of the camera frame, but they're in memory. "We might add a map later" is not a good reason for creating visual nodes this early. This is a small toy project for a tutorial so it's "no big deal", but doing this in an actual project is a really bad idea. Do what's needed now, not what "might eventually be useful later in another feature", or you'll end up with memory bloated with unused resources, or code doing gymnastics it doesn't need to do.
@jmbiv_dev
@jmbiv_dev 10 ай бұрын
This is a good point! Thanks for making it and taking the time to write that out. I just wanted to drop a quick response here since I'm sure others have wondered the same thing. In general, I totally agree with pretty much everything you said. For this particular use case (and even in the case of a larger text adventure or actually production-ready game), I wouldn't overestimate the memory cost here though of using visual nodes, especially since they are an important part of the editor experience even if not the gameplay experience. The memory cost really is minimal, and while those nodes are off-camera they won't take any GPU time to render. So again, totally agree with you, but the actual real cost (in terms of memory) of doing it this way really is pretty negligible, even though you are correct that, for what this tutorial actually ended up being, using something like a Resource (code objects that aren't nodes/don't have a visual component) would have been better and more efficient. Not that it matters, but for others who read this and are curious - the reason we used nodes for rooms in this tutorial is because: 1) Like you said, it's just a tutorial. Most text adventure games will have a visual/map component, though, so it felt important to at least demonstrate one way that people can create that since it's a near-essential genre feature. 2) I actually originally intended to create a visual map as part of this tutorial, but we just ran out of time. So these weren't originally intended to be just random visual containers that were unused except in the editor. Thanks again for your comment!
@YammoYammamoto
@YammoYammamoto 10 ай бұрын
PoolStringArray is now PackedStringArray... and the syntax has reversed: : _current_room = new_room_ : _var strings = ' '.join( PackedStringArray(["You enter: " + new_room.room_name, new_room.room_desc,"Exits:"]))_ : _emit_signal("response_generated", strings)_
@ИванИваныч-й8в4к
@ИванИваныч-й8в4к 3 ай бұрын
Использовал вашу версию. Ошибок нет. Но, текст в игровом поле не выводится на экран :( Однако, через debager, команда печатается - print(new_room.GameRoom_description + " " + new_room.GameRoom_name)
Godot Nodes Explained: 2D Joints
11:47
LucyLavend
Рет қаралды 45 М.
啊?就这么水灵灵的穿上了?
00:18
一航1
Рет қаралды 51 МЛН
My Daughter's Dumplings Are Filled With Coins #funny #cute #comedy
00:18
Funny daughter's daily life
Рет қаралды 29 МЛН
Part 5. Roblox trend☠️
00:13
Kan Andrey
Рет қаралды 2,7 МЛН
规则,在门里生存,出来~死亡
00:33
落魄的王子
Рет қаралды 31 МЛН
All There Is To Know About Godot's Scenes and Nodes
8:14
GDQuest
Рет қаралды 107 М.
Godot Multiplayer Server-Client Tutorial | Godot Dedicated Server #1
41:20
Game Development Center
Рет қаралды 142 М.
How to Create a Juicy Health Bar in Godot 4 Using Tweens #gamedev #godot
22:47
Victor Lima - Game Dev
Рет қаралды 1,8 М.
Godot 3.0 - Know Your Nodes: Particles2D
18:14
KidsCanCode
Рет қаралды 86 М.
啊?就这么水灵灵的穿上了?
00:18
一航1
Рет қаралды 51 МЛН