Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Should I make my game using pure JS or with a JS game framework?

A topic by Titanwork created Jan 11, 2021 Views: 875 Replies: 13
Viewing posts 1 to 6
(2 edits)

Hello everyone!

I stopped working at my game bcuz I feel lost and I need some guidance or having tips. 

My plan is to create a game using html5 and JS and then publish it on Itch.io as an HTML5 project. And to be more specific, my current game-code consists a lot of Jquery ( a JS library) to make it easier for me to manipulate (adding/removing objects) the dom.  

The thing is that, I have recently discovered a few JS frameworks and this made me rethink about the whole process. Personally, I feel like I can make what I have in mind without using any framework but I'm worried about how game's performance will turn out at the end.  Do you think it's worth the time to invest into one of those framewroks (ex. Phaser.js) and why?

Here are the things that I have managed to implement in my project  (2D game) so far :

  • A basic battle system (turn-based)
  • A way to interact with NPC:s
  • Delay at some points.
  • A way to switch between different rooms/levels.

(2 edits) (+1)

If you're familiar with javascript, then why not using "Unity Game Engine"? You can code in javascript with Unity. What kind of battle system that you wanted to implement? Is it a turn-based, real-time-strategy? And for the NPC, you can create a system that already builds inside the Unity called the Nav Mesh Agent, they can handle pathfinding, object recognition, initiate dialog system, and some other stuff that you want to implement. For the last thing defined delay function that you write above, is it for waiting on the turn, or something else? My suggestion is, use the game engine for the first time whether it's Unreal, Unity, or any game engine that you familiar with. After you get the hang of it, you can try to create an engine with whatever language you like. I build this game using Unity on the WebGL platform so they can play it on the browser. I hope this can give you some more views of your game development. 

 

 https://guruhebat.itch.io/muttergeschichte

(+1)

Unity doesn't support Javascript (Unityscript) anymore

https://stackoverflow.com/questions/60348922/how-to-add-javascript-support-to-un...

(+1)

Ooo.. too bad, thank you for the info. I always use C# by the way

Thank you for sharing with me all of this! That is a lot of new info that I didn't know about. I'm definitely going to read more about Unity with JS and see what else they offer for 2D games.  Also, I'm gonna take a look at your project asap.

As for your questions: 

- I'm creating something close to Visual Novels and there are battles between  the acts. 

- I'm using delay methods to activate special effects after a certain amount of time, for example, when an enemy's hp gets low, it will say something before performing its' next attack.

Moderator moved this topic to General Development
Moderator(+2)

Using a framework is going to badly hurt performance no matter what, and it sounds like you're already well on the way to making your game. Stay the course. :)

(+1)

I will do my best, thanks for the support :)

(+2)

Hi! If you already have implemented functionality and you're comfortable with the result, in my opinion, recoding just to adapt to a framework can be very steep. I don't recommend it actually unless you can see clearly that what the framework offers is beneficial for you. I'm not so sure about the performance hit, but if you don't really need them, I'd recommend as 'No Time To Play' says.

On the other hand, I disagree with 'Guruhebat' recommendation. Turning to Unity is not a sensible maneuver here. You'll have to recode everything to C# and adapt to Unity cycle of life. Unity, actually, doesn't make use of JavaScript, it made use of a script similar to JavaScript in appearance called UnityScript, and at the moment, it's discontinued.

Here some forum posts from the Unity forum about this subject:

https://forum.unity.com/threads/is-unity-planning-to-kill-javascript-support.403...

And an old wiki entry about it:

https://wiki.unity3d.com/index.php/UnityScript_versus_JavaScript

Good luck!

You are totally right, I have 0 exeperience  working with game engines and i can kinda see that I will  need to dedicate a lot of time to pick the right game engine that really suits my needs and master it. 

I thought it was going to be a good opportunity to try Unity out since it's so popular, but I guess i'm gonna have to look for other options if I ever decided to pick one of course.

(+2)

In the end it always comes down to what you think is best.  Like No Time To Play already mentioned, using a framework, or( pre-made game engine for that matter) will always lead to a slowdown... It can also limit your possibilities. If you don't mind that and think the development will be easier that way and think that would turn out better despite the setbacks, it could be the right way to go, but if you already well-versed in working more low-level and you think you can do it without any framework, why not stick with that? After all, if you pick a framework after the development has already begun you also risk that your own code is too much different from what the framework requires and that you may end up having to redo the entire game from scratch.... Nothing works more demotivating than that, I tell ya. 


Another downside of existing frameworks is that you are bound to what the framework designers want. I quit some frameworks myself in the past because of decisions by the developers that were in my opinion beyond stupidity. At one framework I even requested an account deletion and everything I ever posted there (this due to a combo of stupid decisions and a community I was fed up with anyway). The advantage of using your own code and your own frameworks is that you are not reliant at all. And sometimes decisions are so drastic they can cost you your project. From what I see, the discontinuation of "UnityScript", and older versions of Unity used to support "Boo", but that too was discontinued... I guess too little people used Boo, but if you were one of those few, you're screwed. 

Not that I want to scare you away from using existing frameworks, as it can also have many benefits (like taking a lot of trouble out of your hands), but it is definitely something to think about.


In the end, you da boss... Overall I think it's unwise to ask what tool to use, or to use a framework or go for low level programming. In the end, it always comes down to the kind of programmer you are.  To a lot of people their programming language is like a religion... Criticize it and be prepared for very rude and sometimes even threatening behavior. I do remember getting yelled at after I said I hate COBOL and that by doing so I'd be neglecting programming history (since COBOL is the oldest compiler still in use), however that is quite harsh if you know that I once wrote an article on Game Jolt in which I praised Major Grace Hopper, the inventor of the first compiler and also the inventor of COBOL. It just shows how passionate people are. And also a bit arrogant about their language, if you don't mind me saying it. I use C++ myself, because I value my self-reliance, but no I don't love the language... I think it's crap... I use it because of lack of alternatives at the present time which fulfill all my needs. C++ doesn't fulfill them either, but at least I can use C++ to come as close as possible... at least now... I don't see why using C++ makes me better than others... I also use C# at times, or Python, or Lua, and (if I really have to) JavaScript.... And well more languages... It's just what I think is best at the time... If there's anything at all that could make me a better coder it's not my choice of language... I think it would rather be my over 35 years of experience in this field... 😁

(+2)

First of all, I really appreciate all the the time  you dedicated to give me an overview on this topic. I will consider myself to be lucky that  I got guidance from someone with as much work experience as you, SIR!  I feel like I now have gotten a much better view on the way. 

Even outside the field of game development, I have always liked to write down my own solutions due to not being limited by in any way just like you mentioned.  

I really wanted to be sure of whether it was safe or unsafe to proceed with own written solutions especially when I'm making my first steps into the field of game development. Once again thank you so much!

(+1)

Please just call me either  J. or by my name, Jeroen... I always feel old when people call me "sir"... (At least you didn't fall for the girl in my avatar as I am indeed a man).  (I accept J. from English speaking people as I know I got a hard name for you guys to pronounce. I'm Dutch, that's why I got such a "strange" name).

And what is "safe" or "unsafe" is always hard to predict... JavaScript in particular has changed a lot over the years, but then again so have C and C++, so when I have to look things up (hey, I can't remember everything, especially not since I code in multiple languages) I really must mind the date on which stuff is written. Overall I do feel safer with my own solutions too. But there is always a risk of "code rot" (which happens when programming languages change so much that code no longer works). However when you work low-level you are less bound to the changes as when you work high level. I've also had to ditch a few old frameworks in the past because the author discontinued them or neglected them otherwise. When you only deal with your own code that's less likely to happen. The downside is when the underlying language changes that you must update everything yourself also, and with ready-to-go frameworks their respective authors must do that, but downside is you gotta wait for them to get things up-to-date.

I think if you are used to work with your own stuff and if you are satisfied with that, why change? It's not that games made in Unity are per definition better than games written in C/C++ or vice versa.


And yes I too like to write my own tools whenever I'm able to. Of course, I am not gonna code my own defragmentation tool... as I really feel I can better leave that to the professional software industries, but I have written loads of tools I use every day myself, and some of them may not be easy to understand for others, but hey, for me they do what I want them to do.  And if you look around in my github repositories (I got by the name of Tricky1975 on github) you will see that I have stuff written in C, C++, C#, Python, Lua, BlitzMax, Pascal, Go, well, anything... It's just what I thought I needed to do the job best at the time... 


And thanks for your appreciation.... I always like to use my own experience to help others. There was a time I was a beginner myself, and back then we had no internet, so I was much more on my own back then... Oh, crap, now I sound like an old man... Hey, I'm just a boy... a boy in his forties, but still a boy ;)

(+1)

This is awesome to know. I have a project due in a few months and I thought I was gonna have to learn Phaser.js to do it first, lol! Great to know I'll have more freedom if I just make it in Vanilla Javascript, which I am already super comfortable working with using HTML Canvas. 

Oh... I completely forgot I posted that, after 3 years. Well I still stand by what I wrote back then, and I'm glad it's still of use to somebody. 😉