Both methods accept Basic access authentication. The two supported methods are POST and GET for writing and retrieving respectively.
#Screeps code how to
Once you've built a unit, you must tell it how to execute the task you've designed it for. Screeps Web API has an endpoint for working with scripts.
#Screeps code code
This line of code executed in the console will spawn a creep mode up of one "WORK," "CARRY," and "MOVE," module each and the designation of "Harvester1." Your units, called "Creeps" in-game, all have to be built from a line of JavaScript, for example: After a few months in early access, this week the game properly launched. Instead, you have to code each unit's behavior in JavaScript. You see, unlike StarCraft or Age of Empires, your units in Screeps don't come with an AI or fancy control interface.
Screeps is a real-time strategy game, and it's an MMO, but not in the vein of any I've ever seen before. Issues, Pull Requests, and contribution to the docs are welcome! See our Contributing Guidelines for more details.Every once in a while, I encounter a game that just doesn't fit any established genre. We use Screeps as a key part of our recruitment process at fleetster. Using actual programming instead of a pseudo-language actually allows the players to focus on better coding habits and makes practice fun. Maintaining the docs will also become a more community-focused effort, which means you too, can take part in improving the docs for this starter kit. Screeps is a fun game and has a unique angle to it. Includes all the essentials to get you up and running with Screeps AI development in TypeScript, as well as various other tips and tricks to further improve your development workflow. We've also spent some time reworking the documentation from the ground-up, which is now generated through Gitbooks. And every time your creep dies, your spawn will simply create a new one. You could leave it running for days or weeks and youll still have a creep running back and forth upgrading the controller with energy. If you find a problem or have a suggestion, please open an issue there. And thats what it takes to write the simplest Screeps code possible. The type definitions for Screeps come from typed-screeps. Important! To upload code to a private server, you must have screepsmod-auth installed and configured! Typings Running npm run push-main is equivalent to rollup -c -environment DEST:main, and npm run watch-sim is equivalent to rollup -cw -dest sim.
You can use -cw instead of -c to automatically re-run when your source code changes - for example, rollup -cw -environment DEST:main will automatically upload your code to the main configuration every time your code is changed.įinally, there are also NPM scripts that serve as aliases for these commands in package.json for IDE integration. Running rollup -c -environment DEST:main will compile your code, and then upload it to a screeps server using the main config from screeps.json. I used VS Code as my IDE, but any IDE with a unix-style shell available would work I could probably get it running on a Linux box (or a Mac) using (say) IntelliJ with only a few. This is a follow to the previous post, in which I created a project to write Screeps using TypeScript. Running rollup -c will compile your code and do a "dry run", preparing the code for upload but not actually pushing it. Tutorial 1.3: Adding Rollup to a VC Code Screeps Project. Move or copy to screeps.json and edit it, changing the credentials and optionally adding or removing some of the destinations. Screeps Typescript Starter uses rollup to compile your typescript and upload it to a screeps server.
Fire up your preferred editor with typescript installed and you are good to go! Rollup and code upload