Right/Wrong design for game using Defold

Hi, long time no see :smiley:

Yesterday I had some free time, so I decided to do Flappy Bird in Defold. I know… not very original but it’s similar enough to the Infinite Runner tutorial that if I got stuck then I had help but it would not allow me to copy paste my way out so I would be forced to understand the underlying mechanics.

All was well until I got to the part with reusing pipes and deleting objects where I noticed that I went on a different route than the tutorial.

So now I have two possible design:

A. There’s a main/level script that has references to everything and acts as a central hub (move objects, receive/send messages, take input, holds gravity, friction etc.).
Good part: Use a for and update positions/state for all objects no matter how many. Hold the state of the game. Seems fast.
Bad part: Everything in one place.

B. Each gameobject has a script and it updates itself. Communication by message with all other objects.
Good part: Seems very nice for some reason.
Bad part: If too many objects then I fear some limits for message, memory etc will be hit.

What do you feel is the intended design?

Thanks

2 Likes

Don’t know about intended design but to keep everything in one place is usually the quickest and easiest approuch. Makes the game easier to port, reuse, optimize and to get another idea and just run with that instead. But it can be a bit “dirty” of course but since it’s a quick game like flappy bird, it should be a little dirty. ;D

1 Like

Yep… I went with option A and I just need to add some sounds and more fx.

Technically the mechanics were done in under 1 hour. Adding fx/GUI took some more time. Adding polish takes a lot of time.

1 Like

My few cents…

For a game like flappy bird I would definitely avoid any centralized hub.

Every pipe has a script that just lets it animate to the left and then destroy itself when out of screen bounds.
It might also position itself randomly on the y-axis at init.
It also has two collision shapes (one for each pipe upper/under)

“bird” itself just handles its own input and y-movement and checks for incoming collision-message. That would kind of be it.
Only thing that I would put into some “main gameobject” would be a script that spawns the pipes regularly and also maybe shortens that span to increase difficulty.

Creating I guess 20+ small projects in Defold I am trying more and more to find a good way of designing things and it really awards keeping things decentralized if gamedesign allows it.

EDIT See now that you went further on your choice of design. For this small kind of project it just doesnt matter. It’s just if you want to learn yourself the way of thinking I guess. I got the urge to create a small livestream tutorial on just the flappy bird subject. From beginning to end.

3 Likes

You’re right @Andreas_Jirenius.

I chose Flappy Bird as it is a very known game with very clear mechanics and it’s a good way to test Defold and learn the way of thinking.

Looking forward to the livestream.

1 Like

Hi Fuscy. Had the stream yesterday but it seems like the video somehow wasn’t archived at Livecoding.tv . I have contacted them to see if they can restore it somehow. Either way I recorded it locally as well so if LCTV cannot find it I will try to put it up somewhere for download.

3 Likes

Thanks :slight_smile:

You could try uploading on YouTube. It’s super easy and then a lot of people could see it and Defold. Nothing beats the billions of eyes Youtube offers.

3 Likes

Looks like they are up now? May have just taken time to convert

https://www.livecoding.tv/setthebet/videos/

However it would be super great if you could upload as many of your videos to YouTube as you can. YouTube’s player is far better, and we can subscribe to get better notifications.

Unfortunately the videos on Livecoding is just some that I streamed yesterday as a small continous part to finish the project and show how to add sounds, buttons and highscore via local storage.
The main first part is still not there.

Yes, setting up a channel and putting the videos there would be a good thing. Unfortunately I havent recorded many of them locally and there is appearantly no way to get the videos from Lctv (I’ve already asked them).
I’ll keep you noticed

1 Like

You can download the videos using a browser plugin. I successfully downloaded one of your recordings using the Chrome plugin Video Downloader All

4 Likes

Awesome tip @britzl. Finally, I can view it offline on my iPad! Perfect for commuting. :slight_smile:

And thank you @Andreas_Jirenius, for making them! :beers:

By the way, a small tip if someone follows my path for offline view; When you import the videofiles to iTunes/iPad/iPhone, change their mediatype to “tv-show”. That makes viewing them a much better experience. Remember to insert season and episode numbers, to make them sort correctly. :wink:

PS: This tip works on other videosites too, like <random unnamed learning sites people might buy courses from>. Be aware though, that this might span from legally grayish(even more than downloading from livecoding.tv), to straight up illegal. So please make sure you stay within the legal boundaries.

2 Likes