Hello There, Guest! Login or Register


Tutorial: Running Las Venturas Playground on your Windows computer
#1
Tutorial: Running Las Venturas Playground on your Windows computer
Before you can start developing, it's important to have the gamemode running on your own computer. The Las Venturas Playground code has been set up to make this as easy as possible, and includes utility scripts for Windows making this a one-click action. This tutorial explains how you can get from 0 to having a running server on your computer, but also how to get the LVP Pawn Editor and the LVP PreCompiler set up to make your first compile.

If you have questions or comments, feel free to reply to this topic. It's important to keep this work-flow working as it is very important that new contributors can easily set up their configurations and start to code. There are minor differences between the descriptions for Windows and Linux, which will be covered in a later tutorial.

Check out the source code using subversion
write this

Writing code: the LVP Pawn Editor and the LVP PreCompiler
Because of the size of the gamemode, Las Venturas Playground has her own tools for editing and compiling the scripts. While other tutorials will go in detail about what exactly you can do with them, being able to find and launch them is a good first step.

We'll start off with describing what the tools are. The LVP Pawn Editor is our own editor, and has been made to closely match all of LVP's needs. It features everything you expect from a decent editor, good integration with Pawn and project support with auto-complete for our gamemode. The LVP PreCompiler is a tool we use to enrich the default Pawn syntax by adding support for classes, specialized debugging, among many other features. This is required to be able to build the gamemode itself.

Getting set up with the LVP Pawn Editor for all your .pwn files is easy:
  1. Go to the tools/PawnEditor/releases/latest/ directory in your repository.
  2. Right click on PawnEditor.exe, and select Send To -> Desktop. This will create a shortcut on your desktop for convenience.
  3. Double click on PawnEditor.exe, which will open the program.
  4. In the top menu, click on Options and click on both the Associate with *.pwn files and Associate with *.ppr files items.
  5. Start typing some basic pawn in the editor. Something like "main(){}" is fine. Or, alternatively, open an existing file.
  6. Click on either F5 on your keyboard or the empty white window icon on the toolbar to compile your script to an .amx.
You just made the first compile in the LVP Pawn Editor, using the LVP PreCompiler. That wasn't hard, now was it? Of course, these tools have many advanced options available, some of which we'll explore in other tutorials. Let's continue to running the server now.

Running Las Venturas Playground
You've got all the source code checked out on your computer, so now we're ready to getting the server up and running. You may have noticed a "server" directory in the main directory, but starting the server will throw a number of errors because plugins and the gamemode are not available. Furthermore, because of the ever changing list of necessary plugins, filterscripts and NPC scripts, it will be hard to maintain this by hand.

For that reason, we've created a deploy script. Running this script will set up everything that needs to happen in order to get your server running. It will verify that all required directories are there, and will then copy over plugins and create symbolic links for each file that you may be working on in your code. Running it is easy:
  1. Go to the gamemode/ directory in your repository.
  2. Double click on the deploy.bat file, or right click -> run as administrator if you aren't an admin user.
You only care about the second-to-last line in the output, which will start with either "SUCCESS" or "FAILURE". If a failure has occurred, please right click on the window and click on "select all". Now click anywhere else on the window, and the contents of it will now be available in your clipboard. Please send a forum PM to Russell (click here) and paste the contents in there.

Assuming everything worked, you can now go back to the server/ directory in your repository. Double clicking on samp-server.exe will now work well, and you can connect to localhost:7777 to play on the server.

Writing code: Opening the Las Venturas Playground gamemode
Time to get started! The Las Venturas Playground gamemode is contained in a project file because of the many files and settings it depends on. Before you'll be able to compile it though, there is one more manual step which you have to take, because the server needs to know who you are in order to get statistics right.
  1. Go to the gamemode/trunk/ directory in your repository.
  2. Create a new file named "AUTHOR" (in capitals, no file extension), containing nothing but the e-mail address you signed up to LVP with.
  3. Double click on the lvp.ppr file. This will open the LVP Pawn Editor with the project interface.
  4. Click F5 to immediately compile the LVP. This can take roughly a minute depending on your computer.
Cool! You're now completely set up and made your first compile. Remember the deploy script you did earlier on? If you re-launch the SA-MP Server now it will immediately have picked up the new version of lvp.amx; there is no need to copy or move files to another directory. The next step is to make a first edit, and send it back to the repository.

Writing code: Sending code back to the LVP Repository
Because we need to keep synchronized with the code used that makes Las Venturas Playground, you will have to commit your changes after you've made them. This will send them to the subversion server, which will allow other developers to pick them up.

Let's make your first change, and then send it to the LVP Repository.
  1. Around line 30 of the "lvp.pwn" file, add your name to the acknowledgement list.
  2. Go to the gamemode/trunk/ directory in your repository.
  3. Right click anywhere on the folder (not on files, though), and click on SVN Commit. In this dialog, one file will show up as being edited, which is lvp.pwn.
  4. Very important: Enter a clear description of what you have changed. In this case, "Add [your nickname] to the acknowledgement list." will be good enough.
  5. Click on the OK button at the bottom-right corner of the dialog.
Your change is now being send to the server, and after a few seconds it will have completed. Other developers can now update their version of the code, which will edit their files to include your change as well.

You're now ready to start coding, fixing bugs and adding new features. Be sure to check out the other tutorials, especially ones on syntax and our style guide. Before anything, you should read this tutorial to get a feel about how classes work in the LVP gamemode! Thank you for reading!
Reply
#2
I ran the deploy script with echo on as admin on a windows 7 machine with UAC enabled, this is what happened:
Code:
C:\Windows\system32>echo ------------------------------------------------------

------------------------------------------------------

C:\Windows\system32>echo LAS VENTURAS PLAYGROUND: DEPLOYING THE GAMEMODE
LAS VENTURAS PLAYGROUND: DEPLOYING THE GAMEMODE

C:\Windows\system32>echo ------------------------------------------------------

------------------------------------------------------

C:\Windows\system32>set DEPLOY_MODE=normal

C:\Windows\system32>set DEPLOY_RESULT=1

C:\Windows\system32>if "" == "--editor" set DEPLOY_MODE=editor

C:\Windows\system32>set SOURCE_PATH=C:\Windows\system32

C:\Windows\system32>pushd .

C:\Windows\system32>cd ..

C:\Windows>set ROOT_PATH=C:\Windows

C:\Windows>popd

C:\Windows\System32>set SERVER_PATH=C:\Windows\server

C:\Windows\System32>if not exist "C:\Windows\server" goto server_doesnt_exist

C:\Windows\System32>echo The SA-MP Server directory could not be found.
The SA-MP Server directory could not be found.

C:\Windows\System32>echo Please execute this file from the gamemode/ directory,
and
Please execute this file from the gamemode/ directory, and

C:\Windows\System32>echo ensure that the server/ directory (one level up) also e
xists.
ensure that the server/ directory (one level up) also exists.

C:\Windows\System32>goto deploy_exit

C:\Windows\System32>if 1 == 0 goto clean_exit

C:\Windows\System32>echo ------------------------------------------------------

------------------------------------------------------

C:\Windows\System32>echo FAILURE: The deploy script failed, please review the er
rors and fix them.
FAILURE: The deploy script failed, please review the errors and fix them.

C:\Windows\System32>if "normal" == "normal" pause
Druk op een toets om door te gaan. . .

It seems Windows changes the currenct directory to the system root when ran as admin, screwing up the relative links.
Reply
#3
Fixed, thank you for the report!
Reply
#4
Nice work.
I've committed a fix for an issue that was causing a local server to crash should it fail to connect to the MySQL database.
Reply