Skip to content

Commit

Permalink
Fix: #88 and #99
Browse files Browse the repository at this point in the history
upd: README and LEEME file with small icons and links to the currento
supported Godot versions for Popochiu 2 and the Discord server.
fix: Camera zoom was calling a typo method.
upd: New audio stream players are created during runtime if the system
runs out of them.
  • Loading branch information
mapedorr committed Oct 24, 2023
1 parent 136fea8 commit 88044a2
Show file tree
Hide file tree
Showing 52 changed files with 507 additions and 50 deletions.
6 changes: 5 additions & 1 deletion LEEME.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
### 🌎 [Read this in English](./README.md) 🌎
# Popochiu 2

[![Godot v4.0.x](https://img.shields.io/badge/Godot-4.0.x-blue)](https://godotengine.org/download/archive/4.0.4-stable/) [![Godot v4.1.x](https://img.shields.io/badge/Godot-4.1.x-blue)](https://godotengine.org/download) [![Discord](https://img.shields.io/discord/1128222869898416182?label=Discord&logo=discord&logoColor=ffffff&labelColor=5865F2&color=5865F2)](https://discord.gg/Frv8C9Ters)

![cover](https://github.com/mapedorr/popochiu/wiki/images/popochiu_2_hero-es.png "Popochiu")

Un plugin para Godot que permite crear juegos de aventura gráfica con un flujo de trabajo como el de [Adventure Game Studio](https://www.adventuregamestudio.co.uk/) y [PowerQuest](https://powerhoof.itch.io/powerquest).

### 🌎 [Read this in English](./README.md) 🌎

---

🔍 Lee la [Documentación](https://github.com/mapedorr/popochiu/wiki) (en progreso) para conocer lo que puedes hacer con el plugin.
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
### 🌎 [Lee la versión en Español](./LEEME.md) 🌎
# Popochiu 2

[![Godot v4.0.x](https://img.shields.io/badge/Godot-4.0.x-blue)](https://godotengine.org/download/archive/4.0.4-stable/) [![Godot v4.1.x](https://img.shields.io/badge/Godot-4.1.x-blue)](https://godotengine.org/download) [![Discord](https://img.shields.io/discord/1128222869898416182?label=Discord&logo=discord&logoColor=ffffff&labelColor=5865F2&color=5865F2)](https://discord.gg/Frv8C9Ters)

![cover](https://github.com/mapedorr/popochiu/wiki/images/popochiu_2_hero-en.png "Popochiu")

A Godot plugin to create point n' click games with a workflow similar to [Adventure Game Studio](https://www.adventuregamestudio.co.uk/) and [PowerQuest](https://powerhoof.itch.io/powerquest).

### 🌎👉🏽 [Lee la versión en Español](./LEEME.md) 👈🏽🌎

---

🔍 Read the [Documentation](https://github.com/mapedorr/popochiu/wiki) to know what you can do with the plugin.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ func _parse_navigation_polygon_instance(object: Object) -> void:

func _back_to_walkable_area(object: Object) -> void:
if not object.get_parent() is PopochiuWalkableArea: return
ei.edit_node(object.get_parent())
PopochiuUtils.select_node(object.get_parent())
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ func _menu_item_pressed(id: int) -> void:
prop.set_script(script)

main_dock.ei.save_scene()
main_dock.ei.edit_node(prop)
PopochiuUtils.select_node(prop)
main_dock.ei.select_file(script_path)

# Update this row properties and state
Expand Down
6 changes: 2 additions & 4 deletions addons/popochiu/editor/main_dock/tab_room.gd
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ func _select_in_tree(por: PopochiuObjectRow) -> void:
var node := opened_room.get_node('%s/%s'\
% [_types[por.type].parent, por.node_path])

main_dock.ei.get_selection().clear()
main_dock.ei.get_selection().add_node(node)
PopochiuUtils.select_node(node)

_last_selected = por

Expand Down Expand Up @@ -343,8 +342,7 @@ func _on_character_seleced(id: int) -> void:
instance.owner = opened_room

main_dock.ei.save_scene()
main_dock.ei.get_selection().clear()
main_dock.ei.get_selection().add_node(instance)
PopochiuUtils.select_node(instance)


func _create_row_in_dock(type_id: int, child: Node) -> PopochiuObjectRow:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func _create() -> void:
# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
# Abrir las propiedades del hotspot creado en el Inspector
await get_tree().create_timer(0.1).timeout
_main_dock.ei.edit_node(hotspot)
PopochiuUtils.select_node(hotspot)

# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
# Fin
Expand Down
3 changes: 1 addition & 2 deletions addons/popochiu/editor/popups/create_prop/create_prop.gd
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ func _create() -> void:
# Abrir las propiedades de la prop creada en el Inspector
_main_dock.fs.scan()
await get_tree().create_timer(0.1).timeout
_main_dock.ei.get_selection().clear()
_main_dock.ei.get_selection().add_node(prop_instance)
PopochiuUtils.select_node(prop_instance)
_main_dock.ei.select_file(_new_prop_path + '.tscn')

# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func _create() -> void:
# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
# Abrir las propiedades de la región creada en el Inspector
await get_tree().create_timer(0.1).timeout
_main_dock.ei.edit_node(region)
PopochiuUtils.select_node(region)

# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
# Fin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func _create() -> void:
# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
# Abrir las propiedades de la walkable area creada en el Inspector
await get_tree().create_timer(0.1).timeout
_main_dock.ei.edit_node(walkable_area)
PopochiuUtils.select_node(walkable_area)

# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
# Fin
Expand Down
41 changes: 24 additions & 17 deletions addons/popochiu/engine/audio_manager/audio_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ extends Node
class_name PopochiuAudioManager
@warning_ignore("return_value_discarded")

const TEMP_PLAYER := "temporal"
const AudioCue := preload('audio_cue.gd')

var twelfth_root_of_two := pow(2, (1.0 / 12))
Expand Down Expand Up @@ -203,8 +204,9 @@ func _play(
player = _get_free_stream($Positional)

if not is_instance_valid(player):
printerr('[Popochiu] Run out of AudioStreamPlayer2D')
return null
player = AudioStreamPlayer2D.new()
player.set_meta(TEMP_PLAYER, true)
$Active.add_child(player)

(player as AudioStreamPlayer2D).stream = cue.audio
(player as AudioStreamPlayer2D).pitch_scale = cue.get_pitch_scale()
Expand All @@ -215,8 +217,9 @@ func _play(
player = _get_free_stream($Generic)

if not is_instance_valid(player):
printerr('[Popochiu] Run out of AudioStreamPlayer')
return null
player = AudioStreamPlayer.new()
player.set_meta(TEMP_PLAYER, true)
$Active.add_child(player)

(player as AudioStreamPlayer).stream = cue.audio
(player as AudioStreamPlayer).pitch_scale = cue.get_pitch_scale()
Expand All @@ -226,7 +229,9 @@ func _play(

player.bus = cue.bus
player.play(from_position)
player.finished.connect(_make_available.bind(player, cue_name, 0))

if not player.finished.is_connected(_make_available):
player.finished.connect(_make_available.bind(player, cue_name, 0))

if _active.has(cue_name):
_active[cue_name].players.append(player)
Expand All @@ -243,24 +248,27 @@ func _get_free_stream(group: Node):
return _reparent(group, $Active, 0)


# Reassigns the AudioStreamPlayer to its original group when it finishes so it
# can be available for being used
## Reassigns the AudioStreamPlayer to its original group when it finishes so it
## can be available for being used
func _make_available(
stream_player: Node, cue_name: String, _debug_idx: int
) -> void:
if stream_player is AudioStreamPlayer:
if stream_player.has_meta(TEMP_PLAYER):
stream_player.queue_free()
elif stream_player is AudioStreamPlayer:
_reparent($Active, $Generic, stream_player.get_index())
else:
_reparent($Active, $Positional, stream_player.get_index())

var players: Array = _active[cue_name].players
for idx in players.size():
if players[idx].get_instance_id() == stream_player.get_instance_id():
players.remove_at(idx)
break
if _active.has(cue_name):
var players: Array = _active[cue_name].players
for idx in players.size():
if players[idx].get_instance_id() == stream_player.get_instance_id():
players.remove_at(idx)
break

if players.is_empty():
_active.erase(cue_name)
if players.is_empty():
_active.erase(cue_name)

if not stream_player.finished.is_connected(_make_available):
stream_player.finished.connect(_make_available)
Expand All @@ -272,8 +280,7 @@ func _reparent(source: Node, target: Node, child_idx: int) -> Node:

var node_to_reparent: Node = source.get_child(child_idx)

source.remove_child(node_to_reparent)
target.add_child(node_to_reparent)
node_to_reparent.reparent(target)

return node_to_reparent

Expand Down
7 changes: 7 additions & 0 deletions addons/popochiu/engine/others/popochiu_utils.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
extends Node
class_name PopochiuUtils

static var ei: EditorInterface = null


static func get_screen_coords_for(node: Node) -> Vector2:
return node.get_viewport().canvas_transform * node.get_global_position()
Expand Down Expand Up @@ -36,3 +38,8 @@ static func override_font(node: Control, font_name: String, font: Font) -> void:

static func print_error(msg: String) -> void:
print_rich("[color=red][Popochiu] %s[/color]" % msg)


static func select_node(node: Node) -> void:
ei.get_selection().clear()
ei.get_selection().add_node(node)
2 changes: 1 addition & 1 deletion addons/popochiu/engine/popochiu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ func queue_camera_zoom(target := Vector2.ONE, duration := 1.0) -> Callable:
# will zoom out, smaller values make it zoom in. The effect will last `duration`
# seconds
func camera_zoom(target := Vector2.ONE, duration := 1.0) -> void:
if is_instance_valid(_tween) and _tween.isplaying_queue():
if is_instance_valid(_tween) and _tween.is_running():
_tween.kill()

_tween = create_tween()
Expand Down
1 change: 1 addition & 0 deletions addons/popochiu/popochiu_plugin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func _enter_tree() -> void:
main_dock.ei = _editor_interface
main_dock.fs = _editor_file_system
main_dock.focus_mode = Control.FOCUS_ALL
PopochiuUtils.ei = _editor_interface

add_control_to_dock(DOCK_SLOT_RIGHT_BL, main_dock)

Expand Down
8 changes: 7 additions & 1 deletion default_bus_layout.tres
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,11 @@ bus/2/name = &"Effects"
bus/2/solo = false
bus/2/mute = false
bus/2/bypass_fx = false
bus/2/volume_db = 0.0
bus/2/volume_db = -2.11252
bus/2/send = &"Master"
bus/3/name = &"Ambience"
bus/3/solo = false
bus/3/mute = false
bus/3/bypass_fx = false
bus/3/volume_db = -12.9785
bus/3/send = &"Master"
9 changes: 9 additions & 0 deletions popochiu/autoloads/a.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,14 @@ extends "res://addons/popochiu/engine/interfaces/i_audio.gd"
# cues ----
var mx_house: AudioCueMusic = load("res://popochiu/rooms/house/audio/mx_house.tres")
var vo_goddiu_01: AudioCueSound = load("res://popochiu/characters/goddiu/audio/vo_goddiu_01.tres")
var sfx_blanket: AudioCueSound = load("res://popochiu/rooms/house/audio/sfx_blanket.tres")
var sfx_door_close: AudioCueSound = load("res://popochiu/rooms/house/audio/sfx_door_close.tres")
var sfx_door_open: AudioCueSound = load("res://popochiu/rooms/house/audio/sfx_door_open.tres")
var sfx_drawer_close: AudioCueSound = load("res://popochiu/rooms/house/audio/sfx_drawer_close.tres")
var sfx_drawer_open: AudioCueSound = load("res://popochiu/rooms/house/audio/sfx_drawer_open.tres")
var sfx_key: AudioCueSound = load("res://popochiu/rooms/house/audio/sfx_key.tres")
var sfx_toy_car: AudioCueSound = load("res://popochiu/rooms/house/audio/sfx_toy_car.tres")
var sfx_astral_plane: AudioCueSound = load("res://popochiu/rooms/house/audio/sfx_astral_plane.tres")
var sfx_window: AudioCueSound = load("res://popochiu/rooms/house/audio/sfx_window.tres")
# ---- cues

3 changes: 2 additions & 1 deletion popochiu/characters/popsy/character_popsy.gd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ func _on_room_set() -> void:

# When the node is clicked
func _on_click() -> void:
D.ChatWithPopsy.start()
A.vo_goddiu_01.play()
# D.ChatWithPopsy.start()


# When the node is right clicked
Expand Down
1 change: 1 addition & 0 deletions popochiu/popochiu_data.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ House="res://popochiu/rooms/house/room_house.tres"

mx_cues=["res://popochiu/rooms/house/audio/mx_house.tres"]
vo_cues=["res://popochiu/characters/goddiu/audio/vo_goddiu_01.tres"]
sfx_cues=["res://popochiu/rooms/house/audio/sfx_astral_plane.tres", "res://popochiu/rooms/house/audio/sfx_blanket.tres", "res://popochiu/rooms/house/audio/sfx_door_close.tres", "res://popochiu/rooms/house/audio/sfx_door_open.tres", "res://popochiu/rooms/house/audio/sfx_drawer_close.tres", "res://popochiu/rooms/house/audio/sfx_drawer_open.tres", "res://popochiu/rooms/house/audio/sfx_key.tres", "res://popochiu/rooms/house/audio/sfx_toy_car.tres", "res://popochiu/rooms/house/audio/sfx_window.tres"]
2 changes: 1 addition & 1 deletion popochiu/rooms/house/audio/mx_house.tres
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ rnd_pitch = Vector2(0, 0)
rnd_volume = Vector2(0, 0)
max_distance = 2000
attenuation = 1.0
bus = "Master"
bus = "Music"
Binary file added popochiu/rooms/house/audio/sfx_astral_plane.ogg
Binary file not shown.
19 changes: 19 additions & 0 deletions popochiu/rooms/house/audio/sfx_astral_plane.ogg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[remap]

importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://dp8damknakblr"
path="res://.godot/imported/sfx_astral_plane.ogg-aaabc85401762bd36c1488c4af83729f.oggvorbisstr"

[deps]

source_file="res://popochiu/rooms/house/audio/sfx_astral_plane.ogg"
dest_files=["res://.godot/imported/sfx_astral_plane.ogg-aaabc85401762bd36c1488c4af83729f.oggvorbisstr"]

[params]

loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4
18 changes: 18 additions & 0 deletions popochiu/rooms/house/audio/sfx_astral_plane.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[gd_resource type="Resource" script_class="AudioCueSound" load_steps=3 format=3 uid="uid://mi8uc2ehj0o6"]

[ext_resource type="AudioStream" uid="uid://dp8damknakblr" path="res://popochiu/rooms/house/audio/sfx_astral_plane.ogg" id="1_nkae1"]
[ext_resource type="Script" path="res://addons/popochiu/engine/audio_manager/audio_cue_sound.gd" id="2_ddumh"]

[resource]
resource_name = "sfx_astral_plane"
script = ExtResource("2_ddumh")
audio = ExtResource("1_nkae1")
loop = false
is_2d = false
pitch = 1.0
volume = 0.0
rnd_pitch = Vector2(0, 0)
rnd_volume = Vector2(0, 0)
max_distance = 2000
attenuation = 1.0
bus = "Ambience"
Binary file added popochiu/rooms/house/audio/sfx_blanket.ogg
Binary file not shown.
19 changes: 19 additions & 0 deletions popochiu/rooms/house/audio/sfx_blanket.ogg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[remap]

importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://urp0myuuri3u"
path="res://.godot/imported/sfx_blanket.ogg-7fc83bd154afebe540fed76c9ad51eb5.oggvorbisstr"

[deps]

source_file="res://popochiu/rooms/house/audio/sfx_blanket.ogg"
dest_files=["res://.godot/imported/sfx_blanket.ogg-7fc83bd154afebe540fed76c9ad51eb5.oggvorbisstr"]

[params]

loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4
18 changes: 18 additions & 0 deletions popochiu/rooms/house/audio/sfx_blanket.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[gd_resource type="Resource" script_class="AudioCueSound" load_steps=3 format=3 uid="uid://d17cfqw2cgaaf"]

[ext_resource type="AudioStream" uid="uid://urp0myuuri3u" path="res://popochiu/rooms/house/audio/sfx_blanket.ogg" id="1_8isrw"]
[ext_resource type="Script" path="res://addons/popochiu/engine/audio_manager/audio_cue_sound.gd" id="2_8v83t"]

[resource]
resource_name = "sfx_blanket"
script = ExtResource("2_8v83t")
audio = ExtResource("1_8isrw")
loop = false
is_2d = false
pitch = 1.0
volume = 0.0
rnd_pitch = Vector2(0, 0)
rnd_volume = Vector2(0, 0)
max_distance = 2000
attenuation = 1.0
bus = "Master"
Binary file added popochiu/rooms/house/audio/sfx_door_close.ogg
Binary file not shown.
19 changes: 19 additions & 0 deletions popochiu/rooms/house/audio/sfx_door_close.ogg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[remap]

importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://cuf30qpn8higl"
path="res://.godot/imported/sfx_door_close.ogg-b0d9b3f238bc2f462685eef6e327acee.oggvorbisstr"

[deps]

source_file="res://popochiu/rooms/house/audio/sfx_door_close.ogg"
dest_files=["res://.godot/imported/sfx_door_close.ogg-b0d9b3f238bc2f462685eef6e327acee.oggvorbisstr"]

[params]

loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4
18 changes: 18 additions & 0 deletions popochiu/rooms/house/audio/sfx_door_close.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[gd_resource type="Resource" script_class="AudioCueSound" load_steps=3 format=3 uid="uid://y4x0irynpxyk"]

[ext_resource type="AudioStream" uid="uid://cuf30qpn8higl" path="res://popochiu/rooms/house/audio/sfx_door_close.ogg" id="1_65bhf"]
[ext_resource type="Script" path="res://addons/popochiu/engine/audio_manager/audio_cue_sound.gd" id="2_wf4ln"]

[resource]
resource_name = "sfx_door_close"
script = ExtResource("2_wf4ln")
audio = ExtResource("1_65bhf")
loop = false
is_2d = false
pitch = 1.0
volume = 0.0
rnd_pitch = Vector2(0, 0)
rnd_volume = Vector2(0, 0)
max_distance = 2000
attenuation = 1.0
bus = "Effects"
Binary file added popochiu/rooms/house/audio/sfx_door_open.ogg
Binary file not shown.
Loading

0 comments on commit 88044a2

Please sign in to comment.