HTML5 (Solved) Multiple views not working (1.4 HTML5)

Hi

Version of GM: v.1.4.1804

I've been having this problem with showing multiple views at the same time. The concept is simple. Two players walk around in the same world, with their own respective view. This is how it's supposed to look and how it looks when compiling for windows:


However when i compile for HTML it only shows the second view, which is stretched to fill the entire canvas.


I have been trying all kinds of things to fix it, but nothing seems to work. Does anyone have a clue, on what is going on? Please ask if you need more information to understand the issue. I should also mention that I've tried google, but without any help.

Thanks in advance
 
Hi Alex_Beach and thank you for taking time to answer my question.

I'm not scaling, so I don't think that's the issue. I've read the article, but couldn't find any solution to the problem. I'll try to give some more information about what I'm doing. It's actually fairly simple. I have these two views:

View 1:


View 2:


And then I run this code to make the views follow their separate players:


Again, everything work on Windows, just not when compiling for HTML5.
 

Roa

Member
views in html5 are busted as ****.
For all intents and purposes, the last view drawn is your final image, and they don't exist outside the first primitive view setup.

I hope you are ready for a very tedious work around, because as far as I'm aware, you basically have to re-invent the camera system by drawing everything in the game to your own surfaces, and having your own surfaces be drawn in part over top the main draw surface.

You can't even copy views or manually take control of the application surface, so re-rendering the game manually isn't optional. I don't know why this is the alternative to simply fixing it to run like every platform, but you are going to have to do some leg work if you want multiple views in HTML5. It took me hours to figure out what would and wouldn't work, and what I could get away with in the sense of speed.

  • view x/y kinda worked
  • view enable doesn't work as expected
  • view_width I believe worked
  • view ports don't work as expected,
  • surface from view doesn't work as expected
  • and application_surface functions don't work as expected.
 
Last edited:
Thank you for your answer Roa. I really appreciate it.

That's what I was afraid of. Really frustrating that HTML5 for Gamemaker is always such a nightmare. I'm willing to do some leg work, as long as it's efficient enough to run on HTML5. But I must also admit that my experience with surfaces' are limited, so unless you can point me in the right direction, I'm not sure it would be something I can handle.
 

Roa

Member
Thank you for your answer Roa. I really appreciate it.

That's what I was afraid of. Really frustrating that HTML5 for Gamemaker is always such a nightmare. I'm willing to do some leg work, as long as it's efficient enough to run on HTML5. But I must also admit that my experience with surfaces' are limited, so unless you can point me in the right direction, I'm not sure it would be something I can handle.
just look them up in the manual, they are pretty simple.

They are basically reserved memory for you to store dynamic images on. So you can draw graphics, effects, and sprites to them, and then you simply call the one surface vs having all those graphics that called over and over again.

What you are going to want to do, is take all your game objects that need to be drawn and give them a common parent object, then call the draw event of that parent when you go to draw the graphics to the surface. From there, you can make copies of small sections from that first surface to 2 more that will act as your views into the world. You can specify the x/y and width/height of those sub surfaces to match what you need to see the world. Then, you simply draw those 2 sub surfaces to the main application surface in draw GUI begin.
 
I think I understand. I'll have a look in the manual and see if I can figure it out. One question though. The world is fairly big, so I use tiles for the ground, and not objects. So how do I draw the tiles to this surface, and not only the objects?

Thanks again.
 

Roa

Member
I think I understand. I'll have a look in the manual and see if I can figure it out. One question though. The world is fairly big, so I use tiles for the ground, and not objects. So how do I draw the tiles to this surface, and not only the objects?

Thanks again.
Eesh, Im not entirely sure of the tile drawing functions, but you would have to draw the layer or loop through each tile and draw it.

The cool thing is, you only have to draw those tiles once to a surface too, then call the tile surface to draw on the same one you have the objects. That would probably be the only surface in your game that would actually be saving you logic and render time lol
 
Recently realized that this is actually much easier to do than we thought. You actually don't need to draw every single object to a surface in order to get this working. All you need to do is basically draw the view to the surface with view_surface_id. I've updated the project which you can find at the link in my previous comment. Wish I found out about this earlier, since this is a much much more simple solution and a better working one.
 
Top