From 379b2b27bcfd340e224e39ae283eaf582e92e464 Mon Sep 17 00:00:00 2001 From: chimchooree Date: Thu, 1 Sep 2022 14:00:39 -0500 Subject: [PATCH] grid push --- src/diary/entries/220811 | 112 -------------------------- src/diary/entries/220831 | 14 ++++ src/diary/{entries => hold}/220728 | 0 src/diary/hold/220811 | 123 +++++++++++++++++++---------- src/diary/{entries => hold}/220825 | 0 src/diary/{entries => hold}/220908 | 0 src/diary/{entries => hold}/220922 | 0 src/diary/{entries => hold}/221006 | 0 src/diary/{entries => hold}/221020 | 0 src/views/requirements.tpl | 118 +++++++++++++++++++++++++++ 10 files changed, 213 insertions(+), 154 deletions(-) delete mode 100644 src/diary/entries/220811 create mode 100644 src/diary/entries/220831 rename src/diary/{entries => hold}/220728 (100%) rename src/diary/{entries => hold}/220825 (100%) rename src/diary/{entries => hold}/220908 (100%) rename src/diary/{entries => hold}/220922 (100%) rename src/diary/{entries => hold}/221006 (100%) rename src/diary/{entries => hold}/221020 (100%) create mode 100644 src/views/requirements.tpl diff --git a/src/diary/entries/220811 b/src/diary/entries/220811 deleted file mode 100644 index 3d059c4..0000000 --- a/src/diary/entries/220811 +++ /dev/null @@ -1,112 +0,0 @@ - -

coroutines in godot engine

-august 11, 2022
-#gamedev #coroutines #godotengine #programming #demo
-
-

Demonstrating coroutines in Godot Engine with a simple application.

-(screenshot: a simple tech demo with a stoplight and a walk button.)
-
-

defining coroutines

-

Coroutines are functions that, instead of running to completion, yield until certain criteria are met. Godot Engine supports coroutines through yield(), resume(), and the GDScriptFunctionState object.

-
-

why use a coroutine?

-

Coroutines allow for scripted game scenarios that respond dynamically to the player and the changing game world. They let you bounce between functions, step-by-step, and respond to interruptions. This means functions can be automatically called at the completion of other functions, animations, player actions, in-game events, or timers. Add in interruptions and conditionals, and you have a tool for building a responsive game world.

-
-

stoplight example

-

As a simple demonstration, I made a stoplight. Follow along with my code on GitLab.

-
-

The light changes every few seconds, going from green, yellow, then red. The light changes immediately if the walk button is pressed. This demonstrates that methods can wait for criteria (a timed duration in this case) to be met before resuming, and they can be influenced by player action.

-
- - (gif: demonstration) -
-
-

how is it written?

-

node hierarchy

-(screenshot: node hierarchy in the editor. Root is a node named Main. It's children are TextureRect BG, AnimatedSprite Stoplight, Sprite WalkButton, and a Label. Stoplight's child is a Sprite. WalkButton's child is a TextureButton.)
-

I have a TextureRect background, an AnimatedSprite stoplight, a Sprite walk button with a TextureButton, and a label for displaying a timer. Most of the code is attached to the root. It's better to have code closer to where it's being used and to mind your separation of concerns in real projects, though.

-
-

animation

-(image: the AnimatedSprite Stoplight has 4 animations - default (which is no light), green, red, and yellow.)
-

The light is changed by setting its animation to one of these options. Each is one-frame - just the stoplight with the one or none of the lights colored in.

-

the code

-This project has two scripts: Main.gd, which is attached to the root node, and Label.gd, which is attached to the Label.
-
-

Main.gd - available on GitLab

-
extends Node
-
-onready var stoplight = $Stoplight
-
-func _ready():
-	stoplight.play()
-
-	var result = wait(5, 'green')
-	$WalkButton/TextureButton.connect('pressed', result, 'resume', 
-		['interrupted on green'], CONNECT_ONESHOT)
-	yield(result, 'completed')
-
-	result = wait(5, 'yellow')
-	$WalkButton/TextureButton.connect('pressed', result, 'resume', 
-		['interrupted on yellow'], CONNECT_ONESHOT)
-	yield(result, 'completed')
-	
-	result = wait(5, 'red')
-	$WalkButton/TextureButton.connect('pressed', result, 'resume', 
-		['interrupted on red'], CONNECT_ONESHOT)
-	yield(result, 'completed')
-
-func wait(time, color):
-	print('waiting for: ' + color)
-	var result = yield(get_tree().create_timer(time), 'timeout')
-	if result:
-		print(result)
-	stoplight.animation = color
-	print('done: ' + color)
-
-func _on_completed():
-	print('completed')
-
-func _on_WalkButton_gui_input(event):
-	if event is InputEventMouseButton and event.pressed:
-		print ("Walk Button not functioning.")

-
-

Label.gd - available on GitLab

-
extends Label
-var time_start = 0
-var time_now = 0
-
-func _ready():
-	time_start = OS.get_unix_time()
-	set_process(true)
-
-func _process(delta):
-	time_now = OS.get_unix_time()
-	var elapsed = time_now - time_start
-	var minutes = elapsed / 60
-	var seconds = elapsed % 60
-	var str_elapsed = "%02d" % [seconds]
-	text = str(str_elapsed)

-
-

how does it work?

-

At _ready(), wait() is assigned to the GDScriptFunctionState result and is called for the first color, green. _ready() yields until wait() is completed.

-
-

The wait method yields for the given amount of seconds then sets the stoplight to the given color.

-
-

At wait()'s completion, _ready() calls wait() for yellow, then red. Each is called one at a time, waiting for the color to complete before moving on.

-
-

interrupting the stoplight

-

The Wait Button interrupts the wait times between colors. Before _ready() yields, it connects the 'pressed' signal on the Wait Button.

-
-

If the Wait Button is clicked during wait()'s yield, the GDScriptFunctionState result resumes immediately, ignoring wait()'s yield timer. This time, result has a string arg "interrupted on green," so it will print the result, change the stoplight's color, then print "done: green." The wait method is complete, so _ready() resumes and calls wait() for the next color.

-
-

play it yourself

-
-
-

applications

-

The outcomes in this example can be swapped out with anything. I use coroutines in Blessfrey's skills to manage the flow of phases from activation, different phases of effects, cooldown, and interactions with any counters. I also use it in the basic weapon attack so the character continuously swings at the rate of his attack speed until he cancels, uses a skill, or moves. It could also be used for something like cars that stop and honk when the player walks in front of them then drive off once the path is clear. Anything influenced by other entities is a good coroutine candidate.

-
-

Coroutines enable practical ways to improve the flow and interactivity of games, so practice the concept a lot!

-
-
-Last updated July 31, 2022
-
diff --git a/src/diary/entries/220831 b/src/diary/entries/220831 new file mode 100644 index 0000000..5fb525e --- /dev/null +++ b/src/diary/entries/220831 @@ -0,0 +1,14 @@ + +

blessfrey.me under construction

+august 31, 2022
+#webdev
+
+The website doesn't look how I want it yet!
+
+

working on it

+
+Iterating over the website again. Lots of placeholder pages are up, but few are close to my current plan. This version will be better than ever, with embedded HTML5 applications, a content mix planned for articles, and more artwork.
+
+
+Last updated August 31, 2022
+
diff --git a/src/diary/entries/220728 b/src/diary/hold/220728 similarity index 100% rename from src/diary/entries/220728 rename to src/diary/hold/220728 diff --git a/src/diary/hold/220811 b/src/diary/hold/220811 index f6be89e..3d059c4 100644 --- a/src/diary/hold/220811 +++ b/src/diary/hold/220811 @@ -1,73 +1,112 @@ - +

coroutines in godot engine

-september 17, 2020
-#coroutines #godot #programming
+august 11, 2022
+#gamedev #coroutines #godotengine #programming #demo

-Coroutines are functions that, instead of running to completion, can yield until certain criteria are met. Godot Engine supports coroutines through yield ( Object object=null, String signal=""), resume, and the GDScriptFunctionState object.
+

Demonstrating coroutines in Godot Engine with a simple application.

+(screenshot: a simple tech demo with a stoplight and a walk button.)

-

why use a coroutine?

+

defining coroutines

+

Coroutines are functions that, instead of running to completion, yield until certain criteria are met. Godot Engine supports coroutines through yield(), resume(), and the GDScriptFunctionState object.


-Coroutines allow for scripted game scenarios that respond dynamically to the player and the changing game world. They let you bounce between functions, step-by-step, and respond to interruptions. This means functions can be automatically called at the completion of other functions, animations, player actions, in-game events, or timers. Add in interruptions and conditionals, and you have a tool for building a responsive game world.
+

why use a coroutine?

+

Coroutines allow for scripted game scenarios that respond dynamically to the player and the changing game world. They let you bounce between functions, step-by-step, and respond to interruptions. This means functions can be automatically called at the completion of other functions, animations, player actions, in-game events, or timers. Add in interruptions and conditionals, and you have a tool for building a responsive game world.


stoplight example

+

As a simple demonstration, I made a stoplight. Follow along with my code on GitLab.


-As a basic example of coroutines in Godot Engine, I made a stoplight. Follow along with my code on GitLab.
-
-In my example, the light changes every few seconds, going from green, yellow, then finally red. The light changes immediately if the Walk Button is pressed. This project demonstrates methods that can wait, resume, and be affected through player action.
+

The light changes every few seconds, going from green, yellow, then red. The light changes immediately if the walk button is pressed. This demonstrates that methods can wait for criteria (a timed duration in this case) to be met before resuming, and they can be influenced by player action.


-
(gif: demonstration)
-
-
-

how does it work?


+

how is it written?

node hierarchy

-
-(image: node hierarchy - Root is a node named Main. It's children are TextureRect BG, AnimatedSprite Stoplight, Sprite WalkButton, and a Label. Stoplight's child is a Sprite. WalkButton's child is a TextureButton.)
-
-
-I have a TextureRect background, an AnimatedSprite stoplight, a Sprite walk button with a TextureButton, and a label for displaying a timer. Since this is a simple example, most of the code is attached to the root. It's better to have code closer to where it's being used and to watch your separation of concerns in real projects, though.
+(screenshot: node hierarchy in the editor. Root is a node named Main. It's children are TextureRect BG, AnimatedSprite Stoplight, Sprite WalkButton, and a Label. Stoplight's child is a Sprite. WalkButton's child is a TextureButton.)
+

I have a TextureRect background, an AnimatedSprite stoplight, a Sprite walk button with a TextureButton, and a label for displaying a timer. Most of the code is attached to the root. It's better to have code closer to where it's being used and to mind your separation of concerns in real projects, though.


animation

-
-
(image: the AnimatedSprite Stoplight has 4 animations - default (which is no light), green, red, and yellow.)
-

-The light is changed by setting its animation to one of these options. Each is one-frame - just the stoplight with the one or none of the lights colored in.
+

The light is changed by setting its animation to one of these options. Each is one-frame - just the stoplight with the one or none of the lights colored in.

the code

-
This project has two scripts: Main.gd, which is attached to the root node, and Label.gd, which is attached to the Label.

-Main.gd - code available on GitLab
-
-(image: Main script.)
-
-
-Label.gd - code available on GitLab
-
-(image: Label script.)
-
+

Main.gd - available on GitLab

+
extends Node
+
+onready var stoplight = $Stoplight
+
+func _ready():
+	stoplight.play()
+
+	var result = wait(5, 'green')
+	$WalkButton/TextureButton.connect('pressed', result, 'resume', 
+		['interrupted on green'], CONNECT_ONESHOT)
+	yield(result, 'completed')
+
+	result = wait(5, 'yellow')
+	$WalkButton/TextureButton.connect('pressed', result, 'resume', 
+		['interrupted on yellow'], CONNECT_ONESHOT)
+	yield(result, 'completed')
+	
+	result = wait(5, 'red')
+	$WalkButton/TextureButton.connect('pressed', result, 'resume', 
+		['interrupted on red'], CONNECT_ONESHOT)
+	yield(result, 'completed')
+
+func wait(time, color):
+	print('waiting for: ' + color)
+	var result = yield(get_tree().create_timer(time), 'timeout')
+	if result:
+		print(result)
+	stoplight.animation = color
+	print('done: ' + color)
+
+func _on_completed():
+	print('completed')
+
+func _on_WalkButton_gui_input(event):
+	if event is InputEventMouseButton and event.pressed:
+		print ("Walk Button not functioning.")

+
+

Label.gd - available on GitLab

+
extends Label
+var time_start = 0
+var time_now = 0
+
+func _ready():
+	time_start = OS.get_unix_time()
+	set_process(true)
+
+func _process(delta):
+	time_now = OS.get_unix_time()
+	var elapsed = time_now - time_start
+	var minutes = elapsed / 60
+	var seconds = elapsed % 60
+	var str_elapsed = "%02d" % [seconds]
+	text = str(str_elapsed)


-

how the code works

-
-At _ready(), wait() is assigned to the GDScriptFunctionState result and is called for the first color, green. _ready() yields until the given function wait() is completed.
+

how does it work?

+

At _ready(), wait() is assigned to the GDScriptFunctionState result and is called for the first color, green. _ready() yields until wait() is completed.


-The wait method yields for the given amount of seconds then sets the stoplight to the given color.
+

The wait method yields for the given amount of seconds then sets the stoplight to the given color.


-At wait()'s completion, _ready() calls wait() for yellow, then red. Each is called one at a time, waiting for the color to complete before moving on.
+

At wait()'s completion, _ready() calls wait() for yellow, then red. Each is called one at a time, waiting for the color to complete before moving on.


interrupting the stoplight

+

The Wait Button interrupts the wait times between colors. Before _ready() yields, it connects the 'pressed' signal on the Wait Button.

+
+

If the Wait Button is clicked during wait()'s yield, the GDScriptFunctionState result resumes immediately, ignoring wait()'s yield timer. This time, result has a string arg "interrupted on green," so it will print the result, change the stoplight's color, then print "done: green." The wait method is complete, so _ready() resumes and calls wait() for the next color.


-The Wait Button interrupts the wait times between colors. Before _ready() yields, it connects the 'pressed' signal on the Wait Button.
-If the Wait Button is clicked during wait()'s yield, the GDScriptFunctionState result resumes immediately, ignoring wait()'s yield timer. This time, result has a string arg 'interrupted on green', so it will print the result, change the stoplight's color, then print 'done: green'. The wait method is complete, so _ready() resumes and calls wait() for the next color.
+

play it yourself

+

applications

+

The outcomes in this example can be swapped out with anything. I use coroutines in Blessfrey's skills to manage the flow of phases from activation, different phases of effects, cooldown, and interactions with any counters. I also use it in the basic weapon attack so the character continuously swings at the rate of his attack speed until he cancels, uses a skill, or moves. It could also be used for something like cars that stop and honk when the player walks in front of them then drive off once the path is clear. Anything influenced by other entities is a good coroutine candidate.


-The outcomes in this example can be swapped out with anything. I use coroutines in Blessfrey's skills to manage the flow of phases from activation, different phases of effects, cooldown, and interactions with any counters. I also use it in the basic weapon attack so the character continuously swings at the rate of his attack speed until he cancels, uses a skill, or moves. It could also be used for something like cars that stop and honk when the player walks in front of them then drive off once the path is clear.
+

Coroutines enable practical ways to improve the flow and interactivity of games, so practice the concept a lot!


-Coroutines enable lots of practical ways to improve the flow and interactivity of your game, so just keep experimenting.

-Last updated June 8, 2021
+Last updated July 31, 2022

diff --git a/src/diary/entries/220825 b/src/diary/hold/220825 similarity index 100% rename from src/diary/entries/220825 rename to src/diary/hold/220825 diff --git a/src/diary/entries/220908 b/src/diary/hold/220908 similarity index 100% rename from src/diary/entries/220908 rename to src/diary/hold/220908 diff --git a/src/diary/entries/220922 b/src/diary/hold/220922 similarity index 100% rename from src/diary/entries/220922 rename to src/diary/hold/220922 diff --git a/src/diary/entries/221006 b/src/diary/hold/221006 similarity index 100% rename from src/diary/entries/221006 rename to src/diary/hold/221006 diff --git a/src/diary/entries/221020 b/src/diary/hold/221020 similarity index 100% rename from src/diary/entries/221020 rename to src/diary/hold/221020 diff --git a/src/views/requirements.tpl b/src/views/requirements.tpl new file mode 100644 index 0000000..d70fdac --- /dev/null +++ b/src/views/requirements.tpl @@ -0,0 +1,118 @@ +% rebase('frame.tpl') +
+
+

+

0.0 - first

+
    +
  • feature: export, embed
  • +
+

0.1 - bingo

+
    +
  • feature: KnowledgeBase - achievements, progression
  • +
  • ~70 new skills
  • +
  • solid, extendable base for skills, keywords, skill equips, DMVs
  • +
  • ignore input during main menu, etc
  • +
  • basic dialog
  • +
  • basic serialization
  • +
  • basic pathfinding
  • +
  • basic AI - states, transitions
  • +
  • basic combat - life, spirit, attack, skills,
  • +
  • item pickup
  • +
  • inventory
  • +
  • interact - character, container
  • +
  • containers
  • +
  • travel between rooms
  • +
  • drop items
  • +
  • inspect
  • +
  • spawnpoints
  • +
  • XP, levels
  • +
  • skillbar - drag & drop, enforces deckbuilding rules
  • +
  • attack loop
  • +
  • skill use - out of range, cancel
  • +
  • +
+

0.2 - AI factions

+
    +
  • feature: factions - disposition towards other factions
  • +
  • pathfinding
  • +
  • teams
  • +
  • death
  • +
  • drop tables
  • +
  • flocking
  • +
  • idle, wander
  • +
  • patrol routes
  • +
  • aggro range
  • +
  • targeting
  • +
  • skill use prioritization
  • +
+

0.3 - boss fight

+
    +
  • feature: multiphase, dynamic boss
  • +
  • obstacles - impermeable walls, permeable walls, opaque walls, transparent walls, destructible walls
  • +
  • boss splash screen
  • +
  • cutscene-like scripting
  • +
  • resurrection
  • +
  • projectiles
  • +
  • only change skill in noncombat rooms
  • +
  • interrupt
  • +
  • items - use to impart keywords
  • +
+

0.4 - job

+
    +
  • feature: 3 basic jobs
  • +
  • side jobs
  • +
  • changing side job
  • +
  • stats - impact skills
  • +
  • perks - impact character
  • +
  • gear - impact incoming keywords
  • +
  • weapons - impact outgoing keywords
  • +
+

0.5 - UI

+
    +
  • feature: phone
  • +
  • codex app
  • +
  • messenging app
  • +
  • inventory app
  • +
  • music app
  • +
  • settings app
  • +
  • store page, functionality
  • +
  • pop-up notifications, tool tips
  • +
  • skill library, skillbar
  • +
  • containers
  • +
  • highlight
  • +
  • main menu, submenus
  • +
  • inspect menu
  • +
  • forms, questionnaires, homework sheets
  • +
  • iron out canvas layer layers
  • +
  • dialog
  • +
+

1.0 - release

+
    +
  • feature: the completed game
  • +
  • full main story
  • +
  • all levels
  • +
  • equipment
  • +
+

??? - overflow

+
    +
  • feature: ideas that haven't been assigned to a release yet. probably not everything can fit into the game by 1.0, if ever
  • +
  • rebindable controls
  • +
  • get input from colorblind people
  • +
  • training dummy - tells you your DPS, inflicted keywords, etc
  • +
  • dialog portraits
  • +
  • emotes
  • +
  • skill SFX
  • +
  • character creation
  • +
  • change phone background
  • +
  • store screenshots in phone gallery
  • +
  • add your own music to music folder, appears in music app. pixelate cover to match-ish game graphics
  • +
  • gear changes sprite appearance
  • +
  • gear changes companions' sprite appearance
  • +
  • gear changes dialog portaits - paper doll
  • +
  • play as a boy
  • +
  • additional languages
  • +
  • teams
  • +
+
+
+