00:00
00:00
MonoFlauta
Indie Game Developer + Senior Software Engineer @ Etermax

Facundo Balboa @MonoFlauta

Age 30

Indie Game Developer

Escuela Da Vinci

Buenos Aires, Argentina

Joined on 7/30/08

Level:
27
Exp Points:
7,866 / 8,090
Exp Rank:
4,947
Vote Power:
6.87 votes
Rank:
Police Sergeant
Global Rank:
9,107
Blams:
214
Saves:
823
B/P Bonus:
12%
Whistle:
Bronze
Trophies:
15
Medals:
759
Supporter:
7y 7m 12d

MonoFlauta's News

Posted by MonoFlauta - January 30th, 2022


Twitter Account - DevBlog - Ko-Fi


Hello, everyone!

I am going to write today the updates I had been working on since I came back from holiday. These updates are related to Stonks, Is This Still Tennis, the dungeon with dices game, and also a quick update about other projects!


Stonks

I am still not sure if we are going to actually call this game Stonks. Because of its meme nature, I think it actually may be a good name.

These last weeks we had made a lot of content for it. We already have a fully functional stock and crypto screen. We also have a working progress surety screen and more content is on the way.

iu_538358_2529638.webp

Being able to play with stocks and crypto already is letting us know how playing the game feels. There is a bunch of work to do but we are now pretty sure that we want to have a mobile version of it. The game feels a lot more of an “on the go” game than a web one. Of course, this doesn’t mean that we are not going to publish it for the web too, just that our main focus may shift to mobile.

As an extra update, Lauta talked with a friend of his team at work and now we have a new artist that joined us. Hopefully, we will be able to start replacing our programmer art with more pretty content. It will also let us focus our work on programming and gameplay instead of trying to figure out how the UI will be or how we are going to make it look good. And lastly, of course, he is going to make a better job than us so I am sure it is a good idea.


Is This Still Tennis

Another project I had been working on a bit more is on Is This Still Tennis. I had been searching for new sets of projectiles, enemies, and configurations in order to give more variety to the game.

iu_538359_2529638.webp

Since Roberto already did most of the enemies, if not all of them, I focused on adding a new one to the gameplay so I decided to go for the alligator. With that one, I had been trying out to do a different setting for the projectile. What I came up with was a way to faster projectile than the ones that were happening already. This, in my opinion, gives a better feel of progressive difficulty than adding one of the other ones we have already planned that give more a feel of variety.

We are still not sure how the final order of enemies and configuration will be, but I think we should keep adding more variety for the projectiles and set the difficulty in the speed since it was a bit difficult to get that feeling trying out other things.


Dungeon with Dices

For the dungeon with dices, I can say we finally have the main battle frame working. It has all the basic mechanics, including the Yahtzee-related gameplay, and it actually feels really good!

Not only that, the good thing about how we are approaching development is that we are fully using TDD on this one. From the core to the views are fully tested and this is already giving a lot of advantages when trying to make changes related to testing out new things.

iu_538360_2529638.webp

Our main focus right now is on adding clearer feedback to the user. Even we have the main mechanics working, there is still a lot of confusion on what is happening. Also, we had been trying out adding 3D dices (in the screenshot it is not clear enough but that six-dice is animated). There is still a lot to do but this one is looking really promising.

One of my main goals for the development of this game is to make it scalable. I think we should be able to add new behaviors for enemies pretty easy and also I am looking forward to adding new classes, rooms for the dungeon, and stuff like that.

Maybe, we even release it somehow as early access once it doesn’t have placeholder art and it is actually playable and not just random battles, and we try to build from there adding updates. I feel like this approach would be the most natural one.


Other projects and updates

For last, I had been also working on the casual mobile game I mentioned in my last development post but I didn’t work too much on this one since my main goal the last weeks was to actually have a working version of Stonks.

Also, for Summer Snow Day, Chad came back from his holidays and we are planning to keep working on it as soon as possible. Since making the scripts takes a lot of time, at least to give them the quality they deserve, I will probably start tackling down some of the minigames we still have to make. This way we can keep having progress on the game and give him extra time to work on the scripts.

And I am not sure if you had already read this, but I made a new post about every way to communicate Unity’s MonoBehaviour scripts. This is my first programming-related post of the year. If you are a programmer and the title appeals to you, please consider reading it!

That will be all for now, please stay tuned, and thank you for reading!


Tags:

Posted by MonoFlauta - January 22nd, 2022


Twitter Account - DevBlog - Ko-Fi


Hello, everyone!

I will be writing about every way you have to communicate a MonoBehaviour with another MonoBehaviour. But first, I will start with a few disclaimers!

First, I hope I didn’t forget a way of doing this, if I did, please mention it in the comments.

Second, I will be giving my personal insight about advantages and disadvantages. I recommend you always think critically and use what suits your project. I am a strong believer that there isn’t a silver bullet to solve all problems and everything depends on the context of your project.

Third, take in mind that I am explaining general versions of each way of communication. You can start from one of those and make small modifications that may work better for your needs. The idea is that you get a big picture of all the options which gives you a powerful tool to chose what is suits your project the best.

So let’s get started with the list!


Reference in the inspector

One of the easiest ways is to have a public reference in your MonoBehaviour class. That way, Unity will let you just drag the object from the Hierarchy or the Project tabs.

iu_530903_2529638.png

In the above image, you can see how I have a StatusGridView MonoBehaviour class that I can set to the UnitContainerView MonoBehaviour class.

The easiest way to do this is by just adding the following line of code inside your class:

public StatusGridView statusGrid;

That way, Unity will recognize that StatusGridView, in this case, is a MonoBehaviour and it will let you drag it from the Hierarchy or the Project tab.

In case you don’t like having your classes public because of encapsulation and other things like that, you can also use the SerializeField tag by doing this:

[SerializeField] private StatusGridView statusGrid;

By doing so, you will have the same result but this time you won’t be able to access its value directly from another class. We use a lot the SerializeField tag option at my work because of the encapsulation but in my personal projects, I prefer using public because it lets me use TDD easily in my view objects.

The only downside I see to this approach is that doesn’t work in runtime. If you want to assign a reference in runtime you will have to do it by assigning it from another MonoBehaviour that has reference to yours or, when making an instance of a prefab, saving the reference or else it will be lost.

So let’s recap its pros and cons, at least in my opinion!

Pros

  • You can assign MonoBehaviours in the Scene by just dragging them from the Hierarchy
  • You can assign MonoBehaviours as prefabs by just dragging them from the Project
  • You can make the access to the field private if needed

Cons

  • It doesn’t provide a solution by itself when assigning values in runtime

This one is one of the most common and useful ways to do it. It is also probably the most performant one so I believe everyone can manage by just using this approach.


GetComponent<T>

This is another common way of searching for components in the same GameObject. Imagine you have YourComponent in a GameObject and it is AnotherComponent in the same GameObject. If you want to get a reference from the first one to the second one you can easily do in the first one:

var theOtherComponent = GetComponent<AnotherComponent>();

This way, Unity will search for a reference of the other component that your game object has. Take in mind, that if your game object has multiple copies of AnotherComponent script, it will pick one randomly. In that case, you will want to use GetComponents and then filter or search somehow for the component you need.

GetComponents<AnotherComponent>();

I am personally not a fan of this approach unless it is actually needed. I believe this is an expensive approach for Unity because it has to search through the MonoBehaviour components and filter them by their type.

Although this doesn’t mean it can’t be useful. It is a really common approach when two objects collide in Unity. For example, in Yemita we had to use it when two objects collided and we wanted to affect the other game object. We had something like this:

private void OnTriggerEnter(Collider other){
    if(other.gameObject.layer == 8)
        other.GetComponent<OtherClass>().DoSomething();
}

Here, also the performance was a key thing so what we did was to use Layers in order to filter collisions and don’t have to check that GetComponent<OtherClass> is not null. Consider doing this to avoid unnecessary checks in the Unity physics system or in your code.


iu_530904_2529638.png

Something similar you will have to do for example if you use Raycasts in order to get other game objects which you didn’t have a reference to before.

Also, one small note, you can also use GetComponentInChildren<T> and GetComponentsInChildren<T>. This one will work very similar to GetComponent<T> but will include components in game objects that are children of the game object where your component is.

So, making a recap:

Pros

  • You can get reference to multiple components in your game object or it’s children.
  • You can get a component reference in runtime of other game objects you didn’t know before but you now do (because a collision for example).

Cons

  • It is an expensive way regarding performance of getting components.
  • When having multiple components, you may have to filter it.
  • It will return null if the component doesn’t exist, meaning you have to somehow check it.

This approach is a dangerous one when you abuse it or you are not careful with its downsides. Anyway, this doesn’t mean it isn’t useful or even needed. I personally use it a lot in games that use physics since I believe it is the best approach for those cases.


FindObjectOfType<T>

I believe this one is the “I still don’t know how to make a Singleton” or “I still don’t control the other two above approaches correctly” way. It is hard for me to believe this one is a good approach but let’s check it out to have an idea of what it actually implies and even find it a useful use.

The idea is that you can do from almost anywhere:

var otherMonoBehaviour = FindObjectOfType<OtherMonoBehaviour>();

This thing is a really expensive thing. It will search through the whole game objects in the scene until it finds the component you are searching for or return null if it doesn’t find it. Even more, you could use FindObjectsOfType<T> to find all the MonoBehaviours of that type.

Even it is a really powerful tool, it has a few downsides that are the performance I already mentioned and the fact that you literally get references to everything, which is kinda dangerous if you are not careful enough. You could change the state of something you didn’t want to.

I think your solution to using FindObjectOfType depends on what you want to do. Here are two cases I believe are the most common ones you would try to use:

  • You have a Manager of some kind, maybe a HUDManager with the score and you want to get reference to it and add some points maybe? Even this is not the best approach regarding best practices of code, it is a common thing when you are learning or just making a quick game for a game jam. In that case, I strongly recommend just make a Singleton, you already left that high quality code path but you don’t have to deal with performance issues. In the next part I will explain the Singleton approach if you need it.
  • You created things in runtime and now you don’t have reference to them. I believe here the best would had been to save them in vars and just past them through to the object you need. The same would be if you are already in runtime, try to have a reference to something it has the reference you need. Think it as a puzzle. You probably can solve it by using the reference in the inspector or the GetComponent<T> approach at some point and from there pass the reference.

Having said all of these, I believe there is a big use for FindObjectOfType<T> but is not during runtime, instead, I sometimes use it when having to get references in my Editor Tools. Sometimes, you are making an editor tool that manipulates a reference in the Scenes so it is a good idea to get the references that way. Think also that most of the references are already there, maybe you don’t have another game object with the references and a Singleton is a difficult thing to use during editor because the things are probably not initialized yet. For last, consider that even it is an expensive method to call, in runtime you probably have some extra freedom to use the extra resources.

Having said all this, let’s make a recap:

Pros

  • It is pretty easy get a reference to any MonoBehaviour that is in the Scene.
  • Very useful when making editor tools that manipulate the Scene’s MonoBehaviours.

Cons

  • Can’t stress this enough but: very expensive regarding performance. Even more if you are using it during runtime, with a ton of MonoBehaviours and on every update.


Singleton

Another way to get a reference to the things is by using the Singleton way. It is not a good practice at all, it is actually considered an anti-pattern, so make sure this is what you want to do and its dangers of using it.

I already made what I believe was a good explanation on how to make a good Singleton in Unity at my 4 Horsemen of the Game Jams: 4 nasty tricks to get results fast in Unity post. Anyway, I will make a simplified and most common way to implement it here.

Usually, you will have a static field that references the class you are in. This can be something like:

public static MyMonoBehaviourClass Instance;

And then you can, at the Start or Awake method, do something like:

Instance = this;

This way, all classes through all the project will be able to access this class by doing:

MyMonoBehaviourClass.Instance.DoSomething();

Take into consideration that this is the very simplified version of a Singleton. In this approach, anyone could modify the reference of the Instance. This could be modified by making a private instance and making a GetInstance of that for example.

I will make the list of pros and cons where I am going to list the most important cons in my opinion:

Pros

  • You can access a class from all the other classes.
  • It is a fast and cheap way of doing it.

Cons

  • You can access a class from all the other classes. It doesn’t suit too well with the best practices.
  • You can only have one instance of the object because of it’s nature. You could make a list but that will need some extra management.
  • You have to be careful in Unity when using different scenes. Think on how you are going to manage the reference when moving to another scene.
  • It is a difficult thing to work with when doing Test Driven Design.

All these things don’t mean that you shouldn’t use them although I only recommend it if you are in a game jam and need quick results. If not, I personally recommend you search for another approach of doing getting the results you need. Probably with the tools I already mentioned you should be able to.


Wrapping up

These are the ways I believe you can communicate between classes. At this point, I may be forgetting other approaches but I believe these ones are the most common ones between experimented and new programmers.

I didn’t include all the variations of these approaches for example FindGameObjectsWithTag since I am not a fan of using tags and I think it is pretty similar to FindObjectOfType<T>. Or GameObject.Find(“”) name because you will be tied up to the game object name and has similar performance problems to the one I explained.

Sometimes, I mentioned that some of the approaches are not the best regarding best practices or performance. I strongly believe that if you are still learning the basics, don’t feel bad for using this approach. Use the ones you feel more comfortable with and when you feel ready, investigate more about best practices in programming. Remember that your goal will be always making good games and, while you don’t get to performance issues, everyone will be able to enjoy your game without knowing how it was coded.

If you have read everything down here, I want to give you a huge thank you! Please consider leaving a comment if you enjoyed it or have any questions.

Hope you had found it useful!


Tags:

4

Posted by MonoFlauta - October 23rd, 2021


Hello, everyone!

We just uploaded Puppet Manor for the Scream Jam 2021 and you can download it at itch.io.

iu_453289_2529638.webp

Please consider trying it out! Here is the description of the game:

Puppet Manor is a horror game where you try to escape from a monster spider who can control the mannequins that live there. Grabbing tools that will help you open doors while making sure neither the spider nor its mannequins get you will be your primary goal. Will you be able to escape without getting grabbed?

This game was made for the Scream Jam 2021.

FEATURES

-Monster with unique IA and multiple possible actions

-Custom random triggered events

-First-person movement

-Hiding, picking, and crouching in small places

iu_453288_2529638.webp

And here are the credits:

Artists: Hugo Miraballes, Nicolas Goyret & Santiago Menendez

Level Design: Kevin Miles

Programming: Alan Rosas, Andrea Alonso, Lautaro Bravo de la Serna & Facundo Balboa

Music: Santiago Bravo de la Serna & Gonzalo Szechter


Tags:

1

Posted by MonoFlauta - September 26th, 2021


Twitter Account - DevBlog - Ko-Fi



Hello, everyone!

I just uploaded a new demo for YBit that you can play for free on any browser at https://www.newgrounds.com/portal/view/816169.

iu_430348_2529638.png

The game was originally released on 2018 at Steam and itch.io and you can still buy it at a really low price if you want to support us!

Anyway, with the demo, you will be able to fully play 50% of the game and have, what I hope it is, a really nice experience.

iu_430347_2529638.jpg

Hope you can try it out if you didn’t play it yet and have fun with it!


Tags:

1

Posted by MonoFlauta - August 22nd, 2021


Twitter Account - DevBlog - Ko-Fi



Hello, everyone!

Some updates about the games I am working on and future plans!

Summer Snow Day

This week we started working on the fourth chapter of Summer Snow Day. Chad sent the first parts of the chapter and I am already having a lot of fun adding them and knowing how the story develops!

iu_396740_2529638.webp

We still need to add a few details for chapter 3 yet but it is almost done. The game is feeling rock solid and I am actually loving it. Also, I can’t stop thinking how awesome the art of KaosuKun looks.

Apart from these new content, we had been also fixing dialogues and small bugs we found playtesting the older chapters. I think that each of these fixes push the game quality further and we hope you will have fun when playing it!

Yemita Update

We also made a new update with fixes for Yemita and some improvements for the camera. Sadly, we still believe the camera has a lot of room for improvement but it will be way to difficult for us given the nature of the gameplay.

Other projects & Game Jam

Meanwhile, I had been working on other projects but some of them I don’t have enough content to show yet or I am working it in a really slow pace in some extra time I find. Don’t worry though, I plan to post updates in the near future specially for Is This Still Tennis.

Also, we had been talking about making another game for a game jam and we decided in October we are going to make a horror game! We already decided the game jam we are going to join but we will give more details when the game jam starts. This will be the first time all of us make a horror game, and I particularly suck at those games, so we will see what we can come up with given this huge challenge!

That will be all for now, thank you for reading!


Tags:

Posted by MonoFlauta - August 14th, 2021


Twitter Account - DevBlog - Ko-Fi


Hello, everyone!

We teamed up with Hugo Miraballes, Martín Martelletti, Kevin Miles, Lautaro Bravo de la Serna, Santiago Bravo de la Serna and Hernan Colantuono, with extra help from Antonela Valente with the voices, and made Yemita for the Newgrounds Game Jam 2021.

The theme was Egg

iu_388225_2529638.jpg

Day 1/10

The first day we took a lot of time planning what we wanted to do. We went through game genres like puzzle, action, horror, everything… Finally, we decided to make a game of a Yolk on a rampage inspired in GudetamaKatamari Demacy and what would the community of Newgrounds do with these.

From there, Hugo started making our main character while the rest of us started working on the basic mechanics using boxes.

Day 2/10

This was the first full day we worked on and we actually made a lot of progress from this. Lauta and I worked on the basic layout of the map where the player would run as chaotic as possible but trying to give it some paths he could take and we also worked on the character movement, though still needed some extra work, some hazards and the camera.

iu_388224_2529638.jpg

Also, this day Kevin got to work on the main menu and Martín was able to start tweaking the player movement. Meanwhile, Hugo finished the character with the basic animations we needed to start and helped to integrate it to the game.

It was a nice thing to have for the second day because we started to have clearly what was going to need extra polishment and what the game needed to be fun.

Day 3/10

A lot of polishment came this day. From one side, we focused on making the character controller feel a lot better than before. At this point we had 18 parameters that tweeked and gave the final feel to the character movement (and more to came!)

iu_388228_2529638.jpg

Meanwhile, Hugo worked on all the destroyables and the broken glasses that Martín began to place and with Lauta we made the broken pieces pop. All these things gave the game a more alive feeling. Also, this day Lauta started with the Chef (the pink box behind the bar) and we had almost a full behaviour of it working.

Day 4/10

I barely was able to contribute this day. I was vaccinated the day before and I felt terrible with fevers and everything. Anyway, the rest of the team was able to make some progress, most in the level.

iu_388226_2529638.jpg

Also, Kevin started working on the particles that we were going to add and we helped to find some references for Hugo to model.

Day 5/10

By this day we made a huge list with all the things that left on the game. We playtest it and tried it to find out what the game was needing to be more fun. We agreed that it still needed to have a more fluid movement and it needed to be faster so that would be something to tackle in the next days. Also, a few cool ideas to make the gameplay more meaningful were written down and we planned to check them out to see if they would be a nice fit.

Meanwhile, we got some progress with the chef and also had a bunch of new assets and textures. As you can see in the image below, the stools, the texture of the floor and benches were some of the things we added.

iu_388227_2529638.webp

For last, we had a lot of fun leaving random messages at would be the menu. Hopefully they aren’t too misspelled or with gramatical errors but I can’t promise too much.

Day 6/10

At the sixth day Martín had the idea of big light pannels where the player would bounce around and also worked as the extra level of height we were planning to have in order to give more depth to the game and space to explore. I think it was a nice addition that added diversity to the map.

iu_388229_2529638.webp

Also, we made a big change in the gameplay and now the player doesn’t have lives, instead, it has a timer so it can move a lot more freely without worrying about all the broken stuff. With this, Lauta also worked on making the end game sequence so he took care of making all the gameplay flow this day.

Meanwhile, Kevin worked on textures for the bottles adding labels. He searched for interesting texts he could add to the labels and I think they look great and original

For last, I worked on making the sushi convoy belt that now drags not only the character but everything it goes over it and made a system that we would use later for the medals inside the game.

Day 7/10

On this day I worked in fixes with everything related to the physics. Adjusted colliders, adjusted forces, performance optimizations and fixed bugs were the character would jump weird after colliding with what was going to be the chef.

iu_388230_2529638.webp

Talking about the chef, Lauta made a really fun change for it. At first, we had it throw knives to the player but, since we are not going to have a lives, he decided to change it for bottles that break on impact adding more chaos to the game. The bottles can disturb the player but what it is really fun is the chaotic feel it now gives. Also, apart from the chef, he added food attached to balloons to fill the top level with the lamps. One of our focus was the need to add more variety to the level and we thought this was the right direction.

Lastly, Hugo worked in a ton of art assets. He had a huge list of 3D things to do and he was focusing purely and exclusive on it. Though it is a lot left, he already made a bunch of progress and the map started to feel a lot better to the eye than those placeholder cubes.

Day 8/10

By this day we were ready to start with the medals so we brainstormed a bunch of them, wrote them down in a google sheet and then Kevin made the art for most of them while I coded most of them.

iu_388231_2529638.webp

Apart from the medals, Hugo did all the model, texture, rig and animations of the chef character and with some help of Lauta they had it working that same day. It was nice to finally have the chef instead of the pink box because it added a lot of life to the scene that was missing.

By this day, we also noticed we weren’t following too much the theme but we were ok with this because we understood that the game design decisions we took were aiming to make the game a more fun experience.

Day 9/10

At the end of this day we had almost everything working and the game almost ready to deliver. We finished integrating most of the medals, only a few icons left from them. We also added a bunch of particles when the stuff breaks, get hits and moves. And Hugo added a bunch of new art assets that gave a lot of life to the game such as the ramen inside the bowls

iu_388232_2529638.webp

Also, Martín and Lauta worked in a new area that is behind the sushi belt. With that area, and the medals we aimed to invite the player to do some exploration and replay the game more than once.

For last, Lauta got to add a lot of sound effects. Although we still needed to add the music and adjust the sound effects after that, it was already feeling really good!

Day 10/10

Last day of the game jam we worked on integrating the last medals, some screens, the music and wrapping up the Newgrounds API.

Also, from the art side, last details from the screens were polished and a lot of decoration like the boxes were added to finish giving life to the japanese restaurant. It was a nice thing to have it all wrapped up and being able to play it as a solid game.

3 things that could have been better

  • The camera didn’t work as planned. We knew there were some issues with the camera but we never got the time to actually have it as we wanted. Maybe we should have dedicated extra time to it but it was still a very difficult task because we got used to it really soon.
  • Apparently we can’t stay in the theme of the game jam. We always start with an idea we think will fit the theme but we the time we start to make changes and we end up with a game that doesn’t hit the theme at all.
  • Having one person to make all the 3D art was a bit insane. Hugo had to work way too much and with an intense rhythm in order to get everything done. Even more, at times it was difficult for Lauta and me to find stuff to code because many times we were blocked waiting for art.

3 things that did work out

  • Making everything breakable was a really fun thing. Somebody even said it reminded him to Goat Simulator, and for me that is a total win. Once again, abusing the use of physics in Unity I think that really paid off.
  • Hugo has been able to make a bunch of art thanks to vertex paint. Not gonna lie, I am not sure how he did it but if you have an artist and you are aiming for a 3D game for a game jam, it can save you a lot of time so you probably should look it up!
  • The huge amount of medals integrated with the Newgrounds API have an extra purpose to the game and I really liked that. It even gave a reason to explore and not only make a lot of havoc to get a highscore.

8th of 104 games

Luckly for us, the judges decided the game finished in the podium, exactly 8th, from the 104 submissions that were uploaded.

The whole team clearly put their all into the pure charm of Yemita, with very clean 3d visuals and catchy music. The gameplay too, while a bit difficult to get the hang of, is simple and fun, and I love all the different nooks and crannies to eggsplore in the level.
Eggburn from Newgrounds

It was the first time we finished on the podium based on judges votes so it was a nice thing to have. Also, at least from me, it was an extra because it was on Newgrounds and you know I am kinda a fan of Newgrounds

Where can I play it?

If you didn’t play it yet, I recommend you to play it at Newgrounds while being logged in so you unlock medals and upload your highscore to the table!

That would be all for now! Thank you for reading!


Tags:

6

Posted by MonoFlauta - August 8th, 2021


Hello, everyone!

Going to make some updates regarding Is This Still Tennis, Summer Snow Day and other news.

After working on Yemita, I went back to my long time projects. I will probably focus mainly on Is This Still Tennis and another project I didn’t announce yet, for the rest of the year. Although, if an opportunity for another game jam attracts me maybe I take another break and participate on it ^^

Is This Still Tennis

For Is This Still Tennis I had been fixing a few bugs that I left and I finished integrating an enemy Roberto made: The Squirrell

iu_381530_2529638.webp

Roberto already made a bunch of enemies with their assets but, except for the squirrell, they all need their animations which he will be probably doing soon!

The game feels now a lot more alive by having an actual enemy infront of you that throw the projectiles, recieves the impacts and actually shows up and dies when you defeat him. Although there are still a few adjustment like the enemy throwing the correct projectile in the animation, I am pretty happy with this new addition.

Summer Snow Day

Regarding Summer Snow Day, we had been with Lauta making adjustments from a big list Chad made. We have almost all of it done and the games feels really solid, in my opinion, with a lot of details that aren’t really common in visual novels. I hope these kind of details make it pop out and make it feel unique (apart from the plot which I am really enjoying).

iu_381531_2529638.webp

One of the latest details we added is the breath effect, which you can see animated in a gif at my Twitter account.

Meanwhile, Chad had been working on the fourth chapter and he will be probably sending it to us soon so we should be able to start adding it to the game really soon hopefully!

Other news

Apart from Is This Still Tennis and Summer Snow Day, I had been working now for a long time on another project which I will try to start showing updates as soon as it doesn’t have so much placeholder art. Anyway, I can start telling you that it will include a dungeon and dices with some nice unique mechanics as far as I know.

Also, I returned to keep updated my Facebook page and my Ko-Fi page so consider following there and if you aren’t doing it yet, consider following me on Twitter too!

For last, I renewed my Newgrounds Supporter membership. I will always be gratefull to Newgrounds for helping me find my vocation.

That will be everything for now! Thank you for reading!


Tags:

Posted by MonoFlauta - July 27th, 2021


Full Post - Twitter Account - DevBlog


Hello, everyone!

This time I will show you a list of useful Unity extensions and the cases where you can use them. I had been looking around to expand my list of useful extensions and some of them were pretty interesting plus I already had a few I normally use.


iu_370264_2529638.webp


What are extension methods and how do you create extension methods in C#

The extension methods in C# are methods that let you extend the functionality of any class. Basically, you can add an extra public method to the class. Beware that you will not be able to access it’s private values while doing this.

In order to create them, you just need a static class, for example ClassToExtendExtensions.cs and add static methods like this:

public static void ExtensionMethodName(this ClassToExtend o)
{
    //Do stuff
}

Apart from the static, take in mind that we are adding a this before the ClassToExtend parameter. You can also ask for more parameters but by having this, you can just do:

myClassToExtendInstance.ExtensionMethodName();

And so, you extended the class without having to actually modify the class. Pretty useful for classes you can’t modify.

Now lets see some useful method extensions!

Vector extensions

You will be probably using a lot of Vector3 or Vector2 in your games. So here are a few extension methods for that:

public static Vector2 SetX(this Vector2 vector, float x)
{
    return new Vector2(x, vector.y);
}

This method sets the value. Since you can’t set the x or y value, you can have this one. I recommend adding the y one and you can do the same for the Vector3.

public static Vector2 AddX(this Vector2 vector, float x)
{
    return new Vector2(vector.x + x, vector.y);
}

As the upper one sets, this one lets you add or substract to a value. The same you can do with y value and with Vector3.

public static Vector2 GetClosestVector2From(this Vector2 vector, Vector2[] otherVectors)
{
    if (otherVectors.Length == 0) throw new Exception("The list of other vectors is empty");
    var minDistance = Vector2.Distance(vector, otherVectors[0]);
    var minVector = otherVectors[0];
    for (var i = otherVectors.Length - 1; i > 0; i--)
    {
        var newDistance = Vector2.Distance(vector, otherVectors[i]);
        if (newDistance < minDistance)
        {
            minDistance = newDistance;
            minVector = otherVectors[i];
        }
    }
    return minVector;
}

Now this one is a bit more complex but you can make many variants from it. This method will bring you the closest vector from a list. You can use it to give a list of positions and know the closest one of them. From this one, you can also make the Vector3 variants, the one that brings you the closest distance (float value) and the farthest version.

GameObject extensions

Every thing you will Instantiate will be a GameObject so it would be wise to have some extensions for it! So here we go:

public static T GetOrAddComponent<T>(this GameObject gameObject) where T : MonoBehaviour
{
    var component = gameObject.GetComponent<T>();
    if (component == null) gameObject.AddComponent<T>();
    return component;
}

With this method you can automatically add a component in case the GameObject doesn’t have it yet. Beware that the component will have nothing assigned if its created, you should be very careful with what components you use this method.

public static bool HasComponent<T>(this GameObject gameObject) where T : MonoBehaviour
{
    return gameObject.GetComponent<T>() != null;
}

And this method will tell you if the GameObject has or not a component. Useful if you are adding constantly components because gameplay requirements.

List extensions

Another thing you will use a lot, or at least we did when making Paw Pals for example, will be List extensions.

iu_370263_2529638.webp

Here is the one I find the most useful one:

public static T GetRandomItem<T>(this IList<T> list)
{
    return list[Random.Range(0, list.Count)];
}

This one will give you a random item from the list. I, personally, use this one a lot https://s.w.org/images/core/emoji/13.1.0/svg/1f642.svg

public static void Shuffle<T>(this IList<T> list)
{
    for (var i = list.Count - 1; i > 1; i--)
    {
        var j = Random.Range(0, i + 1);
        var value = list[j];
        list[j] = list[i];
        list[i] = value;
    }
}

And this one is another one I often use that shuffles a list. You can use this one for example for a random turn based game.

Transform extensions

This two methods I am going to show you I found them recently and I though they were really clever ones.

public static void DestroyChildren(this Transform transform)
{
    for (var i = transform.childCount - 1; i >= 0; i--)
    {
        Object.Destroy(transform.GetChild(i).gameObject);
    }
}

With this one, you can clean for example GameObjects you were using as containers.

public static void ResetTransformation(this Transform transform)
{
    transform.position = Vector3.zero;
    transform.localRotation = Quaternion.identity;
    transform.localScale = Vector3.one;
}

And with this one you can reset the transformation. Setting it as its neutral pose.

Rigidybody extensions

And for last! Two more methods for rigidbodies I had found useful in the past.

public static void ChangeDirection(this Rigidbody rb, Vector3 direction)
{
    rb.velocity = direction.normalized * rb.velocity.magnitude;
}

With this one you can change the current direction of a rigidbody while keeping it’s velocity. Also, you can make the Rigidbody2D alternative.

public static void NormalizeVelocity(this Rigidbody rb, float magnitude = 1)
{
    rb.velocity = rb.velocity.normalized * magnitude;
}

And with this one you can normalize the velocity to a target speed while keeping the direction.


You can finish reading this post at my DevBlog (for free of course!).


Thank you for reading and feel free to ask me if you have any question!


Tags:

Posted by MonoFlauta - July 25th, 2021


Hello, everyone!

Just wanted to make a quick post about our new game Yemita. This game was made for the Newgrounds Game Jam July 2021.

iu_367905_2529638.webp

Please consider trying it out :) ! and here is the full description of the game:

Yemita is a game where you control a yolk on the run and destroy everything on your path in a japanese restaurant. The chef was trying to add you to a ramen bowl but you decided you are not ready to be eaten. Because of that, your goal will be to create as much destruction as possible in your short life.

This game was made for the July Newgrounds Game Jam 2021. The theme for the jam was “Egg”.


FEATURES

  • Lots of stuff to break
  • A running yolk with an over detailed butt
  • Cozy japanese restaurant
  • Crazy octopus chef that may get angry if you hit him
  • Bamboo plants
  • Did we mention a lot of stuff that can be broken?


CREDITS

Game Design: Martín Martelletti

Artists: Hugo Miraballes & Kevin Miles

Programming: Lautaro Bravo de la Serna & Facundo Balboa

Music & SFX: Santiago Bravo de la Serna, Hernan Colantuono & Antonela Valente


4

Posted by MonoFlauta - July 4th, 2021


Full Post - Twitter Account - DevBlog


Hello, everyone!

I am going to explain the Object Pool I usually use. You can find the full version on my Framework Goat if you are interested.

iu_348517_2529638.webp

Witchcraft used Object Pool for the spells


What is an Object Pool

Object Pool is a programming pattern used to reduce performance issues related to object creation by expending extra ram by doing so.

The main concept or idea is that you don’t create new instances of object but instead recycle the ones you have after finish using them.

The full loop of an Object Pool would be something like this:

  1. You start with x amount of the object
  2. Each time you need an object, you ask for the Object Pool to give you one
  3. Once you finish using the object, instead of destroying it you give it back to the Object Pool

Of course there are some extra considerations to take care of like these ones:

What happens if the Object Pool runs out of objects? It creates new ones? Returns null?

  • I personally recommend creating new ones. They will be added to the stock in case you reach a new amount and you will not need to check for null references.

With how many objects should I start?

  • It will depend on what the Object Pool pools. You can make tests to see the max amount and use that as base so you don’t have to create them on runtime.


Why use generics?

You can make an Object Pool without generics but using generics will give you a huge advantage. Basically, generics allows you to define placeholders for the types you are going to use in some parameters.

So, instead of doing something like:

public class ObjectPoolForBullets {
    //Stuff
}

and

public class ObjectPoolForEnemies {
    //Stuff
}

and…

public class ObjectPoolForEffects {
    //Stuff
}

You can solve all of them by doing:

public class ObjectPool<T> {
    //Stuff
}

And when you define the field type you will just need to say what type between the <> like this for example:

private ObjectPool<Bullet> _bulletPool = new ObjectPool<Bullet>(); //This will have parameters inside

Even more, you will be able to have this class pre-saved and use it in any game jam you want to participate!



Why use Factory Method?

When using generics, you won’t know what type of object you are going to use. Yet, you will need to know how to create it if you want to have more during runtime.

The goal of factory method is that you have a method you can call and it will return that object to you. You will only need to know the method instead of how to create it. So you can have something like this as parameter:

public ObjectPool(Func<T> factoryMethod...) //It will have more parameters

Notice how that T will be the same that the class defined. Basically, as it is a Func<T>, you will be able to call that method without parameters and it will return you a T created. So, thinking only in making this Object Pool, you have all what you need. You don’t have to worry anymore on how to create T, you just know what you need to call in order to create it and get it.

iu_348516_2529638.webp

We used the exact Object Pool you can see in Framework Goat for Blight (a game jam game) for all the bullets and enemies



How to create it

I am going to show you step by step how to create this Object Pool. Notice you can make changes if you want or you have different requeriments.

So, first of all, as I showed before, we will need a Object Pool class with the generics <T>.

public class ObjectPool<T>
{
}

From there, let’s create the constructor and see each value we will need:

private readonly List<T> _currentStock;
private readonly Func<T> _factoryMethod;
private readonly bool _isDynamic;
private readonly Action<T> _turnOnCallback;
private readonly Action<T> _turnOffCallback;


public ObjectPool(Func<T> factoryMethod, Action<T> turnOnCallback, Action<T> turnOffCallback, int initialStock = 0, bool isDynamic = true)
{
    _factoryMethod = factoryMethod;
    _isDynamic = isDynamic;

    _turnOffCallback = turnOffCallback;
    _turnOnCallback = turnOnCallback;

    _currentStock = new List<T>();

    for (var i = 0; i < initialStock; i++)
    {
        var o = _factoryMethod();
        _turnOffCallback(o);
        _currentStock.Add(o);
    }
}

So lot of stuff going on here. First, lets check what every parameter will be used for:

  • factoryMethod – As mentioned before, this one will be used in order to us be able to create new objects when needed without having to know how to create it
  • turnOnCallback – We are going to use this method to activate our object. So, each time someone request an object to our Object Pool we will make sure it is ready to use and activated. We are using Action<T> because we don’t know how this object will be activated but we can send it by parameter.
  • turnOffCallback – We are going to use this method to deactivate our object. So, each time someone returns an object to our Object Pool because they doesn’t need it anymore, we make sure it is deactivate. As in the last one, we will use the Action<T> for the same reasons.
  • initialStock – This one is the initial stock we are going to use for the Object Pool. I had given it a 0 default value in case the user of the Object Pool doesn’t want to have an initial stock.
  • isDynamic – Remember the question of what we should do if we run out of objects? Well, the Object Pool is called dynamic if it creates in runtime when running out of objects. If not, it will return the default value of the type.

Those are all the parameters our Object Pool will need to work. You can make it simpler than this but I prefer to have all this functionality in order to don’t have future issues like forgetting to activate or deactivate the objects.

Now let’s check the body of the constructor. The first lines are just saving those values and initializing the list of objects. Then, we have a for that creates each object, it deactivates it just in case and then adds it to the current stock of the Object Pool.

That is all for the constructor. We asked for everything we need, we saved all the stuff we are going to need later and we created the initial stock.

We are going to need to extra methods now. The first one we are going to do is a method that lets me get an object from the Object Pool.

The method will be like this:

public T GetObject()
{
    var result = default(T);
    if (_currentStock.Count > 0)
    {
        result = _currentStock[0];
        _currentStock.RemoveAt(0);
    }
    else if (_isDynamic)
        result = _factoryMethod();
    _turnOnCallback(result);
    return result;
}

So, let’s see what we are doing here. First, let’s check the method firm. The Get Object will receive nothing, because we just want to get an object and it will return a T type that is the type of the object that saves the Object Pool.

Now we can check the body. First, we assign our result value as a default(T). Why default(T)? Because we don’t know if the object we are going to use has a null state.

Then, in the if we are going to check if we have stock. In case we do, we take the first one and remove it from our stock. If we don’t, we check if the pool is dynamic and we create a new one using the factory method.

For last, we now have the object we are going to use so we just need to turn it on using the turn on callback we got from the constructor and return it.

Now we have the constructor to set all what we need and a method to get objects from the Object Pool. The last method we are going to need is one that lets us return the object to the Object Pool. For this, we are just going to need the following method:

public void ReturnObject(T o)
{
    _turnOffCallback(o);
    _currentStock.Add(o);
}

As you can see, it is a really simple method. We just need to pass it a T object and it will deactivate and add it to the stock. That’s all it needs to do.

Final result

The final result of what we did is the following:

public class ObjectPool<T>
{
    private readonly List<T> _currentStock;
    private readonly Func<T> _factoryMethod;
    private readonly bool _isDynamic;
    private readonly Action<T> _turnOnCallback;
    private readonly Action<T> _turnOffCallback;

    public ObjectPool(Func<T> factoryMethod, Action<T> turnOnCallback, Action<T> turnOffCallback, int initialStock = 0, bool isDynamic = true)
    {
        _factoryMethod = factoryMethod;
        _isDynamic = isDynamic;

        _turnOffCallback = turnOffCallback;
        _turnOnCallback = turnOnCallback;

        _currentStock = new List<T>();

        for (var i = 0; i < initialStock; i++)
        {
            var o = _factoryMethod();
            _turnOffCallback(o);
            _currentStock.Add(o);
        }
    }

    public ObjectPool(Func<T> factoryMethod, Action<T> turnOnCallback, Action<T> turnOffCallback, List<T> initialStock, bool isDynamic = true)
    {
        _factoryMethod = factoryMethod;
        _isDynamic = isDynamic;

        _turnOffCallback = turnOffCallback;
        _turnOnCallback = turnOnCallback;

        _currentStock = initialStock;
    }

    public T GetObject()
    {
        var result = default(T);
        if (_currentStock.Count > 0)
        {
            result = _currentStock[0];
            _currentStock.RemoveAt(0);
        }
        else if (_isDynamic)
            result = _factoryMethod();
        _turnOnCallback(result);
        return result;
    }

    public void ReturnObject(T o)
    {
        _turnOffCallback(o);
        _currentStock.Add(o);
    }
}

You should be able to take this C# script and take it to any project. Even more, you can make this structure in other languages. I did something similar in AS3 for my Framework Mono.

iu_348515_2529638.webp

The spheres in Skeleball also used this Object Pool



You can finish reading this post at my DevBlog (for free of course!). Though with all this content you can already create it and use it :)


Thank you for reading and feel free to ask me if you have any question!


Tags: