Тёмный
No video :(

Godot 4 Tutorial - 3D Cards for TCGs using Viewports 

Game Gems
Подписаться 2,8 тыс.
Просмотров 6 тыс.
50% 1

Leverage the power of viewport textures to create fully 3D cards for your own TCG or card-based Roguelike.

Опубликовано:

 

24 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 26   
@StrangerInAStrangeLand1999
@StrangerInAStrangeLand1999 Месяц назад
Definitely would like the performance/alternatives one!
@gamegems7658
@gamegems7658 Месяц назад
It's in the queue and will be done after my next video on 3D dungeon generation.
@QatariGameDev
@QatariGameDev 7 месяцев назад
I stumbled upon your channel about a week ago and I just wanted to express how impressed I am with your Godot tutorials. They are incredibly insightful and have been a tremendous help. Thank you so much for sharing your knowledge and expertise! 😊
@lominero5
@lominero5 7 месяцев назад
I'd love to see your implementation of this in your game. As you mentioned, I'd expect to see some performance degradation
@gamegems7658
@gamegems7658 7 месяцев назад
I've already done the relevant optimizations and will do a followup video in the near future. The trick is to grab the texture from the viewport and assign it to the card, then delete the viewport entirely.
@user-pq7de5vh5f
@user-pq7de5vh5f 6 месяцев назад
love it! follow up on performance/benchmarks/alternatives, please!
@gamegems7658
@gamegems7658 5 месяцев назад
Will do!
@Purexfallenxangel90
@Purexfallenxangel90 5 месяцев назад
this has given me an idea on how to make my in world Scrolls that have information on beasts
@ThantiK
@ThantiK 7 месяцев назад
I mistakenly thought this was recreating the types of 3D "cards" like warframe has where when you mouse around them they move and turn and the picture itself it in 3D. Didn't realize this was going to be this simple of a tutorial.
@tudorm1203
@tudorm1203 7 месяцев назад
Thanks for sharing. This morning I had an egg sandwich.
@gamegems7658
@gamegems7658 7 месяцев назад
Although I haven't played enough Warframe to see the cards you're talking about, they're probably achieved with a similar effect... plus a perspective shader of some kind to change the interior camera of the viewport as the card itself shifts. I remember seeing a tutorial for it online somewhere a while back.
@cccornel5965
@cccornel5965 3 месяца назад
Hold up! Funny and true. I saw so many tutorials with "don't do this, do this instead" and more like it trying to sound smart instead of trying to teach something
@sancho_tem
@sancho_tem 7 месяцев назад
Surprisingly, i use viewport but for the quite simillar problem. my game is built with 3d objects, cards too, and i need to show player preview of card, when they narrow on it. So i made Viewport with other camera and special Card variation made for just displaying same information without scripts. than i use texture from viewport and apply it to CardPreview Sprite2D, showed on main screen
@Paruthi.618
@Paruthi.618 Месяц назад
Many cards = many viewport.. does having many viewports affect the performance? I'm not sure though.. Good tutorial, will give it a try
@gamegems7658
@gamegems7658 Месяц назад
Watch the full video next time. I cover this in my closing thoughts.
@Solanaar
@Solanaar 28 дней назад
Quick question: Amateur here, but could you then add a normal map to it to give it depth akin to hearthstone's cards?
@gamegems7658
@gamegems7658 28 дней назад
Technically yes, but since the texture is dynamically generated, the normal map would need to be as well. Pre-generated normal maps would require pre-generated textures, which defeats the purpose of this process.
@beidero
@beidero 3 месяца назад
I am actually doing this exact thing for a 2d card game, reason being i need to run full card shaders on my cards so I need to turn the entire card into a single texture. As far as I know only possible with viewports. The main worry is performance since I have worked with viewports in 3.x and it did have performance issues. I assume having say 20 of them active at the same time would not work, but since the cards are somewhat static you could just render it once and store the result as an image. Then just refresh whenever something on the card changes. One downside here is that you can no longer have shaders just on the card art which is within the viewport, but was thinking it might be possible to get around that with a SDF in the shader that defines the area of the art and only letting your shader run on that area. Either way, would be very interested in hearing if you did any performance research on this and had any results?
@gamegems7658
@gamegems7658 3 месяца назад
That's about right, once I hit around twenty viewports onscreen my framerate took a nosedive. As you noted, the trick is to render the viewport to a texture and use that image as the card instead. Some mild tradeoffs, but usually necessary.
@ekagaurangadas
@ekagaurangadas 7 месяцев назад
Great video thank! Please do a follow up.
@triplestandart7613
@triplestandart7613 3 месяца назад
Sorry, complete beginner here. I'm using 4.2.1 and when I try to update the text and textures in the set function (I've assigned the resource via the editor), I get an error: "Invalid get index "card_name" (on base: 'Nil')." Probably it has something to do with load order. My script works, when I put it in the _ready() function.
@gamegems7658
@gamegems7658 2 месяца назад
Hard to say without looking at your code. Two things I can think of would be that if you're copying my code directly, I'm using camel case, not snake case, to define and access the variables in the resource. IE, "cardData", not "card_data". Also, you may have forgotten to assign the loaded resource to the local variable data prior to attempting to access it. Finally, note that I'm using get_node directly within the setter; if you're using the dollar sign notation (eg. $node_name assigned with the @onready annotation), then yes, it will fail in the setter because the nodes haven't been initialized yet. That setter runs before the node has been added to the tree, so you have to manually access the nodes.
@triplestandart7613
@triplestandart7613 2 месяца назад
@@gamegems7658 Thanks for the elaborate answer. Sadly, none of that was causing the error. I can't tell you exactly what it was, but I think it's just trying to load the @onready vars for name, text and texture before they are assigned. I've added code to wait for them and now it just works: if not cardName: await self.ready
@triplestandart7613
@triplestandart7613 2 месяца назад
@@gamegems7658 Thank you for the elaborate answer. I don't know what it was. Changing the case didn't work. What do you mean by "assign the lodad resource to the local variable prior to attempting to access it"? Currently, I grab the art for example like this: @onready var cardArt: TextureRect = $Front/SubViewport/Card_Template/CardArt I haven't tried manually accessing the node but I might. For now, I just put "await self.ready" in the setter function and that worked. It's probably not the best solution but for now it works.
@gamegems7658
@gamegems7658 2 месяца назад
That's your problem. The setter for the cardData variable runs before _ready()/@onready is called, which means that when the setter attempts to put the relevant data into those nodes, they haven't been assigned yet. Waiting until _ready is... ready is one way to solve the problem, but I think it would be better if you learned the order of operations for node initialization so that this, and other errors like it, don't come up in the future.
@triplestandart7613
@triplestandart7613 2 месяца назад
@@gamegems7658 That's very sensible. Thank you so much, I appreciate the help.
Далее
4 Godot 4 Devs Make 4 Games in 44 Hours
25:19
Просмотров 511 тыс.
How to Add Interaction in Godot 4
16:48
Просмотров 12 тыс.
Godot 4 - Tiled Dungeon Environment From Scratch
26:24
Просмотров 410 тыс.
I recreated Balatro's effects in Godot
8:04
Просмотров 30 тыс.
My Single-Player Card Game! | Echovale Devlog #0
7:00
I Tried To Beat Minecraft Backwards
18:53
Просмотров 1,4 млн
I Made My First Game in Godot in 3 Weeks...
26:21
Просмотров 316 тыс.
A new way to generate worlds (stitched WFC)
10:51
Просмотров 525 тыс.
Now anyone can simulate flow for a 3D printer duct
11:17
This Godot 4 Scene Manager Does it ALL
28:50
Просмотров 24 тыс.