Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411511 Posts in 69375 Topics- by 58430 Members - Latest Member: Jesse Webb

April 26, 2024, 02:18:31 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsMast - Build, Code, Fight! - Competitive Programming Space Combat
Pages: [1] 2
Print
Author Topic: Mast - Build, Code, Fight! - Competitive Programming Space Combat  (Read 2749 times)
shoffing
Level 0
**



View Profile
« 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 last posted about Mast here on TIGSource, and I'm really excited to show off what we've accomplished since then.

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 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 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 /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.

Contact

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
Landshark RAWR
Level 10
*****



View Profile
« Reply #1 on: September 21, 2015, 11:31:57 AM »

Golly! the art looks amazing!
Logged

shoffing
Level 0
**



View Profile
« Reply #2 on: September 23, 2015, 04:50:08 PM »

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.

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
Logged
shoffing
Level 0
**



View Profile
« Reply #3 on: October 13, 2015, 08:08:19 PM »

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
marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #4 on: October 14, 2015, 12:30:40 AM »

are you going to be adding some other weapons/armor? after watching the video, it does not really feel like there is much choice.

I just read in this thread, you do have rocket-launchers. maybe you should highlight the possibilities a little more in your entry-video?
Logged

shoffing
Level 0
**



View Profile
« 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
K3fka
Level 0
*



View Profile WWW
« Reply #6 on: October 14, 2015, 10:24:20 AM »

This looks really cool. I look forward to seeing your more up-to-date video when you post it. I could see myself getting addicted to building ships and playing this.
Logged
Personman
Level 0
**


View Profile
« 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
**



View Profile
« Reply #8 on: October 14, 2015, 08:06:08 PM »

You bring up a good point with the round victory conditions, I could definitely make them more intuitive / granular. The way it works now:

  • 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.
Logged
Cranktrain
Level 4
****


making gams


View Profile WWW
« Reply #9 on: October 15, 2015, 12:15:26 AM »

Looks a bit inspired by Captain Forever. The visuals look very different of course, but the big thing that'll set the game apart is going to be programming side. I'd love to hear and see a bit more of that. What sort of scripting is the player going to be performing?
Logged

shoffing
Level 0
**



View Profile
« Reply #10 on: October 15, 2015, 04:03:23 AM »

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:

http://propslam.com/mast/examples
Logged
Personman
Level 0
**


View Profile
« 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
**


View Profile
« Reply #12 on: October 16, 2015, 03:17:21 AM »

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 Screamy).

The game itself is quite fun though.  Grin
Logged
Dacke
Level 10
*****



View Profile
« Reply #13 on: October 16, 2015, 04:05:46 AM »

Any plans for a Linux build?
Logged

programming • free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
shoffing
Level 0
**



View Profile
« Reply #14 on: October 16, 2015, 06:13:27 AM »

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
**



View Profile
« Reply #15 on: October 16, 2015, 06:27:39 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).

...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 Screamy). ...

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
/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.


« Last Edit: October 16, 2015, 06:45:41 AM by shoffing » Logged
shoffing
Level 0
**



View Profile
« Reply #16 on: October 24, 2015, 10:27:03 AM »

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!

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
  • 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
  • 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.
Logged
Personman
Level 0
**


View Profile
« Reply #17 on: October 24, 2015, 11:55:10 AM »

Yay! I'm so happy about the fix to draws (and about having made a difference Smiley. Now just whip up some real documentation for the available functions and I can actually play your game xD
Logged
shoffing
Level 0
**



View Profile
« Reply #18 on: October 24, 2015, 08:58:52 PM »

What kind of format would make the most sense for the documentation? Right now, we have fairly comprehensive documentation in the README, but I understand nobody likes to read READMEs. Would a standard API documentation website work? I could link it from inside the game.
Logged
Personman
Level 0
**


View Profile
« Reply #19 on: October 25, 2015, 12:00:24 AM »

I couldn't care less about the format, personally - the current format used in the readme is perfectly fine. The issue, as I mentioned in my earlier post, is that it tells me very little about the structure and meaning of the data expected and produced by the functions. For instance:

Quote from: README
Returns the position of the GPS as a Vector2.

What's a Vector2? I googled it learned it is a LÖVE library function and has .x and .y members, but it would be nice not to have to use google.

So now I can get an x and a y out, but what do they mean? Are we in a standard coordinate space with 0,0 in the upper left? Is 1,1 one pixel in from the corner, or one grid square? Am I getting integers or floats? I have no idea until I go print stuff out. I'd really rather just start building my ship :)

But it's in beta and you haven't gotten to it yet, so I went to test it out, and I learned answers to some of my questions*: Seems like 0,0 is in the center, which is weird, but ok, and they are definitely floats. But I still don't really know the units - I saw numbers like 25, which were clearly neither pixels nor visible grid squares.

I also don't know the size of the arena in these mystery units, or whether the gps is reporting on its own center, it's own upper left corner, the center of a bounding rectangle around the ship, the upper left corner of that rectangle...

And that's just one function. Glancing through: Does a Gyroscope:Ang() of 0 mean the gyroscope is pointing north? How much charge is depleted per unit thrust? How long does recharging take?

In general, I just really want a whole lot more detail.

Another thing that would help a lot is simplifying the development loop. Right now, ending a test takes a keypress and a button click, which is already annoying, but then for some reason the builder unloads the ship and you have to reload it? Combined with having to tab out to an external editor constantly, iterating quickly is pretty painful.

*I got thrown off here a bit because the output pane displays output lines in the opposite order of literally every other console in existence, e.g.
Code:
function Start ()
   print("a")
   print("b")
end
produces
Code:
[shipname] b
[shipname] a
, but that's not a documentation issue.
Logged
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic