The Daily Click ::. Forums ::. Klik Coding Help ::. Need help creating an exploration game
 

Post Reply  Post Oekaki 
 

Posted By Message

phanto



Registered
  21/09/2005
Points
  70
26th June, 2010 at 20:32:19 -

I'm creating an engine for exploration/roguelike dungeon crawlers. I've got almost everything down except one major thing:
Shadows.
I need shadows over the whole map (which is ~1000x1000 big with 20x20 tiles). When using Active Objects the game slowed down and was unplayable. Is the any other MM2 object that fulfil being:
* able to detect being overlapped
* able to be destroyed
* ~100 on screen at the same time without slowing the program down.
I've looked but haven't found any. Are there any extensions maybe?

 
n/a

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
26th June, 2010 at 21:16:10 -

How big are the shadows? Smaller objects always load quicker.

In the level properties do you have "force load on call for all objects" ticked? Try saving another copy of your game and lowering the color depth.

What shapes are the shadows? Also what resolution are you running the game at?

HWA should be able to handle them fine.

Can you post your computer specs as well? That probably plays a major part. Also any processes running in the background (browsers, antivirus, etc.) need to be killed before testing it out.

Edited by GamesterXIII

 
n/a

phanto



Registered
  21/09/2005
Points
  70
26th June, 2010 at 21:30:03 -

shadows are 20x20px just like the tiles in the game.

I don't know what term to use really, but by shadow I mean "unexplored" parts of a dungeon or whatever.

The shadows are black.

This isn't the game I'm making, but it shows what I mean (hopefully):
http://www.roguetemple.com/wp-content/uploads/2008/02/omegax.png

How do I turn on HWA? Choosing DX as Display Mode?

 
n/a

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
26th June, 2010 at 22:09:42 -

If you are loading the graphics from outside of MMF2, then you could just have the whole screen be black and when a character steps on the hex where the graphic is supposed to be, load that graphic tile.

That way, you don't have to use a ton of actives or come up with some ridiculously difficult trick to get past MMF2's limitations.

Simple, easy, effective.


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
26th June, 2010 at 22:20:17 -

Thats a good idea, MBK, but I think thats an un-necessary (thought not deplorable) workaround tbh.

@Phanto - Do you have the latest MMF? Download the HWA build at the clickteam forums.

I really don't think you should be having any trouble without hwa though. Did you try to force load on call for all objects?

 
n/a

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
26th June, 2010 at 22:26:48 -

Edit for my above post: actually, come to think of it you could do it this way by creating the actives too ...
..
Btw, this is however, a hard-coded method, meaning that you'll need to tell it to create something for every hex that is visited (this only really means that you place the item with code instead of with MMF2's graphic editor, that's all really) <just take a look at "MBK's Zelda Scrolling" ... that's how I was able to re-use the same trees over and over as it scrolled.
... BUT you could make a level editor and set the tiles that way giving them position values and match up the values to load the tiles as land is uncovered according to the value given when you placed them in the level editor. I've never actually done this myself, but I'm sure it's quite effective.


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

phanto



Registered
  21/09/2005
Points
  70
26th June, 2010 at 22:50:41 -

@ MBK Really not sure if loading tiles would be an easy solution for me. I randomly generate the dungeon, and have a lot of stuff in it.

@ GamesterXIII
I tried load on call for all objects and it improved it slightly. I've got a good PC.
I'll try different settings and that HWA thingy.


I'm surprised there is no "active background" kind of object, or a "passive" active object scaled down with no animation or rotation or (in my case) unnecessary stuff like that, just Alterable Values, Create, Destroy and maybe positioning.

 
n/a

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
26th June, 2010 at 23:24:42 -

My brain is dead today, but I believe what you need can be achieved using the following method (given that HWA does not work for some reason .)

Write a loop that fills your immediate area (if your screen size is 640x480 your immediate area is that 640x480 chunk you can see) with darkness. Since you can scroll you may have to fill a larger area than what you can see to accommodate for borders.

Record all tiles that have been stepped on - possibly use an array to store the data for each tile? The array would have to be 50x50 since your tiles are 20x20 - 1000x1000/20 = 50x50.

Make the darkness move when you move.

Array X Index = (Character X Position/20)
+ Array Y Index = (Character Y Position/20)
- Set that index number to 2 - which represents a tile you have traveled upon.

If a shadow is over a traveled tile, according to the array, make it invisible. If it is not overlapping a traveled tile then make it reappear.

In theory this sounds like it works. I can't get it to work because I'm not in my right mind today or I'm retarded and I've never ever used arrays before . . . . I'm not sure how fast it would be.

Maybe someone can code it out for you.


 
n/a

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
26th June, 2010 at 23:26:55 -

You can just simply use the tiles. make every tile invisible, and make them appear if charachter explored them. that way you dont need additionall objects.
Just make sure you use a black background.
Or make an fog animation for every object when its not explored, and u can just copy paste that animation on every tile object.

 
Code me a sausage!

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
26th June, 2010 at 23:29:55 -

The problem with that is that he has too many actives on screen at once.

I tested it out at 640x480 using a similar method and scrolling was too slow to work - I just went ahead and assumed Phanto was using 640x480 res since many roguelikes are played in a window.
At 320x240 it seemed to work well though.

Edited by GamesterXIII

 
n/a

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
26th June, 2010 at 23:32:33 -

Yeah but he wont be adding actives, he would just be using the ones he uses for tiles, just making them visible if explored... But thats only if those tiles are actives to begin with...

And pretty much every scrolling app will lag when scrolled without hwa... unless its very low resolution

Edited by Don Luciano

 
Code me a sausage!

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
26th June, 2010 at 23:34:32 -

I get what you are saying, but I would assume there is still going to be a huge volume of space to explore, which would still require a rather large amount of actives to cover it up.



 
n/a

aphant



Registered
  18/05/2008
Points
  1242
27th June, 2010 at 01:54:40 -

What you're looking for is called "fog of war."

So your levels are randomly generated, yes? Generate your level like normal, but don't create the level tiles yet. When the player explores an undiscovered region, create the "uncovered" tiles.

 

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
27th June, 2010 at 02:18:14 -

Aphant that still results in the same problem in the end. If a player were to explore the entire map (or even a small section) the framerate would drop dramatically due to the amount of actives on the ground. He would still have to cover up bare ground just like in Ultima, which would result in the exact same object limit.

That also sounds like a pain in the arse to do .

 
n/a

phanto



Registered
  21/09/2005
Points
  70
27th June, 2010 at 02:30:27 -


Originally Posted by aphant
What you're looking for is called "fog of war."


No, fog of war is what you get after exploring, and then going away. Basically what's outside your line of sight. Usually gray'ish/transparent and hides units/buildings, but not the general terrain. But this is irrelevant.

Originally Posted by aphant

So your levels are randomly generated, yes? Generate your level like normal, but don't create the level tiles yet. When the player explores an undiscovered region, create the "uncovered" tiles.


Not sure if that's possible, the way the level generation works. I'm using the Dungeon Object extension.

Resolution is 800x600, frame size is 400x300, virtual W/H is 1000x1000.
Covering the whole frame with actives won't work, I've tried.

Maybe it could work if the Shadow tiles overlapping other tiles (which are actives) hide them, and have shadow tiles be created at the edge when walking (camera is stuck on character). I'll give this a spin.
Or does invisible Actives still drain memory?
EDIT: no, that would ruin the exploration by replacing explored areas with new shadows...

Edited by phanto

 
n/a

phanto



Registered
  21/09/2005
Points
  70
27th June, 2010 at 03:24:18 -

Okay, some progress.

Using Active picture set to a 50 byte 20x20 bitmap .GIF works pretty well. 1900 shadow Actives, ~2000 objects running in debugger at maximum ~32MB.

Runs a little slower in the middle of it all, but not very noticeable and I'm also running this on a laptop (although a quite powerful one).

Still open for other suggestions though.

 
n/a

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
27th June, 2010 at 04:07:36 -

Pretty sure HWA will clear your problems up. Have you tried it yet?

 
n/a

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
27th June, 2010 at 06:12:40 -

Maybe there's a way to randomly generate the level like you are doing BUT then capture it as a picture and turn it into one big background object all during runtime? ... possible?

If that's possible, I'm pretty sure that background won't slow anything down, at least not much, so ... yea .. IF it's possible ..


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
27th June, 2010 at 07:49:56 -

I did not realize that MMF2 had a create backdrop from Active feature. I thought it only had paste.

http://www.mediafire.com/?gnznflh4yzn

Have fun! . It can be optimized a bit. . . sorry for the mess. CBF to straighten it up. BTW just a heads up - keep in mind that whenever you make a grid based movement like I have done in this example that your character CAN move diagonally sometimes so you'll have to put some events in place to keep him from jumping over some walls etc.

Edited by GamesterXIII

 
n/a

phanto



Registered
  21/09/2005
Points
  70
27th June, 2010 at 14:14:43 -

cool guys. thanks!

I have my movement based on MoveIt, one of the best extensions in the world
if flag off + repeat while movement key is pressed -> flag on, queue movement, execute movement -> flag off when move done

when I'm done with it I'll upload it on TDC for you guys to see

 
n/a

BattleCat



Registered
  08/09/2002
Points
  978

VIP MemberThe Cake is a LieIt's-a me, Mario!Wii OwnerPokemon Ball!
28th June, 2010 at 13:31:54 -

Maybe you could use an array to store data about which tiles have been explored and which haven't. Then when the player moves 1 tile, you can check against the array and only place black tiles, or whatever, on the part of the map that's visible to the player.

 
n/a

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
28th June, 2010 at 16:29:19 -

I've already mentioned that.

The problem is solved. Check two posts above yours .

 
n/a
   

Post Reply



 



Advertisement

Worth A Click