Posts

SPA - tips

Few notes on how to make SPA: start with model. Don't care about GUI on the very beginning. Start writing basic classes in pure JavaScript and write unit tests for it. E.g. if you do Todo List, make some classes like Todo, TodoList etc. Think in concepts of domain knowledge rather than GUI. but remember that your models should be reactive(or it should be easy to add reactivity). You can start right away with reactive code using some reactive library like Redux or Mobx, or you can add this reactivity later (simple addon is using some kind of observer pattern - e.g. via EventTarget It's useful to have same models on backend and frontend but it's not always be the case. Anyway, think also how you will connect backend with frontend and how you implement reactivity For GUI you can use library with component paradigm e.g. React, Vue, Angular. Think on how you will connect and integrate your models with visual components. Do models contain everything you will need? Or d

platformer game - tips

Image
So you wanna make 2D platformer game? Here are tips for you: 1. You need to check collisions between objects. Treat each object as a rectangle and check coordinates to examine if there is overlap. If there is, perform pixel based detection (there can be transparent pixels). 2. You can use tile map for making game levels 3. Objects can have "platform" property. If platform == null, they are falling because of gravity. But if objects is falling you still need to examine if there's collision with a platform. 4. To make various bonuses/collectable items that player can collect - make inventory object where each property is value of some bonus or feature: {energy: 100, gold: 10, spells: 20} // player properties and make bonus object look like this: {energy: 10, gold: 2} // bonus that adds 10 energy and 2 gold. you can also make some negative bonuses (e.g. poisons, thorns) {energy: -10, xp: 2} // it takes 10 points of energy, though it gives you 2 xp. Read also about multisets

10 gamedev techniques you need to know

Image
tile map it allows for dividing big world into small pieces (e.g. into squares or hexagons). It makes programming games a lot easier. You could easily detect if something is standing or neighboring something else (e.g. if unit is standing on a road) links: https://www.redblobgames.com/grids/hexagons/ path finding it allows units for finding path from A to B, even when path is not obvious (e.g. if you need to go around obstacles, move across corridors etc.) Redblobgames has articles about it: https://www.redblobgames.com/pathfinding/a-star/introduction.html events/commands/messages Instead of directly calling method of given object, put data of "what you would like to happen" in special command object. This allows for better decoupling and for easier managing side-effects. https://gameprogrammingpatterns.com/command.html state machines and other asynchronous patterns - it's often needed for making AI for NPCs, having som

JavaScript gamedev

Image
JavaScript is a universal language, so it can be used for making games. This way you could create game which can run in browser (though it's not only way - you could use WebAsssembly and you won't be limited to JavaScript) But how to enter JS gamedev space? Try first to make simple games, then more complex. Complexity can have few aspects: graphics - GUI/button based games --> 2D graphics --> 3D graphics logic - very few rules (e.g. snake) --> games with more rules (e.g. platform game) --> whole simulation of the virtual world (strategy games, FPS games etc.) how to learn make graphics: Well, assuming you already know how to make websites in JavaScript I recommend that you first learn making very simple games with simple GUI based graphics - e.g. memory game, jigsaw puzzle, word guessing etc. This kind of games can be done in way you would usually make websites (e.g. using React or even with vanilla DOM) Then you could learn

How to be a modern front-end dev?

Image
As a front-end developer in 2023, you need to become both more specialized and more generalist at the same time. Previously (circa 2005-2010) there was no front-back division and web developers usually also knew how to write HTML, CSS or write simple scripts in JavaScript, often paired with jQuery library. Then (I think it was about 2010?) front-dev development emerged as separated discipline. Front-dev devs became more and more isolated from backend. In following years front-dev and its ecosystem expanded. JavaScript evolved into quite modern and expressive language. New libraries was created like Angulars(1.* and 2+), React, Vue. More and more complex commercial applications would be created by companies. Job market was booming. But because there was more and more competition between companies, modern practices of product development also had to be put in place, because companies needed their products to be more competitive and user-friendly. So there were new roles in teams

Are you senior already?

How to recognize when you're ready for being a senior developer? Well, it can come gradually but there are some signs: You are given more and more responsibility and trust. Well remember that nobody trusted you when you were a junior dev? And they were given to you only some not very important things. As a mid developer you would usually still feel this kind of hierarchy and superiority from more senior developers. And now - when a team trusts you and gives you most important parts of software - this is a sign that other people perceive your seniority. You often mentor other people in team. As a junior dev, you are taught by others, as a mid dev, you're doing your thing, as a senior dev, you help others to be more productive. You're starting to see things in more holistic way, you can take programmer perspective but also business perspective or look from perspective of end user. You become better communicator and help other people on your team to communicate

are you professional in your front-end?

Front-end is often overlooked. People treat it as it would be super trivial or something that is so dirty nobody wants to touch (back-end developers often have this kind of disdain for front-end). When you have such negative views of front-end dev in your team, you would have self full-filling prophecy. The truth is different - front-end in 2023 can be as professional as "real" programming. But you have to treat it seriously. Let's dive in and check if you have things below in your front-end project: people - when you need back-end code, you need back-end developer, when you need front-end, you will need a front-end developer. And you need good developers with strong skills and professional responsibility. obvious things - Git, package.json, probably bundler (e.g. Esbuild, Webpack etc.), CI/CD pipeline for deploying tests - front-end code is still a code, so you can write unit tests for many things in frontend. Though unit testing GUI maybe won't be