• Activity
  • Votes
  • Comments
  • New
  • All activity
  • Showing only topics in ~comp with the tag "development.game". Back to normal view / Search all groups
    1. Godot beginners: Here's how to fade in a 3D mesh

      I'm still a beginner at Godot. I've been playing with Godot and 3D scenes. It's great finally feeling comfortable enough to navigate the UI from watching the tutorials from Zenva/Humble Bundle....

      I'm still a beginner at Godot. I've been playing with Godot and 3D scenes. It's great finally feeling comfortable enough to navigate the UI from watching the tutorials from Zenva/Humble Bundle.

      Recently something that sounds straightforward took a long time for me to figure out: Fading in a 3D mesh. The solution is simple:

      @onready var mesh: MeshInstance3D = find_child("body-mesh")
      
      func _ready() -> void:
      	_set_material_alpha(0)
      	SomeSingleton.some_signal.connect(_fade_in)
      
      func _set_material_alpha(alpha: float) -> void:
      	var material: Material = mesh.get_active_material(0)
      	if material is StandardMaterial3D:
      		material.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA_DEPTH_PRE_PASS
      		material.depth_draw_mode = BaseMaterial3D.DEPTH_DRAW_ALWAYS
      		material.albedo_color.a = alpha
      
      func _fade_in() -> void:
      	var tween = create_tween()
      	tween.set_ease(Tween.EASE_IN)
      	tween.tween_method(_set_material_alpha, 0.0, 1.0, fade_in_duration_seconds)
      

      The key being setting the material properties and using its albedo color to update transparency. The depth draw mode is needed, otherwise the result is ugly with jagged pixels during the tween.

      Getting to the solution was the hard part. Searching forum posts I was led down some rabbit holes like using shaders—overkill for this situation. (There is a cool site though, for when I do end up needing custom shaders: https://godotshaders.com/.) Asking an LLM also didn't help much, probably because my prompt was wrong. I tried again just now and it gave me something closer to a correct solution, but missing some parts like the depth draw mode, which (by trial-and-error and reading the docs) I found is necessary for a good quality render, when using transparency.

      Another small pitfall I found was that trying to change the material.transparency caused stutter. I was trying to disable transparency when the mesh was at 100% alpha, since I figured opaque rendering is cheaper. However I speculate the engine recompiles the shader when I turn off transparency, which causes the stutter. So I don't modify the material.transparency beyond that initial setting.

      Also thought I'd mention, I'm using free placeholder art assets from https://kenney.nl/ - an amazing resource.

      Aside: Shaders

      During this I learned that adding shaders to an imported 3D model in Godot is somewhat convoluted:

      1. Import the .glb model
      2. Clone the auto-created scene to an inherited scene, because I'm not allowed to directly edit that auto-created scene
      3. Extract the material (UV colormap image) from the .glb by double-clicking it in the FileSystem tab
      4. Apply the extracted material to the mesh under Surface Material Override
      5. Add a "Next Pass" material, a ShaderMaterial, to that surface material override
      6. Create the shader script
      7. Pass in parameter values from the GDScript to the shader script using code like: shader_material.set_shader_parameter("color", Color(1.0, 1.0, 1.0, alpha))

      This didn't work so well for me though, because the shader I was using was changing the ALBEDO and turning things white. If I knew anything about 3D programming I'd probably find a way to update the existing color value at each pixel, instead of setting albedo white everywhere. The end result of the shader I was using was that the models were turning too white. So that was a dead end.

      Anyway mainly leaving this here as reference for posterity. Feel free to share a story or constructive feedback if there's anything.

      21 votes
    2. Game development career advice

      Hi, I'm curious if anyone in this group has achieved success in game development, whether that's carving out a career or earning any amount of income from it. I'm currently working as a software...

      Hi,

      I'm curious if anyone in this group has achieved success in game development, whether that's carving out a career or earning any amount of income from it.

      I'm currently working as a software developer, but my passion lies in game development. I'm all too aware that achieving any measure of success in this field is next to impossible. Hence, I'm reaching out here, hoping to gather insights and advice from those who have walked this path in the past, or those who are currently walking alongside/behind me.

      One of my specific questions is about the types of games I should focus on creating. Specifically, I've heard differing opinions on whether it's more advantageous to develop a series of small games with advertisements for mobile platforms or to invest in larger, premium games for platforms like Steam. Can anyone share their insights or experiences regarding this dilemma? Is there a clear advantage to one approach over the other?

      Currently I am using godot to make a larger scale game, but I am considering switching to defold and making smaller scale games with ads.

      I saw some folks here discuss making games for the playdate. How much should one consider targeting niche platforms like this? Some of the users I saw discuss this seem to have had good success.

      Some general questions: How did you break into game dev? What were you doing before? Do you see game dev as a viable career, only as a source of side income, or is it just a hobby?

      Any guidance or experiences you can share would be greatly appreciated.

      17 votes
    3. Programming Challenge: Make a game in 1 hour!

      Background There's been some talk on ~ before, and it seems like there are quite a few people who are either interested in, learning, or working in game development, so I thought this could be a...

      Background

      There's been some talk on ~ before, and it seems like there are quite a few people who are either interested in, learning, or working in game development, so I thought this could be a fun programming challenge.

      This one is fairly open-ended: make a game in 1 hour. Any game, any engine, don't worry about art or sound or anything.

      Doing is the best way to learn. Most people's first project is something overly ambitious, and when they find that it's more difficult than they thought, they can get discouraged, or even give up entirely. This is why the 1 hour limit is important: it forces you to finish something, even if it's small. When you're done, you can come out of it saying you made a game, and you learned from it.

      Chances are the game might not be fun, look bad, be buggy, etc. But don't worry about that, everyone's game will have problems, and if you do create something really fun or innovative, congratulations, you have a prototype that you can expand on later!

      "Rules"

      Like I said before, these "rules" are pretty simple: make a game in (approximately) 1 hour. You can use any tools you want. If you use external assets (art, sound), it's probably best you use something you have the rights to (see resources). If you're completely new to game development/programming, your goal could even be to finish a tutorial.

      If you're the kind of person who tends to get carried away with these things, you might want to post a comment saying you're starting, then another one once you've finished your game.

      Please share your finished game, I'm sure everyone would love to try them! If your game is web-based, it can be hosted for free on Github Pages or Itch.io. If downloadable, it can be hosted for free on Google Drive, Mega, Dropbox, Itch.io, etc.

      Resources

      Engines

      If you're a beginner, a good engine to start with is LĂ–VE. It's very simple, and uses Lua, which is very easy to learn.

      If you're familiar with another language, you could use a library to make it in that language. Some examples:

      C++: SFML, SDL, Allegro

      Javascript: kontra, Phaser, pixi.js

      Python: pygame

      Rust: Piston, ggez, Amethyst

      If you want something more complex, consider Godot, Unity, or Unreal.

      You can also try something visual like Construct, Clickteam Fusion, or GDevelop

      Art

      For such a short time constraint, I'd suggest you use your own "programmer art": just use some basic shapes. Your primary focus should be gameplay.

      If you think you have time to find something, try looking on OpenGameArt.

      Sound

      You can make simple sound effects very quickly with sfxr (or in this case, a web port of sfxr called jsfxr).

      27 votes