inexorgame-obsolete / deprecated-cube-engine-inexor

UNMAINTAINED: Please have a look at the vulkan-renderer
https://inexor.org
zlib License
12 stars 1 forks source link

InexorFlex: improve code structure to be editable #508

Open a-teammate opened 7 years ago

a-teammate commented 7 years ago

we have the problem that in order to modify our script code a lot of hassle is needed: Issue arises since we want to be more modular than our toolchain allows.

you clone https://github.com/inexorgame/inexor-flex somewhere, lets call it flex-git-folder (or you have it cloned already in the inexor-core/flex subdir) now you want to start to inexor-flex. so you npm install in the flex-git-folder subdirectory. but the pitfall is: the stuff in flex-git-folder/node_modules is not what you have in flex-git-folder/src and flex-git-folder/server!! Sidenote: (why is server not in src anyways??)

No, its the stuff it downloaded from npm.js! So if you modify e.g. flex-git-folder/src/releases/ReleaseManager.js you need to copy that file in flex-git-folder/node_modules/@inexorgame/releases/ then you need to restart inexor-flex to have it working.

The optimal case would be:

and the holy grail would be that its hot-reloading:


Off topic 1: could we maybe find a better name for the inexor-flex API part? i mean: you have 2 windows open:

Fohlen commented 7 years ago

Hey there. SInce there's been a lot of confusion about how to set up Inexor in a developer environment, I'll be going to write down my current workflow, and some explanation

Get it running with reload as a developer

npm un -g @inexorgame/inexor-flex # remove all previously installed occurences of inexor-flex
git clone https://github.com/inexorgame/inexor-flex.git
cd inexor-flex && npm install
npm start # for starting
npm link # if you would like to "globally install" the module. to have it call-able via inexor-flex

Now if you are working on a module, let's say src/releases

cd src/releases
npm link
<- this will override your installation in inexor-flex local AND your global installation

If you're changing a file in the src/ releases folder from now on, it will "live reload", since the module already points at the module you specified.

Source structure

This is quiet simple

a-teammate commented 7 years ago

Thanks Fohlen :)

The mentioned setup does work for me in the slight modification that I have to: npm link @inexorgame/releases in the flex folder after npm linking in the src/releases folder

So maybe we could automate this, since its also hard to remember for each branch which modules you need to link, since theyre different from the lastly released version.


server also contains runtime functionality, such as the path util to determine the paths at runtime

sounds wrong imo, why are the other dependencies not runtime functionality?

so what about renaming the server to inexor-flex and make it use the api module?

The problem i see here is that the daemon "server" is what we call throughout the wiki "Inexor-Flex", but now "inexor-flex" is some command line utility to speak with the daemon in the background, which is "the server" (another server, not to be confused with our grpc server, the gameserver or the masterserver, or ..)

aschaeffer commented 7 years ago

... is some command line utility to speak with the daemon ...

That's what I call the "Command Line API" which is provided by Flex.

Fohlen commented 7 years ago

@a-teammate no. the seperation is there for good reason.

In the end all the lower level servers (gRPC, ENET) will be hidden for the user, and configuration to join to a server is handled by flex.

aschaeffer commented 7 years ago

Note: npm un -g and npm up -g require root permissions for me

Fohlen commented 7 years ago

@aschaeffer you should use nvm for development. I did notice this as well that our current prestart script should not have a -g flag.

a-teammate commented 7 years ago

npm up -g got fixed.

still what would be cool here would be:

Fohlen commented 7 years ago

@a-teammate https://github.com/gruntjs/grunt-contrib-watch

Simply, grunt watch on src and server. If something changes, go to the next directory containing a package.json and run npm link

Croydon commented 6 years ago

Most information here are outdated. While moving to Yarn I restructured the parts of flex to be invidivual modules, which are getting automatically linked (yarn link).

This might make the goals here more easier to achieve.