|
|
|
|
Reply From: |
rolfpancake |
The points you mentioned are perfectly doable with Godot. I can totally recommend using it because building a working prototype with the functions you need wouldn’t take too much time. I used python a lot to prototype scientific apps but when it comes to GUI things are getting messy.
Regarding your specific points:
csv files logging
Write a function converting a row of data into csv-format (e.g. sometimes it is needed to convert .
to ,
in float numbers and then ,
to ;
for seperating entries). Then you can use the same technique which is used to create save-games:
func to_csv(content):
... # add some logic here
return csv_formatted_content
func log_to_file(logfile_path, content_table):
var logfile = File.new()
logfile.open(logfile_path, File.WRITE)
for row in content_table:
logfile.store_line(to_csv(row))
logfile.close()
frequency of button presses
Use signals or define your own button logic. There are countless possibilites.
onready var button_xyz = get_node("button_xyz")
onready var button_xyz_pressed_amount = 0
func _ready():
button_xyz.connect("pressed", self, "_on_button_xyz_pressed")
func _on_button_xyz_pressed():
button_xyz_pressed_amount += 1
response time (in ms)
Create a timer. Set wait_time
to 0.001.
onready var timer = get_node("timer")
onready var reaction_button = get_node("reaction_button")
onready var time = 0
func _ready():
timer.connect("timeout", self, "_on_timer_timeout")
reaction_button.connect("pressed", self, "_on_reaction_button_pressed")
timer.start()
func _on_reaction_button_pressed():
timer.stop()
print(time)
func _on_timer_timeout():
time += wait_time
xy cursor coordinates
You can use the input-events or ask the viewport for mouse coordinates.
func _input(event):
print(event.position)
Wow man! Thank you so much, I have coded some experiment in python and I totally agree with you regarding the GUI (which is why I’ve been wondering about this alternative). I really appreciate your taking the time to answer my query and the very, very useful details, you’re a good lad!
You are welcome. If you get any trouble building your application don’t hesitate to ask here again.
And if you are actually using Godot for science stuff, let the people on Reddit/Twitter/Facebook know. They like awesome stuff like that
rolfpancake | 2018-02-19 23:27
Hi
It’s really nice to find only one post regarding this query. Please share your experiences regarding logging for research purposes, also any developments and problems/solutions you faced/found. It will be really helpful as I am also trying to extract data (coordinates, moves, clicks etc) from a board game so that it can be used for research purposes.