Code Monkey home page Code Monkey logo

godot-roguelike-tutorial's People

Contributors

klistwan avatar liambull avatar selinadev avatar thedrake avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

godot-roguelike-tutorial's Issues

Fireball effect does not match reticle aiming

The reticle for aiming the fireball draws a rectangle around the selected tile. But the fireball consumable uses euclidean distance instead of the max-of-abs distance used by enemies to determine if they're within range 1 of the player (I forget the name).

Because of this, increasing fireball radius and then trying to clip an enemy with the corner of it will fail to affect them.

Error exporting enum vars in Part 6: EntityDefinition

I'm following your great roguelike tutorial (thank you so much for that!) and I'm getting an error during part 6. Excuse me if this is not the best place to ask questions like this!

I have added the definition of the enumerated AIType in the entity.gd script:

class_name Entity
extends Sprite2D

enum AIType {NONE, HOSTILE}

But then, in the entity_definition.gd script I'm getting an error in the new line; the one that uses the Entity.AIType enum:

class_name EntityDefinition
extends Resource

@export_category("Visuals")
@export var name: String = "Unnamed Entity"
@export var texture: AtlasTexture
@export_color_no_alpha var color: Color = Color.WHITE

@export_category("Mechanics")
@export var is_blocking_movement: bool = true

@export_category("Components")
@export var fighter_definition: FighterComponentDefinition
@export var ai_type: Entity.AIType

Error at (16, 29): Could not find type "AIType" under base "Entity"

To make sure I haven't made some silly mistake, I've also tried copying and pasting the original code from the repository; but I'm still getting the error. Would you have any clues as to what might be going on?

And thanks again. I'm having a great time following the tutorial!


Godot Engine v4.1.2 stable official

Bug where the enemy moves with probability more than one grid unit in a turn

An enemy move with "hostile_enemy_ai_component.gd" will move more than one grid unit in a turn with probability.
To facilitate observation, I increased the number of enemies and expanded the field of view, keep entities visible at all times.

My test method is to add this code to "movement_action.gd" -> perform()

...
	if offset.length() > 2:
		entity.modulate = Color.BLUE
		print(offset.length())
	entity.move(offset)
...

"map.gd" -> update_fov()

...
func update_fov(player_position: Vector2i) -> void:
	field_of_view.update_fov(map_data, player_position, 20)
	
	#for entity in map_data.entities:
		#entity.visible = map_data.get_tile(entity.grid_position).is_in_view
...

bug with confused spell at part 9

func perform() -> void: if turns_remaining <= 0: MessageLog.send_message("The %s is no longer confused.", Color.WHITE) entity.ai_component = previous_ai queue_free()

the %s part is not written, it is missing entity.get_entity_name()

Possible bug in weighted picking code

I think _pick_weighted() in dungeon_generator.gd is bugged.

The chance being added to the cumulative_chances array is not actually cumulative. It's just the same value as in the weighted_chances dict being passed in, so you can end up with values like [80, 15] (for orc, then troll) instead of the desired [80, 95]

Bug with ConfusedEnemyAIComponent cannot be loaded properly

<entity.gd -> restore(save_data: Dictionary)>
...

	if ai_component and save_data.has("ai_component"):
		var ai_data: Dictionary = save_data["ai_component"]
		if ai_data["type"] == "ConfusedEnemyAIComponent":
			var confused_enemy_ai := ConfusedEnemyAIComponent.new(ai_data["turns_remaining"])
			add_child(confused_enemy_ai)

...
The third row " if ai_data["type"] == "ConfusedEnemyAIComponent": "
corresponding
<confused_enemy_ai_component.gd -> get_save_data()> " "type": "ConfusedEnemyAI", "
...

	return {
		"type": "ConfusedEnemyAI",
		"turns_remaining": turns_remaining
	}

...

" if ai_data["type"] == "ConfusedEnemyAIComponent": "
in the <entity.gd -> restore()> function should be changed to
" if ai_data["type"] == "ConfusedEnemyAI": "

(This is the first time I have raised issues on github, please forgive me if the format is wrong😊)

Levelling up doesn't update display

Hello,

Noticed a small bug in the increase_level() function in level_component.gd.

It is missing a call to emit the leveled_up signal, which is what the CharacterInfoBox connects to to update the labels.

Can be fixed by adding leveled_up.emit() to the function.

Bug with Fireball scrolls and input handlers.

In part 9, dying to your own fireball scroll lets you move your corpse around afterward.

This is because the player will die and correctly transition to the GAME_OVER input handler via signal, but then as we exit the inventory menus, that will cause us to return to the MAIN_GAME input handler, overriding the GAME_OVER. I hacked together a fix by making the transition_to function do nothing if you're in GAME_OVER, and then added a force_transition_to function that skips that check, in case I need it later (for e.g. popping out to a main menu).

My own codebase diverges from the tutorial code in a few places, in particular inventory menu structure, but someone else reported this issue to me and I ran into it as well.

Part 10, hp_display.gd

I got through part 10, but noticed that my HP display had stopped working. It looks like you made some changes to hp_display.gd that aren't referenced in the actual tutorial. Once I made the change, it worked.

$ diff part_9/src/GUI/hp_display.gd part_10/src/GUI/hp_display.gd 
8c8,9
< 	await ready
---
> 	if not is_inside_tree():
> 		await ready

Bug: Unable to use items after loading saved game

Thanks for the tutorial series πŸ™ It's been fun following it along! In part 10 however I stumbled upon the following issue.

In part 10 there seems to be an issue with items not having their entities properly set up when loading from a save file.

The game crashes when I try to use a health potion or a scroll in a loaded game.

Steps to reproduce with a health potion:

  1. Start a new game in the part 10 project
  2. Pick up a health potion
  3. Take some damage
  4. Quit to main menu
  5. Select Continue last game
  6. Try to use a potion
  7. Game crashes with message Invalid call. Nonexistent function 'get_entity_name' in base 'Nil', on the script healing_consumable_component.gd at line 15 (in the activate -> MessageLog.send_message function).

Steps to reproduce with a lightning scroll:

  1. Start a new game in the part 10 project
  2. Pick up a lightning scroll
  3. Quit to main menu
  4. Select Continue last game
  5. Try to use lightning scroll with an enemy in range
  6. Game crashes with message Cannot call method 'queue_free' on a null value. on the script consumable_component.gd at line 16 (in the consume function).

I also tested the other scrolls and they also similarly to the lightning scroll crash the game once a valid target has been selected.

I did try to reproduce these in the part 13 project as well but I found I couldn't pick up potions or scrolls there. The message log would just print "There is nothing here to pick up." when standing on top of a potion or a scroll and pressing g.

Items cannot be picked up in part 13

As mentioned in #13, it is not possible to pick up items in part 13 using the g command. Trying to do so will log the pickup fail message ("There is nothing here to pick up.").
This is likely related to changes to the function building the array of items, as this now has to check for the presence of either consumable or equippable components.

restored inventory items are missing the 'entity' member variable

I'm sure I'm just missing something here. After I got things working through part 10, I noticed that inventory items don't work after being restored from save, all related to 'entity' being null:

"Invalid call. Nonexistent function 'get_entity_name' in base 'Nil'". at this line: https://github.com/SelinaDev/Godot-Roguelike-Tutorial/blob/main/part_10/src/Entities/Actors/Components/healing_consumable_component.gd#L16

"Cannot call method 'queue_free' on a null value." at this line: https://github.com/SelinaDev/Godot-Roguelike-Tutorial/blob/main/part_10/src/Entities/Actors/Components/consumable_component.gd#L16

I don't have the same problem running the project from this repo, but can't find what I'm doing different. Do you have any ideas?

Thank you!

Bug: using scrolls in any level after the first one crashes the game

Whenever you use any scroll on any level after the first one results in the game crashing due to the fact that item has stale map_data and tries to act on freed instances of tiles/entities.

To fix the issue I added the following line in the activate_item function in main_game_input_handler.gd

selected_item.map_data = player.map_data

In this way we ensure that the item has the same map_data as the player, which we update in generate_dungeon. Another possibility would be to iterate over every item and update its map_data in generate_dungeon as well.

bug with confusion scroll and radius of 0

when item targeting radius is 0, and you activate and cancel or drop the item. the game bugs out and stays in dummy input handler

test it by dropping a confusion scroll or activating it.
so a targeting radius of 1 and above means its an AOE attack, but 0 means its a targeted single tile attack, and -1 no targeting (health potions activation etc) but the logic bugs out at a radius of 0.

I am not sure on how to fix it exactly. input handlers have been confusing so far.

Misc feedback

Since there's no Discussions enabled I hope it's ok to leave some general feedback here.
First up, really appreciate this series, learned so much! So really wondering if blog posts for part 10-12 is coming in the near future?
If you plan to further add to the series, some topics I'd be very interested in:

  • Mini map
  • Ranged combat (projectiles)
  • Smooth movement
  • Doors
  • Multiple Dungeon floors

I've implemented hold to move several steps with a simple global 'MovementTimer' that starts on key press, stops after 0.2s. Performs a move if the timer is stopped. Simple yet effective. Smooth movement using tweening I've however not been so successful with. That would be really nice to have a tutorial for!

Thanks again for the work you've put in!

Bug with field of view and wait action

Hi, i found a bug with field of view.
in game.gd

		if action.perform():
			if player.grid_position != previous_player_position:
				map.update_fov(player.grid_position)

if an enemy is in a player's potential field of view, but the player uses the wait action, it will not get shown and the player will be continously attacked until they move or kill the enemy, i don't know how to fix this, So for me i just got rid of the if statement that checks if player moved and update the field of view regardless.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.