Coding: Difference between revisions

Jump to navigation Jump to search
4 bytes added ,  16:47, 2 June 2023
no edit summary
No edit summary
Line 3: Line 3:
==⚙ Getting Started==
==⚙ Getting Started==


Programming is complex, especially when you don't know where to start. For those without access to programming classes or extracurriculars via their learning institution, RoboCo recommends [https://www.codecademy.com/learn/learn-python?utm_source=pepperjam&utm_medium=affiliate&utm_term=215171&clickId=4023389168&pj_creativeid=8-12462&pj_publisherid=215171 CodeAcademy's Learning Python]. This course is a great way to learn the fundamentals of Python AND is fully virtual, so players can take classes whenver they want.   
Programming is complex, especially when you don't know where to start. For those without access to programming classes or extracurriculars via their learning institution, RoboCo recommends [https://www.codecademy.com/learn/learn-python?utm_source=pepperjam&utm_medium=affiliate&utm_term=215171&clickId=4023389168&pj_creativeid=8-12462&pj_publisherid=215171 CodeAcademy's Learning Python]. This course is a great way to learn the fundamentals of Python AND is fully virtual, so players can take classes whenever they want.   


In addition to learning the language, players will also need a program to code in. RoboCo recommends [https://code.visualstudio.com/ Visual Studio Code] and its accompanying [https://marketplace.visualstudio.com/items?itemName=ms-python.python Python extension]. This is the program RoboCo developers use to write code for RoboCo. It comes with a variety of different customization options and extensions to fit all your coding needs (including Java and C++). You can also try [https://notepad-plus-plus.org/downloads/ Notepad++] and [https://www.sublimetext.com/ Sublime] if Visual Studio Code is of little interest or isn't avaliable.  
In addition to learning the language, players will also need a program to code in. RoboCo recommends [https://code.visualstudio.com/ Visual Studio Code] and its accompanying [https://marketplace.visualstudio.com/items?itemName=ms-python.python Python extension]. This is the program RoboCo developers use to write code for RoboCo. It comes with a variety of different customization options and extensions to fit all your coding needs (including Java and C++). You can also try [https://notepad-plus-plus.org/downloads/ Notepad++] and [https://www.sublimetext.com/ Sublime] if Visual Studio Code is of little interest or isn't available.  


Additionally, RoboCo requires players to use its custom API Documentation. This is the way in which players "talk" to their robots and includes instructions for how to program the different sensors and other controllable parts within the game. Players can access the API [https://docs.roboco.co/latest/ here] or by clicking the API button in the Microcontroller interface within RoboCo.
Additionally, RoboCo requires players to use its custom API Documentation. This is the way in which players "talk" to their robots and includes instructions for how to program the different sensors and other controllable parts within the game. Players can access the API [https://docs.roboco.co/latest/ here] or by clicking the API button in the Microcontroller interface within RoboCo.
Line 91: Line 91:
==⚙ Importing External Scripts==
==⚙ Importing External Scripts==


The RoboCo python interpreter searches a few places for libraries by default. The main location is <your steam directory>\steamapps\common\RoboCo\RoboCo_Data\StreamingAssets\Robocode\python\Lib. The game's code libraries are stored here.
The RoboCo Python Interpreter searches a few places for libraries by default. The main location is <your Steam directory>\steamapps\common\RoboCo\RoboCo_Data\StreamingAssets\Robocode\python\Lib. The game's code libraries are stored here.


Adding a file to the Lib directory will allow you to import it from any script in your robots, however the Lib folder could get reset in the future, and it's inconvenient to set up libraries in the folder over the Scripts folder where the scripts for all of your robots (including ones from the workshop) are stored.
Adding a file to the Lib directory will allow you to import it from any script in your robots, however, the Lib folder could get reset in the future, and it's inconvenient to set up libraries in the folder over the Scripts folder where the scripts for all of your robots (including ones from the workshop) are stored.


The Scripts folder is located far within the user's Documents folder, and is not searched for libraries by default. The following code segment adds the Scripts folder to the list of folders to look for libraries in.
The Scripts folder is located far within the user's Documents folder and is not searched for libraries by default. The following code segment adds the Scripts folder to the list of folders to look for libraries in.


<pre>
<pre>
Line 127: Line 127:
RoboCo has a debug console built into its coding interface that allows players to see what lines of code are causing errors. This should be the first step in helping troubleshoot Python code.  
RoboCo has a debug console built into its coding interface that allows players to see what lines of code are causing errors. This should be the first step in helping troubleshoot Python code.  


If players encounter a more complicated situation, there is a #coding-and-automation-help-desk channel in the [https://discord.gg/mS8zUKMkwV Official RoboCo Discord], which is meant to help troubleshoot more complicated behaviors. Once players have submitted a question to the channel, a member of RoboCo's dev team or equally knowledgeable Discord member should respond with guidance on how to solve the problem.
If players encounter a more complicated situation, there is a #coding-and-automation-help-desk channel in the [https://discord.gg/mS8zUKMkwV Official RoboCo Discord], which is meant to help troubleshoot more complicated behaviors. Once players have submitted a question to the channel, a member of RoboCo's dev team or an equally knowledgeable Discord member should respond with guidance on how to solve the problem.


[[#top|Back to Top]]
[[#top|Back to Top]]

Navigation menu