Simple second grade equation solver – MathStudio Tutorial

Let’s start exploring the MathStudio Script Language with this first tutorial. In this article we are going to code a simple second grade equation solver.

Some days ago we released the beta of our Mathematical IDE, MathStudio, which allows you to develop your technical applications in a simple way.

Actually, MathStudio has a simple command that implements the Brent’s equation solver, but we won’t use that in this tutorial. We will let the user input the coefficients of the second grade equation one by one. To do that in MathStudio, we use the input command:

output Insert 'a' coefficient:
[a] = input
output Insert 'b' coefficient:
[b] = input
output Insert 'c' coefficient:
[c] = input

We now have all the coefficients declared. According to Maths theory, we have to calculate the delta (discriminant). Delta is defined as ∆=b^2-4*a*c, so:

[delta] = calc ({b})^2-4*({a})*({c})

Now, according to the algorithm to solve this kind of equations, we have two results: x = (-b±√∆)/2*a, so:

//First result
[x1] = calc (-({b}) + sqrt({delta}))/2*({a})
//Second result
[x2] = calc (-({b}) - sqrt({delta}))/2*({a})

All we have to do now is to printing the results on the screen:

output First result: {x1}
output Second result: {x2}
pause

In order to prevent the script from returning NaN (Not a Number) for both the results if delta is minor than zero, we can put a goto mark before the pause command:

if {delta} < 0 then

output [Delta < 0] Cannot calculate solutions.
goto end

endif

[…]

:end
pause

You can also plot the function graph associated to the equation if you want:

fdef f(x) = ({a})*x^2+({b})*x+({c})
plot "f"

This sample is included in the GoManga MathStudio installer and you can find it under C:\GoManga\MathStudio\Samples\equations.ms but you can also download from here.

Have fun!

The physics of the revolution

Have you ever questioned about the physics behind your favourite videogames? Let’s take a look at what happens behind the map in Not Another Platform Game.

Everithing moves!

Building a realistic world is the main key to make a good game. But how? There are many ways to do that and one of these is animating everything and making it not repetitive: we are trying to add some little stories in the map that surrounds the player. For instance, in the Third Level, the player is put right between the Steel Mallet army and the Fallen partisans. We wanted the player to feel the battle and the same violence he would feel in a war game, so we started adding triggered events through the map.

Booom!

When you see a wall being shot down or a tower falling, you’re not enjoying a well scripted animation. All of these things is physically simulated! Each one of the cubes you see is a physical rigid body simulated by the game engine.

ezgif-2-ba66cc9f2c

Clothes, flags and stendards are as well, making the envirorment convincing, even if the characters style suggest a toony style.

Thanks to Nvidia Physix, physics implementation in the game engine is very simple and does not require hundreds of lines of code. Most of the implementations don’t require coding at all: clothes simulation is made inside the Unity Editor so we can edit all the proprieties from the Inspector, without accessing the code. However, more complex things such as explosions and building fallings required more work and code. In this cases the RigidBody class from the Unity API has come to our aid:

RigidBody.AddExplosionForce(power, position, upwordsModifier, mode);

We’re hard working to make all things realistic and a big span of time has been spent on polishing all of these particulars. While you wait for the game to be released, take a closer look to its first trailer!

MathStudio beta is available

We are proud to announce that, after several months of news blackout on Social Networks and Devlog, we are back to share our news with you. We’re hard working on both Insane Decay of Mind: The Sound of Silence and Not Another Platform Game.

MathStudio

Moreover, in the last month we worked on a little new project, too. Its name is GoManga MathStudio and it is a powerful Mathemathical IDE developed in C# that will allow you to write your complex maths application in a very simple way. In fact, MathStudio provides a very simple syntax for its commands making technical software development easier than ever. Also, it includes a parser which is able to solve coplex mathematichal expressions and it offers several built-in tools for mathematical analysis. MathStudio beta is now available for free and all you need is downloading it!

A MathStudio Screenshot

Isn’t it enough for you?
MathStudio allows you to write your own commands and extentions for the editor! You can do this implementing the MathStudio.Core.Plugin interface in your code. Under the main directory of MathStudio (C:\GoManga\MathStudio\Samples\Plugins), you can also find two examples of implementation. The first one, written in C#, is a plugin that allows you to use the sumf command; the second one, written in VisualBasic, is a UI implementation of the maths parser for the editor. Take a look of the API Documentation for more details. Please note that, according to End-User License Agreement provided with the MathStudio installer wizard, you are not allowed to redistribute MathStudio binaries and executables, even if you are using them for your plugin. The MathStudio DLLs are not required to be put in the Plugins directory.

Are you ready to start coding?

First of all you need to download and install the MathStudio executables. Then, start the MathStudio Editor and write the code below:

output Hello World!
pause

This code is the so famous Hello World script written in the MathStudio Language. You can execute it by simply pressing the F5 button.

The code runned

Cool, isn’t it? Take a look to the quick reference to see how to code in the MathStudio Language. In the C:\GoManga\MathStudio\Samples directory, you can find several examples of code and we will provide new ones on this Devlog.

We can’t wait to see what you make with this powerful editor: feel free to send your code at info@gomanga.it.

Download GoManga MathStudio for free!

Read GoManga MathStudio quick reference

Read GoManga MathStudio API documentation

 

Silence is back in development

12745658_1236557683039426_1148426086293177332_n

Remember Insane Decay of Mind: The Sound of Silence, one of the projects GoManga Interactive is currently working on? Whether you do or not, check out the teaser that has been released on the YouTube channel just yesterday.

The Second Act of this disturbing interactive novel is still in development, whereas the first will be released soon. During the last year, these projects have been interrupted because of the release of Insane Decay of Mind, an arcade spin-off available on Steam. But now they are back, ready to torment you to death.

13346526_1321519717876555_6616965789283257003_n

If you want to live a tormented adventure in a dark and creepy atomosphere, join Katherine Watson on her way. She is lost in the ruins of an old building which really resembles her school. But what happened to her? What are those terrible Shadows around her?

To find out, you will have to wait – not too much, don’t freak out – but in the teaser you’ll be able to see some frames of this mad story.

You’ll also be abe to see Katherine’s home, surrounded by a golden, immense field. She lived in such a beautiful place, didn’t she? It is called Goldenyard. But even the most peaceful places keep their own secrets…

Are you ready to get insane?

A closer look to NAPG's trailer

Get ready to join the Rebellion
The trailer of Not Another Platform Game was released on 22 November, 2017 and it gives us a taste of what’s coming next.Get ready to join the Rebellion

 

Not Another Platform Game is one of the projects GoManga Interactive team is currently working on.
It is a post-apocalyptic puzzle game that tells the story of Silver, a little robot, which you have to guide through the ruins of Brodstock after a war between Men and Machines has devastated it.
Will you choose to support the Fallens’ rebellion or will you give up to the Steel Mallet?

screenshot-1

In the trailer, many elements we’ll find in the game will be shown.
Firstly, you’ll take a first tour in the city of Brodstock at the time the Machines took control of it; then you’ll also see the Factory, the Steel Mallet‘s headquarters, attacked by the Fallens.
In addition, the main characters of the game will be introduced: a brand new Lether, the mysterious ballad singer and Silver – the protagonist – together with his mate Buz.
Last but not least, in good NAPG style, the trailer has got a very peculiar soundtrack that will take your breath away…and this only a little taste of the whole game!

Check the trailer out here: