What is the base directory for images?

I have been running from a desk top start up, and through trial end error found that images have base directory in the folder above the “scenes” folder, in “web/mygame”. So *image pic1.png will be 1 directory up from my scenes.

However the ChoicescriptIDE has the base directory as being inside the scenes folder. If I move the image in there though then running the normal bat file wont find them. I need to put *image scenes/pic1.png (except then the IDE can’t find them).

Now I am wondering what happens when the game is eventually hosted on line. Is it one of those two options or yet a third option?

Any help appreciated.

(edited. Thanks WIll)

Images go in web/mygame.

1 Like

Hi will. Yes sorry. That is true for the .bat (I’ll update my post to correct)
That still leaves the issue that the IDE wants the pictures to be in “scenes”. Is there a way to get it to look elsewhere?

I just tried having my pictures in a directory pictures at the same level as scenes:

web/mygame/
— pictures/
— scenes/

I then put a shortcut to pictures in the scenes folder with the name “pictures”

run_server.bat works fine.
IDE can’t find the pics. Sigh.

I should mention that the IDE has its own copy of the project in Choicescript Projects. I have replicated the structure there for scenes and pictures.

I don’t think it’s a good idea to use symlinks. Each OS creates and resolves them differently, not to mention some software may ignore symlinks to avoid cyclical reference. You can use instead a relative path.

For exemple, with this folder structure:

web/mygame/
	pictures/
	scenes/

You can do something like this:

*image ../pictures/example.png
2 Likes

In a traditional ChoiceScript package you have:

  • web – containing the ChoiceScript runtime files
  • web/mygame – containing mygame.js, images and a ‘scenes’ folder
  • web/mygame/scenes – containing your game files

The IDE has its own internal copy of ChoiceScript, so it has no need for a project ‘web’ folder. It also doesn’t support mygame.js (because, as far as I know – though I’m happy to be corrected – there is no longer any need for it; you can do everything you used to do in there in ChoiceScript these days).

The IDE also uses folders to determine what files are in a ‘project’ (rather than say using some specific .cside file), so avoiding nested folders is beneficial.

To both those ends I made the architectural decision that CSIDE should have only a ‘root’ project folder , and that everything else should be accessed relative to it. I’m sorry to hear that decision is causing you some trouble, but it would be quite frustrating for other users of the app to change it now.

As @cup_half_empty rightfully points out, that shouldn’t** stop you putting your images in the folder above and accessing via relative paths: e.g.: *image ../my_image.png.

You can use subfolders as well (which will at least be easy to copy and paste all your images at once out of): *image images/my_image.png.

**This might not actually be true on certain versions of the Desktop edition which restrict file access to under the project folder for security reasons (though I’d be happy to have a discussion about relaxing this).

4 Likes

CJW I really like the IDE, but the problem I have is, say I use relative refs in my code so the IDE can find images, when I upload to a host those relative links will be broken since they are going to be relative to a different base directory. So that means a replace of all the image paths for different circumstances. Unless there is a way to make the hosting environment conform to the IDE idea of the scenes being the root?

You can move the images folder inside the scenes folder and keep the same path you’re currently using.

1 Like

I haven’t used dashingdon (the most common online hosting platform in this community) much myself, but I just gave it a quick try, and I don’t see the issue your describing.
As @cup_half_empty points out, it works just fine if everything is in the same folder:

Pictures




I’d have also imagined other people would have reported an issue if they felt CSIDE was wildly incompatible with the available forms of online hosting.

If you’re in need of better organisation I can’t see why having subfolders below that ‘root’ (i.e. the ‘scenes’ folder) wouldn’t work in the same way*.

But perhaps I’m missing your point?

*With traditional hosting, that is – it doesn’t look like dashingdon gives you control over directories, so it isn’t wildly dissimilar to CSIDE in that regard.

2 Likes