Project Regina - 3D 3rd person demo (Godot 4)
Asked Answered
I

34

0

A 3D 3rd person player demo of what I've been learning (Godot 4).

I have some backgrounds in 3D (as a hobby) and I started learning Godot at ver3.2 and Blender ver 2.9. I want to try to create a 3D 3rd person project with low to mid poly like PS2 'GTA 3' or 'Bully' graphics.

The main things I'm concentrating on are Player controls, Interactions, StateMachines, Inventory, Water, Save/Load. So this thread is basically gonna be about putting it all together. (It's gonna be a slow process though as I do this in my spare time)

I will mention various methods of how I achieve the result so ppl can at least know where to look in search. Feel free to ask or suggest improvement.

First off, here's my Character Regina George from Mean Girls LOL. I choose her because I wanted to learn doing Long hair and Skirt on a character.

Methods:
Blender - Hair cards with alpha / Rigging / Stencil paint / Combined UVs / Baking textures.

Godot - Import model with textures alpha / Override materials / Facial animation with shader (animated texture2D and texture2Darray) / Animation Retarget / Add, Remove_Child.

For facial animation I used 'Face Mask' technique where I place extra polygons in front of head then applied shader materials.

Shout out to MakeHuman for base body - I used actress image to match the body and face mesh.

Ingenuous answered 19/3, 2023 at 5:30 Comment(0)
S
0

Very interesting project. I will keep a close eye on it. Is this a simple character generator? MakeHuman is a great program and can be used to create an advanced character generator. By the way, they want to improve it a lot now.

What kind of gameplay is expected to be in the game?

Suez answered 19/3, 2023 at 12:51 Comment(0)
L
0

Looking good.

Laundryman answered 19/3, 2023 at 16:28 Comment(0)
I
0

Suez
I wouldn't call it a game as it won't have any objectives. I only want it to be a testing playground project where I can make a character interacting with stuffs.

Yes, it's a simple character from MakeHuman. I placed actress image as a background then used slider to shape the face and body, then export mesh to Blender. I then flatten the eyes / mouth as I want to use the face mask method. (flatten her toes too for the shoes paint on)

I also noticed MakeHuman has 2.0a out for testing. I will check it out later.

Ingenuous answered 20/3, 2023 at 2:44 Comment(0)
S
0

Ingenuous I wouldn't call it a game as it won't have any objectives. I only want it to be a testing playground project where I can make a character interacting with stuffs.

Well, that's a way of saying that there are no objectives in the Sims series either. 😆 "Interacting with stuffs" is gameplay and quite popular. 👍️

Suez answered 20/3, 2023 at 18:35 Comment(0)
S
0

Ingenuous I also noticed MakeHuman has 2.0a out for testing.

The new version of MakeHuman is 1.2.1 alpha (nightly). And 2.0a is MPFB2 — a plugin for Blender. Slightly reduced in functionality compared to the standalone program.

Suez answered 20/3, 2023 at 20:23 Comment(0)
C
0

Suez Well, that's a way of saying that there are no objectives in the Sims series either.

Isn't the basic objective to keep your sims alive at the bare minimum, and ever more prosperous as the secondary?

Cloraclorinda answered 20/3, 2023 at 21:20 Comment(0)
S
0

Cloraclorinda Isn't the basic objective to keep your sims alive at the bare minimum, and ever more prosperous as the secondary?

Nope. Far from it. It's up to the player to decide what his goal is.

I run the risk of possibly disappointing or overwhelming... but… some players, choose how to kill a sim in the most sophisticated way possible. And often these players are young children. I'm a moderator at a The Sims fan site and I could tell a lot of creepy stories. But, trust me, it's better not to know them.

It's kind of a competition between the players and the developers. The developers are teaching the Sims to save themselves. For example, in the past, players would run sims in the pool and remove the ladder in the editing mode of the house. The sim would get tired, could not get out and drowned. Developers have done that sim could get out without the ladder from the pool.

Suez answered 20/3, 2023 at 21:37 Comment(0)
C
0

Yes, emergent gameplay but I meant as in the primary core game-loop as designed by the developers.

Cloraclorinda answered 20/3, 2023 at 22:57 Comment(0)
S
0

Cloraclorinda …but I meant as in the primary core game-loop as designed by the developers.

The humor is that now it is very difficult to guess what the developers intended. The very presence, initially, of many situations, including those with lethal risks, suggests that the objective is to allow players to implement various life and living scenarios. A long happy life is one possible scenario available. But it's not the only one.

There is an opinion that Sims was made as a parody of the American way of life. But after William R. Wright had a loud falling out with EA, one can only wonder what he wanted but didn't have time to realize. And to what extent his ideas survived in subsequent games in the series.

Suez answered 21/3, 2023 at 1:45 Comment(0)
I
0

Suez
I see, Thanks for clarifying

Ingenuous answered 22/3, 2023 at 16:7 Comment(0)
I
0

A little test before I send her to a StateMachine.


-Hair Jiggle: Jiggle Bone Addon


-Random animation while idling: AnimationPlayer/Array/Timer/Randi()

I disabled the skirt because it requires new retarget/script adjustments. She will get a new player script anyway so I figure to just update it there.

Ingenuous answered 22/3, 2023 at 16:11 Comment(0)
S
0

Wow! What kind of rig and where did the animation used for the model come from?

Suez answered 22/3, 2023 at 16:25 Comment(0)
I
0

Suez
I did a simple rig and keyframe rough animations for testing purpose. Personally I have no idea what she's doing LOL

Ingenuous answered 22/3, 2023 at 16:59 Comment(0)
I
0

Node based state machine.

*There are some frozen states when jumping/running/with skirt. It probably has something to do with pressed and just_pressed jump/run button. I will try fix it along the way but overall the State Machine is working alright.

*There is also this error with animation player. For some reason if I don't set animation to loop linear it will throw red error that "on_animation_finished not found" on that animation. Set to loop ping-pong also won't play either. So I set all my animations to loop linear.

Next I will add my nemesis...Inventory 😆

Ingenuous answered 2/4, 2023 at 5:43 Comment(0)
L
0

This is looking really cool. Reminds me of The Sims.

Laundryman answered 2/4, 2023 at 6:10 Comment(0)
S
0

Suez answered 2/4, 2023 at 11:6 Comment(0)
I
0

I have done the Inventory and Shop. It is based off this tutorial. I just added more functions / modified it to my likings.


This is the Player Inventory. It has 4 tabs, 1 for each item category (Clothings, Accessories, Items, Food). Right now they are all empty. The right panel to show item Infomation and buttons.


You walk to the shop and the Shop Inventory is activated. You then buy items and it will be placed in its category tab (in the Player Inventory). I also use ScrollContainer, there are empty spaces to put item descriptions and quantity.


For Clothings Tab, there are 2 places where you can put item on the player, Body and Hip. They are just node3D positioned in player's scene. Then when press button it checks the name of item in that category then add_child it.

I also got the Tick system when one of the Body/Hip item is being used.
(by checking var is_used = true then make the sprite2D tick visible)


I got a swimsuit item which is just swaps player's texture and play shapedkey to expand the hip back to normal proportion. (I originally shrank the hip so it won't see through clothes that much)


You can unuse items and discard them


For Accessories Tab is pretty much the same. I use boneattachment for head bone and wrist bone. I add jiggle to the Bunny ears.


For Items Tab is just a pop up to show more details. Maybe use for clue or map or use key for doors..etc.


For Food Tab, each Item can be stacked and used up. In this demo I use it to change variables, for example, Chocolate bar will decrease Health, Apple with increase it, and Cake will increase coins.

This inventory code is kind of a mess, many duplicated codes, and totally unoptimized. I don't think it can/should be used in real game. There are also still room for improvement like sorting items. Overall though I'm pretty happy that I could make this Inventory work.

Next I will try doing the scene switches and to carry those player's equipped items over. Then the save/load function.

Ingenuous answered 7/5, 2023 at 16:32 Comment(0)
S
0

Well, it's almost an alternative to the The Sims. There's just a little bit of tweaking left to do. 😹

Suez answered 7/5, 2023 at 16:49 Comment(0)
L
0

This is starting to look really cool.

Laundryman answered 7/5, 2023 at 19:8 Comment(0)
I
0

Suez

Far from it LOL. There are still so many things for me to learn in order to make any complete game.

Ingenuous answered 9/5, 2023 at 2:33 Comment(0)
I
0

Not much new to show visually but I've managed to do the Scene Switching and Saving/Loading game.


Methods:
Scene Switching : using change_scene_to_file(). I have a player_load function that checks any inventory items being used == true then add_child() them.

*I have red error regarding the body's materials. There is an github issue on it. I'm not sure it is fixed in the latest version. (I'm at version 4.0.1 rc2) https://github.com/godotengine/godot/issues/67144


Saving/Loading game : using JSON (tutorial from document). Save all the inventories + player's info to JSON then load it all back, then player_load function.

*There is a bug when saving player's health. I have to close and reopen the Menu then press save button in order the save the player's health correctly. The problem is that I put save function in Inventory Menu and while Menu is on, the mainscene process is disabled. I guess for a real game I'd need the put the save button somewhere else.

Next I will try to add water with shader (pool, beach) and have character interact with it.

Ingenuous answered 27/5, 2023 at 3:12 Comment(0)
S
0

As always — very interesting and extremely informative! There's a lot here that I've been thinking about how to implement. It was a great pleasure to look at it. I wanted to try to implement saving via JSON too.

With your generous permission, I'll steal the ideas into my project. 😊

Suez answered 27/5, 2023 at 13:4 Comment(0)
I
0

Suez

No need to ask for my permission 😃 . Those are already available on internet, youtube..etc (just search godot 4 scene switching/ saving/loading tutorials). But if you don't have access to youtube then don't worry, most of those tutorials are using official doc methods anyway.

Change scene by change_scene_to_file() : https://docs.godotengine.org/en/stable/tutorials/scripting/scene_tree.html#changing-current-scene

Change scene by add_child() : https://docs.godotengine.org/en/stable/tutorials/scripting/change_scenes_manually.html

Saving game by JSON: https://docs.godotengine.org/en/stable/tutorials/io/saving_games.html

Saving game using Resource : *Haven't tried yet but supposedly is easier than using JSON

It's not hard but I guess the most "thinking" part of this procedure is decide which infos you want to send over (player's health, location, items..etc), where would you get those infos on your scripts, and how would you put those back to your player once you load it from JSON file (Might need to do some values conversion too). It will depend on how your setup your trees and scripts.

You can check out my profile>discussions. I've been asking about it in recent weeks, there might be some useful stuffs for your project.

Ingenuous answered 28/5, 2023 at 3:42 Comment(0)
S
0

Ingenuous It's not hard but I guess the most "thinking" part of this procedure is decide which infos you want to send over

It's a Sims-like game. So the amount of information saved will be quite large. But not right away. I will be making a small game to start with. I suppose there will be a lot of prototyping and investigating different approaches to implementing various features.

Suez answered 28/5, 2023 at 12:36 Comment(0)
I
0

Suez
I'd say just go for it. You'd find that you need to make a lot of adjustments while you put it all together.

In a mean time, this pops up on my youtube and I finally understand what they all means 😄.

Ingenuous answered 2/6, 2023 at 2:27 Comment(0)
S
0

Ingenuous In a mean time, this pops up on my youtube and I finally understand what they all means

That's right… I've run into this before and I guess I understand it well… but I have two chits: I am not time-bound and there are no grants to account for.

Suez answered 2/6, 2023 at 10:39 Comment(0)
I
0

Just a footprint test, not really accurate but I'm ok with how it turns out. I have a raycast shooting down from body then place 2 foot sprite3Ds alternately. The sprites rotate according to the body's rotation.

Ingenuous answered 3/6, 2023 at 9:3 Comment(0)
L
0

So cool.

Laundryman answered 3/6, 2023 at 9:17 Comment(0)
S
0

Wow! Well, such graphics would already be quite suitable for a Sims-like game. A small glitch when the camera is on the edge of the water, but I guess this is a common problem. By the way, what kind of shader?

Very cool! 👍️

Suez answered 3/6, 2023 at 12:15 Comment(0)
I
0

Thanks all.

Suez
For that gif I used -

Although I'd probably end up just using animated textures instead 'cause my laptop gets too hot with shader LOL.

Also, you couldn't see it on the gif but there are artifacts around the character when on top of the water shader, especially around the head area. I don't know if it's because the hair area has alpha texture or something else.
*just tested and confirm it is the alpha material in front of shader issue, how to fix this?

A small glitch when the camera is on the edge of the water

Yea I've been researching on how to do half underwater camera effects. As I understand Godot would need a thing called stencil buffer which Godot doesn't have currently (correct me if I'm wrong), or it would requires a lot of shader/viewport/another camera trickery which kinda out of my league.

Ingenuous answered 4/6, 2023 at 4:36 Comment(0)
S
0

Ingenuous *just tested and confirm it is the alpha material in front of shader issue, how to fix this?

I have observed a similar problem. As far as I understand, the solution is all sorts of masking and hiding it. The solution is, of course, palliative, but there doesn't seem to be any other solution yet. It could probably be a very good pull request. Along with a stencil buffer.

Suez answered 4/6, 2023 at 7:44 Comment(0)
U
0

Seeing all this makes me so excited to get back in 3D. The last two months has been nothing but string processes, arrays and pseudo-filesystems. For those that know, Black Daemon is still in development :-). The underlying code is vastly over-engineered, but it's wrinkling my brain tenfold.

Uncounted answered 4/6, 2023 at 20:45 Comment(0)
I
0

Suez
I read there is a stencil buffer pull request and possibly available in 4.1 or later.

Uncounted
Yea I'm glad I got over the Inventory and Scene switching/saving parts. Now to the fun part for me. (Visually fun, at least)

Ingenuous answered 8/6, 2023 at 4:31 Comment(0)
I
0

Let's go for a swim!
There aren't many tutorials for swim in 3D. I basically found one so I use his implementation, which I also need to modify my State Machine to be able to work with his method.


She can walk/run/jump into the water until it reaches her chest and she will float on the surface. She can move around slowly on the surface or swim breastroke style by pushing a button.

I have an area3D at her chest to detect the difference between water surface and her. I use that number to indicate where she is from water surface and what to do. For example when she is closed to the surface, I slowly float her up. If she's far down she will be in underwater state and float in place..etc.
The downside is I can't go anywhere else below the water surface, Maybe need a check somewhere outside of water area to deactivate her swimming state.

The tutorial also uses her velocity to decide what to do as well. For example if her velocity.y is almost zero then go to floating state..etc.


She can dive to underwater. It's kinda tricky to get the animation to match the timing before changing state. There is a way to code it in the tutorial but I didn't add to it yet. Maybe will come back to it later.


She can slowly move or swim on / under / up to the surface. There is a little bug for swim up, if you let go of the button she will stay still but won't change her legs kicking state)


Swimming back to the beach and going to the pool


The Swimming pool has a springboard. Once gets on she can jump very high. It's just an Area3D at the tip and increase jump velocity. The board have bounce animation but it finishes too quickly to see.


Just had to add jump out of pool temporary because I forgot to add a pool ladder.

Swimming has a lot of room to improve but I'm very happy to make it work (always been a goal of mine). I can say that my main objectives here are pretty much completed. I feel I've learned so much game making with this project. (It's not easy as the project gets bigger, your codes get messier). I will put a break on this but will come back to this occasionally to add other interaction stuffs, if I have free time.

I now plan to complete small, actual game project and try to test publish it. (Maybe just a sidescroller in 3D with like 4-5 levels) Also plan to learn to make a 3d fighting game. See you next time!

Ingenuous answered 24/6, 2023 at 9:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.