Sharing assets between server and client

I’m making a multiplayer game in jMonkey. I have separate projects for the client application and server application. I also have a separate codeless project for storing shared models. The problem is, I have no idea how to access these assets from either the client or server application.

If both projects contain the assets you can create a message that the server sends with the assetkey (or path, name) that the client should load (using the AssetManager, just as you would any asset). This could be the scene, player models, etc.

Edit: This assumes that you have a networking framework setup, like SpiderMonkey and basic message handling implemented.

Yea that’s what I’m already doing, but the thing is, I don’t want to store my assets in both projects. It’s really annoying having to copy the assets to each project after every tiniest change. I have implemented the messaging and everything. I just need to access the assets from a common project.

Would it work to make another project with the assets and then use that project as a library for both the client and server project?

Edit: Wouldn’t the client and server want to share code as well?

How can i cleanly register a FileLocator to that shared project so that it would work after being deployed in a jar? The file paths are a bit confusing for me. I just can’t get the path for my shared assets.

About the shared code: I’m keeping that in the server application under a “common” package. I was too lazy to make a separate project for shared code in the beginning and current solution is working fine at the moment.

I believe that if the project is added as a library, the assets will be available just as if they had been part of the current project. Just like the assets of jme-core are available in your project when you add that as a library.

I see now that what jme-core does is it puts the assets in the regular package structure, ie Common/MatDefs/…

Alright, I got it. I just had to import the assets folder from my “resources project” and it automatically searched that folder for the right assets as if it were a part of the main project.