How do I hide part of Map(Layer) until explored.

Get help using Construct 2

Post » Thu May 26, 2016 11:02 pm

I am not sure if some of you are aware of or even remember the Warcraft game that ran off of a Floppy on DOS.

The Game Map was blacked out. When a controllable player would move into the "darkness" the area would become permanently visible to the player for the rest of the game.

Can someone please explain how to achieve this in Construct 2?

Is it done with an object that is attached to a playable character and it changes the color of a mask to make that part of the layer go from black to white allowing it to be seen through? If so what blend mode would I use? How would I set it up? Is this even possible?

Is it somehow done with an array or invisible objects in the game during game play? If it is done with an array some how, how would I set it up? If I am familiar with arrays, an array is only a memory system, It can't be used actually place objects in game. It is used to remember which object is placed in a specific spot.. Is that right?

If both are possible which one would use less of the systems resources. I think it would be the Mask layer but am not 100% sure.

The map that is being planned is a bit large. It would have to be remembered which parts are visible, even after being saved and loaded.


The current Capx file is nearly empty. Posting one wouldn't be of use.
B
65
S
37
G
13
Posts: 240
Reputation: 12,703

Post » Fri May 27, 2016 8:26 am

I suppose you could use a tilemap filled with solid tiles and erase them on overlap. Or you could use the paster plugin, but I don't think that would get saved with the default savestate system. I guess it depends on the art style you're going for and what kind of performance you expect.

Using lots of individual objects definitely wouldn't be efficient, though.
B
35
S
9
G
4
Posts: 201
Reputation: 5,170

Post » Sun May 29, 2016 1:17 am

Would using a tilemap be effective for performance? I would have each tile set to visible until a playable character comes into contact. Then the tile would become invisible/destroyed. I know it is easier for a computer to render the same object multiple times vs different objects the same amount. Since it will all be the same object and same color would it be effective? I don't think it would be rendering anything below the black tiles. It seems plausible I am not sure how it would work performance wise. The DOS game I spoke of ran on a very old computer that was only capable of DOS, back when DOS was "the best". Now even our phones are stronger than computers like that, so it may work.

Since the project I am working on is a bit large I can't apply this extra idea into my project until after I test it a bit. It would change the game play quite a bit though. When I finish what I am working on I will test it out and test performance and post results. Unless someone beats me to it or has another idea. It will be quite a while before I am able to post results.
B
65
S
37
G
13
Posts: 240
Reputation: 12,703

Post » Sun May 29, 2016 1:25 am

Tilemap performance is great as long as you don't try and draw large images.
B
46
S
16
G
79
Posts: 2,170
Reputation: 46,857

Post » Sun May 29, 2016 6:02 am

Hey Unconnected,

Its called the 'fog of war' and im sure there would be a lot of resources out there to help you come up with the most efficient version if you are worried about performance.

Remember in the old warcraft games when you selected a unit you didn't have the same controls as the current RTS's . For example if you have a unit selected in starcraft 2 you can make him walk in a circle with enough clicks - try that in the old games and you would end up with a hexagon shape instead.

You have the right idea using arrays. See this 4 by 4 array below.

|0|0|0|0|
|0|0|0|0|
|0|1|0|0|
|0|0|0|0|

This array represents the overall map and the 0's are the spaces that are currently free to be moved onto. If your character is the number 1 then you can move any direction (this is how we determine collisions when they are made but the same thing can apply to what has been explored and what hasn't).

For the fog itself you have the option of using tilemaps or simply tiled background objects - depends on how your maps are set up really.
ImageImage
B
123
S
23
G
7
Posts: 1,071
Reputation: 13,091

Post » Sun May 29, 2016 9:32 am

@Unconnected Ok run the example you can move the player with arrow keys. Now go to black part of map it disappears. Now exit and come back and the black part is no longer there.

http://www15.zippyshare.com/v/NDydW7DH/file.html
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 682
Reputation: 16,615

Post » Mon May 30, 2016 6:54 am

I tried a tilemap. The large tile size looked bad because I have an Isometric Grid (45° angled grid). I did make it a smaller size of tile. It looked a lot better and still functioned correctly. It just used to much CPU. I may go back at a later time and try objects instead. It should look better since I will be able to duplicate my grid pattern.

Thank you Everyone. I believe everything has been found out at this time.
B
65
S
37
G
13
Posts: 240
Reputation: 12,703


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], Kin, mickclarke, TRMG and 43 guests