Answer the question
In order to leave comments, you need to log in
Browser mini-games. Document structure, Canvas/iframe, menu implementation, security. What are the best practices?
I have several developments of browser mini-games. Something like Pong, Minesweeper and stuff like that. Since I see self-learning as one of the goals of their development, in the future, perhaps, these will be larger projects. Accordingly, it is better to start doing it right away. That is why I am interested in the best options, development practices.
One of the firstThe issues that arise are, of course, the structure of the document. HTML5, with all the consequences, offers a convenient Canvas API, which I (in my early stages, again) quite satisfies. But. On some sites of similar content, I met an implementation based on iframe. To be honest, I don’t quite understand how it works and how much this approach is preferable (and preferable at all) to using things that are specifically designed for my purposes (again, the same Canvas). But the question here, rather, is not how to work with iframes, but, nevertheless, what is preferable to use. Perhaps, for a simple Pong, Canvas is enough for me now, but if in the future I want to implement some kind of walker? In general, I would like to hear opinions on this matter with "for" and "against".
, I'm very interested in the structure of the document given to the user. I always try to send the user the minimum required HTML (+ CSS, JS) for work. But sometimes I come across sources so bloated that it becomes not entirely clear why they are needed at all. From this, by the way, the third question follows.. For example, menu. Menu for Minesweeper. It is better to make it a separate block (div, aside, section - whatever), just located next to the Canvas and containing the "Start over" button, a timer, for example, and some other information, or still draw all this functional means of the same Canvas? It is clear that this does not play a special role in sapper, so, again, for example, we take some still-unrealized indie walker. What is the best thing to do there? When you need to show the menu, exactly draw it? Or slide modal windows made in HTML?
4.Graphics, images, everything related to it. For the same Minesweeper, simple drawing of cells becomes too cumbersome and often does not justify itself in terms of efficiency. So you have to use images. And everything would be fine, if it were a simple desktop application that you downloaded once, installed, and play for yourself. On the web, things are a little different. The question itself . What is the best way to load, store images (in the cache, for example)? Where to ask them? Inside an HTML file or loaded with scripts? Is it better to use one big sprite or upload images separately? (Especially in the case of SVG for subsequent animation). In general , there are many ideas, but the best are of interest. By the way, this question is also true for other types of assets. You never know if I want to make a video intro, or a cutscene :)
No less important is the issue of security . As you know, what got on the Internet, it became common. And here the question is, rather, not about licenses and the like, but about handy users who want to dig into your code and, possibly, “cheat” something for themselves. How do you protect yourself from this?
In addition to everything, do not forget that the yard is far from the 2000s, and many of us want to be able to do everything on mobile as on stationary machines. Here the question is more about touchscreens. How to take care of them? Well, about the size of the screens, of course. How does this whole thing adapt to different user audiences. In addition, mobile traffic, which has not yet become unlimited without exception.
Conclusion.
I thank those who have mastered all this text. And even more of those who are already preparing to give an answer. And even more of those from whom this answer will be really on the case. It will be interesting to hear both about the technical part and from the side of a simple user: how would you like everything to be arranged and which approach would you have more confidence in?
-------------------------------------------------- ------------------------------------------------
If you do then do well.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question