pastra98 / NEAT_for_Godot

An implementation of Kenneth O. Stanley's NEAT Algorithm for the Godot game engine, written in gdscript.
MIT License
36 stars 9 forks source link

fix case for some res:// paths #1

Closed saurus closed 4 years ago

saurus commented 4 years ago

Hi, trying to run this (awesome!) project on Linux, I got some problems caused by case-sensitive file system, so the resource names must be written exactly as the file names.

fortunately, with just a few changes, this project works on Linux like a charm!

I also wrote a small and hacky script to check resource names.

Thanks!

pastra98 commented 4 years ago

Awesome, thank you so much for your contribution! The shell script looks quite handy :)

If you have any troubles or questions, be sure to let me know. Yesterday I finally started working on this project again, and I'm currently making some changes to the NEAT_code files in a local branch. My goal currently is to get the XOR performance close to what the neat-python library offers, but I'm having troubles understanding their code haha.

pastra98 commented 4 years ago

@saurus I'm still a greenhorn regarding the magic of unix tools and regular expressions, so I honestly don't understand most of your script. I tried running it in WSL first using sh wich got me:

Syntax error: end of file unexpected (expecting "done")

and then using bash i got:

`syntax error: unexpected end of file``.

If it's just a WSL thing we can ignore it. I just wanted to test it because I'd like to move the script out of /src and into the root of the repository.

saurus commented 4 years ago

Hi, sadly I don't have a WSL enabled windows computer readily available... I will try to find one.

Given the error, it seems the problem lies in the while loop. you may try to split in lines:

fgrep -r "res://" . | sed -e 's+^\([^:]*\):.*res://\([^\\"]*\)[\\"].*$+\1 \2+g' | while read f l; do
    [ -f "$l" ] || echo missing "$l" in "$f"
done

another handy way to debug the shell scripts, is to change the first line to:

#!/bin/bash -x

with this change, running the program will output every line before executing.

pastra98 commented 4 years ago

Just tested it in my elementaryOS installation, seems to work fine. I don't think it's worth bothering with WSL, maybe I'll do a python script someday to check naming. However I'd like to move this file to the root directory of the repository, should there be any changes made to it?

saurus commented 4 years ago

it should be pretty easy: just change the '.' (dot) in the fgrep command with 'src':

fgrep -r "res://" . --> fgrep -r "res://" src

if you prefer, I can create a new pull request moving the file and changing it, but maybe you want to play a bit by yourself... just let me know which way is best for you!

pastra98 commented 4 years ago

Nice, I changed it. Thanks for helping out!