Currently there is only one way to install Weaver.
Check Weaver repository at https://github.com/thiagoharry/weaver. Click in "Clone or Download". Or just use this link.
Weaver was developed using literary programming technics. So before compiling the program, check if you have installed in your computer the following programs:
In Ubuntu, Linux Mint and distros like these, you can install all the dependencies using the command:
sudo apt-get install noweb build-essential
If you have all the dependencies, you can compile Weaver with the command:
make
Which should print the following message in your terminal:
Testing CTANGLE or NOTANGLE..OK Testing GCC or CLANG.........OK Compiling....................OK
If you found no errors, proceed with the installation running the following command as root:
make install
Which should print a lot of messages in your terminal to show all the files that are copied during installation. If no error messages were found, Weaver was correctly installed in your machine.
After installing Weaver, you can create a new game project going to any directory where you wish to place your game and running the command:
weaver PROJECT_NAME
Where PROJECT_NAME is any name you wish to give for your project. Please, use ony alphanumeric characters and underline. Weaver will also block your name if it would create some sort of conflict inside the project directory. For example, "Makefile" isn't a valid project name. Weaver also block the name if it corresponds to an existing file.
If Weaver allowed your name, it should have created a new directory called PROJECT_NAME. Inside the directory, you can find the following files:
n You have two choices of target compilation for your Weaver projects. You can compile them to became Linux programs or you can compile them to became javascript and HTML which could be played in a web browser. Below you will find what you need in each case.
Before compiling your game, you must check if you have all the dependencies installed in your machine. You will need:
If you are using Ubuntu, Linux Mint or distros like these, you can install all the dependencies running the command:
sudo apt-get install build-essential libx11-dev mesa-common-dev libxrandr-dev libglew-dev libopenal1 \ libopenal-dev vim-common libpng16-dev libmpg123-dev
If you have all the dependencies installed, you can compile a Weaver project going to the project directory and using the command:
make
The command should print in your terminal:
Testing GCC or CLANG.........OK Testing Xlib.................OK Testing XRandR...............OK Testing OpenGL...............OK Testing MPG123...............OK Testing OpenAL...............OK Testing XXD..................OK
And after this, should print the compiling commands used. If you wish to play the project game, just use:
./PROJECT_NAME
Where PROJECT_NAME is the name of your project. By default, when you create a new Weaver project, it creates an empty game, which creates a fullscreen window and exits if you press any key. You can also install the game with make install, but before installing, change in conf/conf.h the value of W_DEBUG_LEVEL to 0, recompile and then install. This marks the game as a finished project, not a development version.
Before compiling a game for a web browser, check if you have all the dependencies:
To install dese dependencies in Ubuntu, Linux Mint and Debian-related distros, you can use the command:
sudo apt-get install emscripten vim-common
But beware! After installing Emscripten, check if you installed version 1.34.0 or greater (use emcc --version). If not, uninstall it and proceed to Emscripten web page for information about how to install the latest version.
If you have all the dependencies, you can configure the project to create a web page instead of an executable program. First open the file conf/conf.h and find a line with #define W_TARGET W_ELF. Change this line to #define W_TARGET W_WEB. Save the file and run the command:
make
If you have all the dependencies, you should got in your terminal:
Testing EMCC.................OK Testing XXD..................OK
And much more text showing all the commands executed to create your game web page. The result will be put in directory docs. But the game probably won't work if you run in locally using your web browser. The game must be served by a web server because it uses AJAX to load dinamically your game assets. You can change the directory docs name and put in in some place where a web server can serve it via Internet.
As you develop your game, you will need to create new C source code files and their headers for your project. Instead of creating them manually, you can go inside your project directory and use the command:
weaver FILENAME
Using this command a new file src/FILENAME.c and src/FILENAME.h will be created. You won't need to worry about updating a Makefile nor putting a #include "FILENAME.h" in other files. Weaver will take care of this automatically.
If instead of create a generic C file you wish to create a new main loop for your game, you can use the command:
weaver --loop FILENAME
It works like the later command, but it also creates in FILENAME.c some initial code for your new loop. Just take care to don't give to your main loop the same name than some existing global variable in your code.
If you want to remove a C source code created this way, just remove the files created and also edit src/includes.h to remove the inclusion of the deleted header.
If you or someone else created a Weaver project with some old version of Weaver and you wish to upgrade, you just need to have installed in your machine a newer version of Weaver.
If you wish to know which Weaver version you have, just use the command:
weaver --version
This should output in your terminal something like this:
Weaver Alpha
Or perhaps:
Weaver 0.1
In the first case, the version in identified by a codiname (Alpha), with no numbers. It means that you have installed a development version of Weaver. In the second case, you have an stable Weaver version.
To upgrade a Weaver project, just use the command:
weaver PATH_TO_PROJECT
A Weaver stable version would upgrade only if the project was created by an older version of Weaver. It wouldn't do nothing if you pass a project created by an new version. Stable versions never downgrade projects.
But a development version of Weaver assumes that you are using this version to test Weaver changes and it always upgrades a project. Even if this means making a downgrade. If you don't want to downgrade projects (which in some cases could lead to some bugs in the project), avoid Weaver development versions, unless you know what you are doing.
Plugins are code that can be dinamically loaded in your projects. They can allow you to program and change a game while it is executing with no need to close and reload the game. It can also create optional parts of your game, which can be distributed separately. They can also be some generic code which could be used by any Weaver project. Perhaps something which makes some unhandled keyboard key works or a small plugin to print the frames per second.
To create a new plugin for your project, you can use the command:
weaver --plugin PLUGIN_NAME
Please, use just alphanumeric characters and underline in your plugin name. It will then be created in the directory plugins/, where you can edit it.
The Makefile and other files will handle automatically the new plugins.
To read more about plugins, check the Plugins Documentation Page.
Shaders are code written not in C or C++, but in GLSL language. It's compilling during game execution and it's executed not in the CPU, but in GPU. They can create and change textures and geometries in real time.
To create a new shader for your project, you can use the command:
weaver --shader SHADER_NAME
Please, use only alphanumeric characters and underline for your shader name. The shaders will be created at shaders/ directory. Each shader created is in fact to shaders: a vertex shader and fragment shader. Both will be placed in the same numbered directory, and the number assigned to them is how you can identify them in your C code.
The Makefile and other files will handle automatically the new plugins.
To read more about shaders, check the Shader Documentation Page.
Weaver is also tested in OpenBSD 6.4 systems. All the previous instructions would also work in OpenBSD systems, except:
And these are the only differences.