|
- <!DOCTYPE html>
-
- <html lang="en">
- <head>
- <meta name="theme-color" content="#20c420" />
- <meta name="author" content="Exmods community" />
- <meta name="keywords" content="exmods,gamecraft,modding,mod" />
- <meta name="og:type" content="website" />
- <meta name="og:title" content="Exmods" />
- <meta name="og:description" content="Gamecraft modding website" />
- <meta name="description" content="Gamecraft modding website" />
- <meta name="og:image" content="../static/favicon.png" />
- <meta name="og:url" content="https://www.exmods.org" />
- <meta charset="UTF-8" />
- <link rel="icon" href="../static/favicon.png" type="image/x-icon"/>
- <link rel="shortcut icon" href="../static/favicon.png" type="image/x-icon"/>
- <link rel="stylesheet" href="../static/style.css" type="text/css" />
- <title>Exmods | The Power of GamecraftScripting</title>
- </head>
- <body>
- <h3><a href="index.html" title="You know your browser has a back button, right?">Back to list</a></h3>
- <h1>The Power of GamecraftScripting,</h1>
- <h2>Or Why You Should Learn Python for Gamecraft</h2>
-
- <div class="text-content">
- <p>
- <span class="tab"></span>
- You should learn <a href="https://www.python.org/">Python</a>.
- </p>
- <p>
- <span class="tab"></span>
- If you're not interested in learning a programming language, you should reconsider.
- Computers are steadily taking over every industry (that they haven't already taken over), and their potential doesn't stop at work.
- To completely unlock the potential of computers, you have to be able to tell the computer exactly what you want it to do.
- Running a program restricts you to existing computer applications and to existing computer potential, but a computer language removes that restriction.
- With that sort of power at your fingertips, you can do anything from making a rocket fly (model and full-scale) to hacking the Pentagon (not recommended) to annoying your siblings (true story).
- Python is one of the easiest programming languages to learn, which makes it a great first language to grasp the basics of programming.
- In fact, it's the first programming language I learned.
- Python is also the second most popular programming language, according to <a href="https://insights.stackoverflow.com/survey/2019#technology">StackOverflow's latest developer survey</a>.
- The most popular language, according to that survey, is JavaScript, but that's a
- <a href="https://en.wikipedia.org/wiki/ECMAScript#Versions" title="Error support was added in the third major update">strange</a>
- <a href="https://stackoverflow.com/a/35458829" title="Consistent operation and performance, what's that?">beast</a> that I try to stay away from.
- If work and play aren't enough to make you interested in learning Python, I'm not sure what is.
- </p>
- <p>
- <span class="tab"></span>
- GamecraftScripting provides Python integration for Gamecraft using <a href="https://ironpython.net/">IronPython</a>,
- allowing for Python code to use C# APIs like the
- <a href="https://git.exmods.org/modtainers/GamecraftModdingAPI">GamecraftModdingAPI</a>.
- That means you can write a Python script to do anything that mods like <a href="https://git.exmods.org/NGnius/Pixi">Pixi</a>
- and <a href="https://git.exmods.org/ExtraCommands/extracommands">ExtraCommands</a> do.
- I usually use Python to test my C# mods before I release them publicly, so I call tell you first-hand that Python is just as powerful as C# without its complexity.
- I've also used GamecraftScripting to prototype functionality, since Python is easy to write.
- But you don't even need to know C# to write a Python script for Gamecraft.
- </p>
- <p>
- <span class="tab"></span>
- The abilities that Python offers don't end at mods, either.
- I've heard a few people expressing the desire for actual variables in Gamecraft, which can be done with one line of code in Python.
- You can run a Python script to do things that in-game logic gates can't accomplish on their own.
- Python scripts can even interface seamlessly with signals and wires using the GamecraftModdingAPI, and you can run a script from any console block for seamless integration.
- This can be a powerful tool for gamemakers, with uses from teleporting a player to another player's location to creating automatically-generated game sections.
- Gamecraft circuit system is <a href="https://en.wikipedia.org/wiki/Turing_completeness">Turing complete</a>
- (just like <a href="https://www.youtube.com/watch?v=uNjxe8ShM-8">PowerPoint</a>!), but it's limited to accessing in-game information.
- But you could write a script to access the internet or to play a minigame using a level stored as a text file!
- If you're feeling brave, you could even pass that information as data to be processed by Gamecraft logic circuits.
- As a real-world example, I'm currently working on adding animations into a game using a combination of in-game logic, Pixi and Python to make it work.
- The power of programming offers infinite capabilities for gamemakers and tinkerers alike.
- </p>
- <p>
- <span class="tab"></span>
- Usually, when writing code, I use an Integrated Development Environment (IDE) to make the task easier.
- An IDE provides the user with an all-in-one solution to program and run code with sprinkles on top, like auto-complete and spell-checking.
- Recently, I added some similar functionality to GamecraftScripting.
- Using the ToggleIDE command, in modded Gamecraft, GamecraftScripting will enable some of the features an IDE would normally have.
- The ToggleIDE functionality is still a work in progress, but right now it offers improved command auto-complete but you'll still need to use an external text-editor to write your code.
- In the future, hopefully I can expand its functionality to editing text directly in Gamecraft, to make it a truly integrated IDE experience.
- Once you've developed a script that you want to include with your game, there's also a tool to package the Python code into the game.
- This tool simplifies distribution so you don't have to worry about getting another file to players somehow.
- Using built-in tools, GamecraftScripting can make learning Python easy by replacing the IDE with the familiarity of Gamecraft and your preferred text editor.
- </p>
- <p>
- <span class="tab"></span>
- Now that your head is bursting with the amazing possibilities that Python and GamecraftScripting offer, let me bring you back to Earth with some of its limitations.
- GamecraftScripting's Python support is held back by IronPython's development speed, so GamecraftScripting only supports Python2.7,
- which is officially unsupported by the Python Software Foundation as of January 2020, unfortunately.
- This shouldn't affect you, but you'll have to avoid tutorials and functionality for Python3 and instead seek out stuff that supports Python2.7 versions.
- Hopefully in the near future I'll be able to upgrade to IronPython3 to remove this limitation.
- The other notable issue with GamecraftScripting's Python is it can't use most external Python libraries.
- All of Python's standard libraries are supported, but a lot of Python's amazing package library doesn't like Python running in Gamecraft (or any other C# app that uses IronPython).
- So far I haven't had any problems with those limitations, so I'm sure you won't be limited by them either.
- </p>
- <p>
- <span class="tab"></span>
- So what are you waiting for? Python and GamecraftScripting are out there, waiting for you to dive in and learn something that you'll be able to use for years to come.
- If you're lucky, you'll even have make some cool Gamecraft creations while you're at it!
- </p>
- </div>
- <footer>
- exmods.org|<a href="https://git.exmods.org/ExMods/html-site">Site Repository</a>|<a href="https://exmods.org">Home</a>|<a href="https://discord.gg/2CtWzZT">Discord</a>|<a href="https://twitter.com/GamecraftMods">Twitter</a>
- </footer>
- </body>
- </html>
|