Screeps: World Guide

[WIP] Setting up Visual Studio. for Screeps: World

[WIP] Setting up Visual Studio.

Overview

My experience in setting up VS 2015, for future reference.

Installation

This guide was made in 2016, so before you go and install VS2015, We are now 4+years later, you should consider going to a more modern ( i.e. lightweight ) IDE instead.

But if you really need those instruction, go ahead ;).

Install VS Community 2015

Basic Setup

Follow the basic setup if you don’t plan to use github, though you will still be able to configure it for github after, but it will require a little bit of work.
+ warning about hidden folder

Create a new project.

File > New > Project
Goto Templates > Other Project Types > Visual Studio Solutions> and choose the Blank Solution
Don’t forget to rename it.

Then in the Solution Explorer, right click on your solution and choose: Add > New Solution Folder >

rename it as you wish.

Right click on your new folder and select: Add > Existing Item

go to your screeps local repertoire. for windows user, it should be at : User/AppData/Local/Screeps/scripts/screeps.com/default/

and choose every file in it. I have done it with the tutorial 5 folder, and that’s what it looks like.


You can now edit your script directly from VS. Every time you save in VS, you will be able to find your new script in the game. However, you won’t be able to commit because the game didn’t detected a modification.To commit simply add a letter and erase it, the game will have detected change in your script and will allow you to commit.

Adding the documentation

First thing, you need to clone the github repository containing all the scripts here:
ScreepsAutocomplete[github.com]


to do that. open the Team Explorer ( View > Team Explorer> ), Go to connect ( the plug icon)
and in the Local Git Repositories, choose Clone, put the url for the repo : [link] and then choose your folder where you want it on your computer. and hit Clone.

If the need to Update arise, double click on the name of the git Repositories, then choose the Sync option, and click on Pull.

It’s now time to add those file to our project
Goto File > Add> Existing Web Site> and choose the folder where you just put the git Repo.

You should have something that looks like that:

Then you add a _reference.js file at the root of your website ( see the arrow).

You now have to add stuff to this files. So open it, and Drag and drop every .js file in the text field of _reference.js.
it should add some line looking like that:

/// <reference path=”ConstructionSite.js” /> /// <reference path=”Creep.js” />

You will find .js files at the root, in the Structures folder and in the Global folder.

Once it’s done it’s now time to add them as reference.

Push Ctrl+Q or go to the Quick Launch form in the upper right corner ( for me) and type javascript in it. You should have the following option : text editor -> javascript -> IntelliSense -> References. click on it.

Open the option windows and choose Implicit(Web) for the Reference Group. You can then add the _reference.js to the list.

and you should now have the autocompletion ^^.

Setting up GitHub

We will start a new solution. ( If you followed the basic setup and want to keep your solution, I wish you good luck ^^, I almost went crazy trying to do it. )
Goto File > new Project > choose whatever you want. we just need a project to allow the versioning to work. I wish we could use a website container for that, but I haven’t been able to put it under source control.

You should pay attention to the naming of your solution. The name of the project will be the name of your branch once in game. So, If you want to make an other branch, I think the better way to do it is to create a new project inside your solution.
And don’t forget to tick the Create new Git repository box.


//need to check smtg here.
Once your project is created, you can remove every files that have been put in it.
If you have a cleaner way to create a blank project, Please inform me in the comments below.
It’s at that point where I considered going to VS Code, but couldn’t make work the autocompletion.
which is a shame, because Code is clearly better suited to handle what we are trying to do. At this moment VS 2015 felt like using a sledgehammer to crack a nut.

Anyway, now that the irrelevant files are gone, you can add your old one. Copy / Paste them from their old folder to your project and add them to it in VS ( right click on your project > Add > Existing Item > and select them all.

You should now open the Team Explorer windows. View > Team Explorer >

First double click on your local repository, and choose Sync.

It is the part where you might have to install the gitHub plugin.
Two options will be of interest: the Publish to GitHub and the Publish to Remote Repository

The first option will allow you to create on, and use the second one if you already created your repository.

Publish your repo, do your first commit and you are good to go.

// good tutorial on how to use git once it’s setup: here[www.visualstudio.com]
Well, don’t forget to put the documentation back, and you may have to find the right reference group to put the _reference.js, it will depend on what template you choose for your project.
// put that in a troubleshooting section

/*
First you will need to link your games with your github account.
for that ,ingame goto Manage Account, ( it’s near your name in the top right corner)
*/

Setting up Grunt

SteamSolo.com