shoffing









Level 0 Mast - Build, Code, Fight! - Competitive Programming Space Combat « on: September 21, 2015, 11:23:14 AM »

Build, Code, Fight!

[download]





What is Mast?



Mast is a competitive programming game where players build ships from a variety of different parts, teach them to fight with code that they write themselves, and then send them to battle against other players' ships. The best performing ships will climb the leaderboard to the top, while the rest will fail.



Mast is a game that makes programming fun. For someone in the process of learning to code, Mast provides a sandbox environment where they can practice and have fun doing so. For existing coders, Mast is an awesome way for them to show off their skills by competing to create the best ships and top the leaderboards.











What's New?



It's been a long time since we



Multiplayer



Multiplayer is up and working in the game. Players can enter battle with three of their ships to fight against other players' ships in two different arenas. An Elo rating system is used to assign each player a score based on their performance.



Bullet Time / Fast Forward



I added bullet time and fast forward buttons to the game. Pressing "Q" while in battle will slow down time, and pressing "E" in battle will fast forward. Not only is this useful for making sense of the fast-paced action in the game, it's also



.



Script Editor



I've added several useful features to the script editor that make writing your ships' scripts a bit easier.

Added a scroll bar so you don't have to rely on the arrow keys for scrolling through the script anymore

Implemented auto-indentation - creating a new line will match the previous line's indentation depth

Added line numbers - should make debugging those Lua errors a little easier

Rocket Launcher



We added a new part, the rocket launcher. It is our first area damage weapon, and it's been working out well so far.











Physics



I finally got around to fixing the physics in the game. Before, I had every part connected to every other part with rigidbody2d joints, which single rigidbody with multiple colliders. The new system works incredibly well. Ships that weren't feasible with the previous welding system are readily possible now.



Here's a .gif demonstrating the flood-fill process in action:





And a bonus .gif of the new physics:





Auto-Welding



Auto-welding has been implemented in the game. Previously, you had to place parts down and then weld them together manually. Now when you place a part in the ship editor it automatically welds itself to any adjacent parts, while still leaving you with the option of un-welding. Building ships just got a whole lot easier with this change.







Print/Debug Panel



I added a print/debug panel to the game that players can use to help debug theirs scripts. I override Lua's print() function and error output and send the output to the new console. It is now possible to print("Hello world!") in Mast.







Dynamic Lighting



We implemented dynamic sprite lighting with normal maps, and the result is totally awesome.



Before:





After:





Gravity Walls



We surrounded the arena with gravity walls that gently push ships away from the walls to prevent them from getting stuck in corners. This change should lead to more exciting rounds and hopefully less draws.







New Arena



We implemented support for multiple arenas, and added a new arena to the game. The arena to be played is randomly selected at round start.







And More!



Several quality of life issues have been resolved, a massive memory leak was plugged, the networking code was completely refactored, new functions like time() have been added...the list goes on.





Community



If all this sounds interesting to you, then I hope you would consider checking out / subscribing to the new



Contact



If you'd like to get in touch, you can reach us at





Mast is a competitive programming game where players build ships from a variety of different parts, teach them to fight with code that they write themselves, and then send them to battle against other players' ships. The best performing ships will climb the leaderboard to the top, while the rest will fail.Mast is a game that makes programming fun. For someone in the process of learning to code, Mast provides a sandbox environment where they can practice and have fun doing so. For existing coders, Mast is an awesome way for them to show off their skills by competing to create the best ships and top the leaderboards.It's been a long time since we last posted about Mast here on TIGSource, and I'm really excited to show off what we've accomplished since then.Multiplayer is up and working in the game. Players can enter battle with three of their ships to fight against other players' ships in two different arenas. An Elo rating system is used to assign each player a score based on their performance.I added bullet time and fast forward buttons to the game. Pressing "Q" while in battle will slow down time, and pressing "E" in battle will fast forward. Not only is this useful for making sense of the fast-paced action in the game, it's alsoI've added several useful features to the script editor that make writing your ships' scripts a bit easier.We added a new part, the rocket launcher. It is our first area damage weapon, and it's been working out well so far.I finally got around to fixing the physics in the game. Before, I had every part connected to every other part with rigidbody2d joints, which would often end up with spazzy ships . The new system works by doing a flood fill every time a part is destroyed (and when the ship is initialized) to identify disconnected chunks, and merging them together into a. The new system works incredibly well. Ships that weren't feasible with the previous welding system are readily possible now.Here's a .gif demonstrating the flood-fill process in action:And a bonus .gif of the new physics:Auto-welding has been implemented in the game. Previously, you had to place parts down and then weld them together manually. Now when you place a part in the ship editor it automatically welds itself to any adjacent parts, while still leaving you with the option of un-welding. Building ships just got a whole lot easier with this change.I added a print/debug panel to the game that players can use to help debug theirs scripts. I override Lua's print() function and error output and send the output to the new console. It is now possible to print("Hello world!") in Mast.We implemented dynamic sprite lighting with normal maps, and the result is totally awesome.Before:After:We surrounded the arena with gravity walls that gently push ships away from the walls to prevent them from getting stuck in corners. This change should lead to more exciting rounds and hopefully less draws.We implemented support for multiple arenas, and added a new arena to the game. The arena to be played is randomly selected at round start.Several quality of life issues have been resolved, a massive memory leak was plugged, the networking code was completely refactored, new functions like time() have been added...the list goes on.If all this sounds interesting to you, then I hope you would consider checking out / subscribing to the new /r/MastGame subreddit . I would love to grow a community around this game, and a subreddit is a great place to start! Ask questions, talk about strats, etc.If you'd like to get in touch, you can reach us at [email protected] « Last Edit: September 23, 2015, 07:02:17 PM by shoffing » Logged

shoffing









Level 0 v0.82a « Reply #2 on: September 23, 2015, 04:50:08 PM »



view the changelog on our subreddit



Text copied here:



Mast v0.82a



This minor late-night release contains a few bugfixes and a password reset link.



Additions

Added a password reset link to the login dialog (finally) (credit to /u/SeanCanoodle)

Fixes

Fixed a bug where scripts weren't loading correctly on the first attempt. [thanks to /u/Arvanche]

Fixed a big hole in the walls of the new arena that allowed ships to escape Last night I released a hotfix for several bugs that cropped up from the update 2 days ago. Another dev and I also finalized a basic / secure / functional password reset page.Text copied here:This minor late-night release contains a few bugfixes and a password reset link. Logged

shoffing









Level 0 Re: Mast - Build, Code, Fight! - Competitive Programming Space Combat « Reply #3 on: October 13, 2015, 08:08:19 PM »



I needed this new system to create a part stat display section in the ship editor, so now you can see all the nitty gritty details about each part while you're building your ship. While I originally intended for this text display to be temporary while I work on a more colorful/traditional layout, I think I kind of like it - it fits with the style of the game.



Here's a .gif:





Changes since last version have just this and a few bug fixes, so I don't think a new release build is warranted quite yet. Today I created a system for better handling part stats (health, mass, fireRate, thrustForce, etc). The system is a static class that loads all the stats from a JSON file on game init. Before this, I was storing each part's stats in constants in their class files.I needed this new system to create a part stat display section in the ship editor, so now you can see all the nitty gritty details about each part while you're building your ship. While I originally intended for this text display to be temporary while I work on a more colorful/traditional layout, I think I kind of like it - it fits with the style of the game.Here's a .gif:Changes since last version have just this and a few bug fixes, so I don't think a new release build is warranted quite yet. Logged

shoffing









Level 0 Re: Mast - Build, Code, Fight! - Competitive Programming Space Combat « Reply #5 on: October 14, 2015, 08:22:51 AM » That video is very old, 7 months at this point! You're right, I think it's about time to create a new one. So much has changed since then!



And yes, we've got plenty of ideas for more parts in the future! New parts will be a mix of alternatives to existing parts (rapidfire turret, side-mounted thruster, etc) and completely new concepts (radar sensor, bubble shield, grappling hook, tractor beam, etc). Logged

Personman







Level 0 Re: Mast - Build, Code, Fight! - Competitive Programming Space Combat « Reply #7 on: October 14, 2015, 07:28:23 PM » I don't understand, after spectating a bit and then building a ship and playing two rounds myself, how victory is determined, or more accurately, why it is determined in such a limited way.



It seems like only complete destruction of a ship (or of it's brain? I'm not sure) is enough to count, making almost every round I've watched, and both rounds I played, draws, even when there was a CLEAR advantage in terms of ship integrity on one side. Is there a reason the winner isn't just determined by who has the most total value of parts left alive? Or a similar metric that's a bit more granular than the current one?



It also seems like with the way the physics works, everything just kind of ends up spinning around randomly. It might be nice if there were a bit of air resistance, so that getting hit once doesn't immediately send you spinning away. I'm sure advanced shipbuilders can correct for this with thrusters, but for noobs who just want to throw something together quickly and watch it go (a very important demographic!) the current system leads to pretty unsatisfying movements.



That said, the core concept & implementation seem solid, and I'm definitely sticking around! Logged

shoffing









Level 0 Re: Mast - Build, Code, Fight! - Competitive Programming Space Combat « Reply #8 on: October 14, 2015, 08:06:08 PM »



Each player selects 3 ships for their team

Kill the brain to destroy a ship

If all of a player's ships are destroyed, that player loses the round

If the 2 minute time limit elapses, a draw is declared

Perhaps a better system would be to keep track of how much relative damage is done to each of the players' team. Have health bars at the top that show a percentage for each player (current part health sum / initial health sum). If the two minute time limit elapses without a player winning, it could determine the winner by whoever has the highest remaining percent - perhaps weighted as a partial victory in our Elo system instead of a full one. Draws would still occur in situations where neither player is able to deal any damage to the other or equal percent damage is dealt. I'll look into redoing how the round gameplay works for the next update. You bring up a good point with the round victory conditions, I could definitely make them more intuitive / granular. The way it works now:Perhaps a better system would be to keep track of how much relative damage is done to each of the players' team. Have health bars at the top that show a percentage for each player (current part health sum / initial health sum). If the two minute time limit elapses without a player winning, it could determine the winner by whoever has the highest remaining percent - perhaps weighted as a partial victory in our Elo system instead of a full one. Draws would still occur in situations where neither player is able to deal any damage to the other or equal percent damage is dealt. I'll look into redoing how the round gameplay works for the next update. Logged

shoffing









Level 0 Re: Mast - Build, Code, Fight! - Competitive Programming Space Combat « Reply #10 on: October 15, 2015, 04:03:23 AM »



The ship scripting is done with Lua. Each part has a number of methods exposed to the player that allow them to be manipulated in battle. For example: turrets have :Fire(), thrusters have :SetThrust(float), and gyroscopes have :AngVel().



There are two control functions available to the player - Start() and Update(). They are analogous to Unity's Start() and Update() functions. Start() gets run once at round start, and Update() is executed many times per second throughout. Most ship code goes in these two functions.



You can see some example ships with code here on the website:



http://propslam.com/mast/examples Mast is indeed inspired in part by Captain Forever, good eye! That game is great.The ship scripting is done with Lua. Each part has a number of methods exposed to the player that allow them to be manipulated in battle. For example: turrets have :Fire(), thrusters have :SetThrust(float), and gyroscopes have :AngVel().There are two control functions available to the player - Start() and Update(). They are analogous to Unity's Start() and Update() functions. Start() gets run once at round start, and Update() is executed many times per second throughout. Most ship code goes in these two functions.You can see some example ships with code here on the website: Logged

Personman







Level 0 Re: Mast - Build, Code, Fight! - Competitive Programming Space Combat « Reply #11 on: October 16, 2015, 02:40:24 AM » I feel like better documentation of the provided functions should be a high priority. At the moment, the ranges of values that things like the GPS and Gyroscope return are not mentioned at all, and none of the example ships use them.



I'm trying to figure it out by just printing out their values, but I'm getting frankly bizarre results - the GPS's Pos().y is fluctuating from large numbers (in the 200s and 300s) to very small numbers (in the 10s) suddenly, which seems like it really shouldn't ever happen. Logged

EJlol







Level 0 Re: Mast - Build, Code, Fight! - Competitive Programming Space Combat « Reply #12 on: October 16, 2015, 03:17:21 AM » ).



The game itself is quite fun though. Yes, the documentation could be a lot better. I also really dislike the IDE, mainly because of 2 bugs. When I copy/paste something all the new lines are gone!? And when I select multiple lines and hit tab, all my code is gone (no ctrl-Z either).The game itself is quite fun though. Logged

shoffing









Level 0 Re: Mast - Build, Code, Fight! - Competitive Programming Space Combat « Reply #14 on: October 16, 2015, 06:13:27 AM »



I know how often Linux folk get shafted by developers, so I definitely want to have a build working at some point. We used to have a Linux build, but it broke 3 months ago at v0.81 when we switched our Lua interpreter library from KopiLua to KeraLua for performance reasons. Once I get my laptop with Ubuntu install back from the shop (the screen broke) I can look into fixing it, but it won't be the highest priority.I know how often Linux folk get shafted by developers, so I definitely want to have a build working at some point. Logged

shoffing









Level 0 Re: Mast - Build, Code, Fight! - Competitive Programming Space Combat « Reply #15 on: October 16, 2015, 06:27:39 AM » Quote from: Personman on October 16, 2015, 02:40:24 AM I feel like better documentation of the provided functions should be a high priority...



That's something I was planning on focusing with a redesign of the website. It would be standard looking API documentation, like you'd find with any other language. I'll change that priority around and work on the API docs first before redesigning the rest of the site.



I'm not sure why :Pos() is returning those weird values, I'll look into that too. It should just return the X/Y position of the part in UnitySpace (each background grid is 4x4 units).



Quote from: EJlol on October 16, 2015, 03:17:21 AM ). ...

...I also really dislike the IDE, mainly because of 2 bugs. When I copy/paste something all the new lines are gone!? And when I select multiple lines and hit tab, all my code is gone (no ctrl-Z either). ...

I understand your pain, and unfortunately there's not much I can do short of writing my own InputField from scratch. These are all bugs with Unity's built-in multiline input field. I was able to get around some problems in the past by extending the InputField and manually overriding some of its internal methods (thanks Unity for making the InputField source code open), but that can only go so far and the code is kind of gross.



Supposedly the copy-paste bug is



In the meantime, you can edit your ships' code outside of the game with an editor of your choice - the ship script files are located in

/Mast_Data/Ships/[username]/[ship].lua

(On the OSX build, you can right click - Show Package Contents and the script files will be in there)



You can tab out to edit these files, then tab back in and your changes should be loaded.





That's something I was planning on focusing with a redesign of the website. It would be standard looking API documentation, like you'd find with any other language. I'll change that priority around and work on the API docs first before redesigning the rest of the site.I'm not sure why :Pos() is returning those weird values, I'll look into that too. It should just return the X/Y position of the part in UnitySpace (each background grid is 4x4 units).I understand your pain, and unfortunately there's not much I can do short of writing my own InputField from scratch. These are all bugs with Unity's built-in multiline input field. I was able to get around some problems in the past by extending the InputField and manually overriding some of its internal methods (thanks Unity for making the InputField source code open), but that can only go so far and the code is kind of gross.Supposedly the copy-paste bug is fixed in a future version , but the rest of the issues I'll have to code around myself. Improving the script editor is definitely a top priority though.In the meantime, you can edit your ships' code outside of the game with an editor of your choice - the ship script files are located in(On the OSX build, you can right click - Show Package Contents and the script files will be in there)You can tab out to edit these files, then tab back in and your changes should be loaded. « Last Edit: October 16, 2015, 06:45:41 AM by shoffing » Logged

shoffing









Level 0 Re: Mast - Build, Code, Fight! - Competitive Programming Space Combat « Reply #16 on: October 24, 2015, 10:27:03 AM »



Mast v0.83 [Download]



View the changelog on our subreddit



Text copied here:



This release contains a few bugfixes, a new part stats display, new player health displays, and a reworking of the way draws are handled that allows for partial victories.



Additions

Part stats display: Stats for each part are now displayed in a panel below the parts list. The bar on the right shows how this part's stat compares to other parts with the same stat. GIF

Stats for each part are now displayed in a panel below the parts list. The bar on the right shows how this part's stat compares to other parts with the same stat. GIF Health bars: Each player now has a health bar display at the top of the screen. A player's health is equal to (sum of remaining part healths / initial sum of part healths). GIF

Each player now has a health bar display at the top of the screen. A player's health is equal to (sum of remaining part healths / initial sum of part healths). GIF Draw advantages: If a round ends in a draw and player healths are unequal, the player with the most health remaining gets a partial victory over the other. Partial victories count for half as much rating impact as a total victory. IMG

Fixes

Fixed issue with naming parts where right clicking to drag the camera / select another part to name would cause the camera to snap in odd ways.

Fixed issue with the new version of Unity where UI elements without image files would cause crazy artifacts. Hey everybody! Just released a new version, including a big change to the way DRAWs are handled that was recommended here. Let me know what you think, and thanks for playing!This release contains a few bugfixes, a new part stats display, new player health displays, and a reworking of the way draws are handled that allows for partial victories. Logged

Personman







Level 0 Re: Mast - Build, Code, Fight! - Competitive Programming Space Combat « Reply #17 on: October 24, 2015, 11:55:10 AM » . Now just whip up some real documentation for the available functions and I can actually play your game xD Yay! I'm so happy about the fix to draws (and about having made a difference. Now just whip up some real documentation for the available functions and I can actually play your game xD Logged