The Daily Click ::. Forums ::. Klik Coding Help ::. Fast f****** loop problem
 

Post Reply  Post Oekaki 
 

Posted By Message

NeoMonkey

Finnish Army Fire Commander

Registered
  01/12/2006
Points
  243

VIP Member360 OwnerI am an April FoolPS3 Owner
27th October, 2008 at 12:51:35 -

As you could see on the title, I have problems with fastloop. I'm making mr.mapmaker's new patch and that's last thing I can't get done. I understand fastloop and I have done many custom movement stuff with it, but this is wild. Best I got today was to load first line.

The problem is this:

I need to load maps stuff from array. First I put array to (1,1), then I started to fastloop with varius stuff, but best I got when I used:

Run loop: FrameWidth/32-FrameHeight/32 times.

Then I need to place backdrop of marker into the spot, if the spots array is greater than 0, because the 0 is a plain spot. Also I need to place tile number into the spot, if there isn't existent one, if there is just edit the old.

Now I got this s*** to do something, but not what it shoulded. So now I'm asking help from all you guys here who master fastloop and would want to help me. Of cource godly credits will be given if someone makes one.

http://www.megaupload.com/?d=LOPEE3H0

That link upper is the new version. That isn't ready, it still needs fastloop saving and example file. The fastloop stuff can be found on part 2's source under group load! P.S. The old stuff under the load group is crap so you can delete it!

 
I have proven new mathematic formula to be true...

2D > 3D

Image


Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
27th October, 2008 at 13:52:31 -

now we need to know *what* its doing, which isn't intended. Looking through the .mfa files proved pretty fruitless for finding these fast loops. What is it doing, that isn't what you want?

If you're trying to paste background tiles during a loop, you should remember that pasted backgrounds have many artificial limits in MMF2. You may only be able to paste X objects per fast loop, and after that, the rest simply won't paste. You can only have so many "Paste object to background" calls during a single frame. In general its better to use active objects or text blitters or pretty much anything but backgrounds

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

NeoMonkey

Finnish Army Fire Commander

Registered
  01/12/2006
Points
  243

VIP Member360 OwnerI am an April FoolPS3 Owner
27th October, 2008 at 14:48:07 -


Originally Posted by Pixelthief
now we need to know *what* its doing, which isn't intended. Looking through the .mfa files proved pretty fruitless for finding these fast loops. What is it doing, that isn't what you want?

If you're trying to paste background tiles during a loop, you should remember that pasted backgrounds have many artificial limits in MMF2. You may only be able to paste X objects per fast loop, and after that, the rest simply won't paste. You can only have so many "Paste object to background" calls during a single frame. In general its better to use active objects or text blitters or pretty much anything but backgrounds



The problem is to add markers into the map when loading. The pasting stuff was new to me, never heard of that before. That runs a problem, because it would double the amount of active objects in map. But I'm wondering does it happen if you use "add backdrop".

And back to the problem. Mainly I need to get fastloop to work so, that it would create backdrop and counter into spot certain spot. This I can do, but when I add there, that I need to create it into 300 or more spots with fastloop creates problem.

It is hard to explain, but i'll try. Now first you press load array, then the loading starts. Application sets current value to (1,1). Always when the value is greater than zero, there should be added marker and counter. And the counter indicates the spots value. But if there is already counter then it won't create new one, but edits the old (olready done in the code). Now then the problem is to move the spot. Tiles are set to 32x32, and it should move until, there becomes end of the map. Then it should move to the start and begin again, but always at end it should move to the next line.

I got this kind of loading system in version 2.3, but it wasn't fastloop. When I tried to port it into fastloop, I didn't get it to work. Now as I have changed all markers into backdrops, I had to change the system, but still it doesn't work. Hope you guys get my point.

 
I have proven new mathematic formula to be true...

2D > 3D

Image


Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1852

VIP Member
27th October, 2008 at 16:23:40 -

is this what you had in mind?

http://cid-b1e7ee094271bbda.skydrive.live.com/self.aspx/Public/Mr.MapMaker|_Part2%20NEW.mfa

 
n/a

NeoMonkey

Finnish Army Fire Commander

Registered
  01/12/2006
Points
  243

VIP Member360 OwnerI am an April FoolPS3 Owner
27th October, 2008 at 17:04:47 -

YES! Thank you, allthough it needs one adjustment, i need to comment the code . But I think I can handle it. Thanks sketchy i'll add you to credits. Darn it is simple, but still I couldn't do it :/.

Edit: It placed the first tile into (32,32), but i've corrected it to (0,0).

I think I'll get the new version out by tomorrow.

Image Edited by the Author.

 
I have proven new mathematic formula to be true...

2D > 3D

Image


NeoMonkey

Finnish Army Fire Commander

Registered
  01/12/2006
Points
  243

VIP Member360 OwnerI am an April FoolPS3 Owner
27th October, 2008 at 17:22:17 -

Or not I noticed huge amount of objects, after 10 second about 10000 :/. I need to correct that too .

 
I have proven new mathematic formula to be true...

2D > 3D

Image


Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
27th October, 2008 at 17:23:12 -

Yes, and a more elegant solution is to remember that when you want to run through an array in a single loop, if you know the X size & Y size, you can do it like this:


x position = loopindex mod X-size
y position = loopindex / X-size

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

NeoMonkey

Finnish Army Fire Commander

Registered
  01/12/2006
Points
  243

VIP Member360 OwnerI am an April FoolPS3 Owner
27th October, 2008 at 17:42:56 -

Hmm, I did almost like that. But I don't know where I messed the code. I don't know I waisted 2 hours of my life in some pain in the ass fastloop bug... And half years ago I waisted a day to try whats going wrong.

But yes scetchy, I fixed the problem with the huge object amount, but I also have now new problem, now after it's fixed now all my loaded tiles changes into one number, but I hopefully can fix it...

 
I have proven new mathematic formula to be true...

2D > 3D

Image


Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1852

VIP Member
27th October, 2008 at 17:48:48 -

Oh yeah, you just need a "only one action when event loops" on the "group load is activated" event. You should deactivate the load group when it's done too. Probably a few other details but I'll leave them to you

You can do what pixelthief says - it's a little simpler as he says so probably "good practice", although I don't think you'd see any visible improvement.


NB: that was a reply to the first problem - you just replied too quick!

Image Edited by the Author.

Image Edited by the Author.

 
n/a

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
27th October, 2008 at 17:56:14 -

I am like 99% sure about what your problem is.

You create a bunch of tiles, then, on the last few tiles, all the existing tiles morph into the new one (same values).

The reason is because you have reached the active object limit; when the game runs your line of code, it looks like this:

On Loop Whatever:
Create a tile
Set Tiles's Value to (Array)Image

so the scope of the "set tiles value" is originally ALL the tile objects, but when you create a new tile object, it changes the scope to be ONLY that tile. So it will only set the value of the newly created tile, not the already existing ones. If you put the "Set value" command HIGHER on the list than the create tile, what you'd get is that the line of code would change ALL objects to that value, then create a new, blank one.

What is happening is, when the game attempts to create a new tile object, it realizes that too many active objects already exist. So it parses through your code, and when it reaches the "create a tile" command, it simply throws it out. It skips over that line of code, because there are too many objects. The sideeffect of this is, when it doesn't create a new object, it doesnt change the scope. So it will now be referencing ALL objects for the remainder of that line of code, instead of the new object, because there is no new object.

So if you followed that all, what it means is, you have too many active objects in your game. If this is only like 300ish, you can simply go into the level editor, and set that levels cap to 10000 instead of 300. But if theres already 10000ish objects, the only thing you can do is create workarounds so that you don't need 10000 objects.

Say you have a 100x100 grid for your level. Thats 10000 tiles. Thats way too much. Instead, what you need to do is fundamentally change the entire thing. Its not easy, and theres a lot of methods.

For example, the Text Blitter object is used by many people, like Podunkian on the Underside, iirc. You can change the images for letters into your tile objects, and then create each tile on the screen as a character of text. So you are literally simply displaying a piece of your text-array on the screen, just changing the font to be each tile.

If your mapmaker program needs to have moddable tilesets, like being able to flip/rotate individual tiles, which I think I saw on there, its a lot more difficult. Dunno how you'd do that, besides just keeping levels smaller than 100x100




 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1852

VIP Member
27th October, 2008 at 18:04:31 -

I'm not sure I agree.

I've done this with huge levels before (100x100+) and it's worked fine. I don't doubt there is a limit, but I don't think it's likely to be reached (I'd guess it will depend on tile size an other stuff aswell.

The reason it was being hit here, is because I missed an "only run once when event repeats" condition, so it kept creating objects indefinitely.

I presonally don't like the text blitter, but I must admit, I've never given it a fair go either, so I guess that's irrelevant.


 
n/a

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
27th October, 2008 at 18:06:20 -


Originally Posted by Sketchy
I'm not sure I agree.

I've done this with huge levels before (100x100+) and it's worked fine. I don't doubt there is a limit, but I don't think it's likely to be reached (I'd guess it will depend on tile size an other stuff aswell.

The reason it was being hit here, is because I missed an "only run once when event repeats" condition, so it kept creating objects indefinitely.

I presonally don't like the text blitter, but I must admit, I've never given it a fair go either, so I guess that's irrelevant.



well the limit is simply a variable in the level editor, so you can change it for yourself! The problem is just that once you get over 10000 or so objects, even if you don't hit your predefined limit, your game will start to chug along slowly. 10000 active objects is a lot of work on the processor, given all of MMF2's overhead.

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1852

VIP Member
27th October, 2008 at 18:37:36 -

True, but this only uses background objects (I'm aware that using "add to backdrop" is different to "paste into background" and will use more system resources).

In this instance though, there's nothing much happening to stress the processor - it's just a level editor, so I don't think there's a problem. None of these objects would be present in the actual game, and even the scenery tiles themselves are conglomerated into a single backdrop image when the map is exported.

Out of interest though, is there a drawback to setting the number of objects to the max all the time? Does it reserve some memory (or other resource) which it could be otherwise using to increase performance? That's what I'd guess, but I don't know.

 
n/a

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
27th October, 2008 at 18:58:28 -

there definitely shouldn't be. I think its just a number, and numbers take up just as much room whether theyre 100000 or 0, in a finite bit memory. Pasting or adding to backdrops is one of the most halfassed things done by clickteaming, so its pretty hard to predict what kind of restrictions there are on it. I know you can only have so many objects pasted in there; it treats them just like they were toned down active objects for display purposes. Just less memory per object, but it still limited.

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

NeoMonkey

Finnish Army Fire Commander

Registered
  01/12/2006
Points
  243

VIP Member360 OwnerI am an April FoolPS3 Owner
27th October, 2008 at 19:28:15 -

Umm.. I'm a bit of confused what you talk, but i'll try to comment those . Well Firs is the code sketchy gave me. Now its good at loading the level, but it doesn't stop. I'll just changed "group "load" is activated" to "on group activation".

I've also red about the backdrop limitation. Now I have seen many games using large maps with huge amount of backdrops. Now my application is used to create the largest amount of markers without taking much cpu. This is why I changed markers into backdrops, and I am also going to change the numbers into backdrosp too. Eventually the maximum amount will be problem, (if anyone uses my app) but I'm now pleased, because the number of active objects are now radically dropped. 20000 active objects slows so much cpu, soit affects to all application running same time as my app. (My wlan net died on 10000 objects)

Image Edited by the Author.

 
I have proven new mathematic formula to be true...

2D > 3D

Image

   

Post Reply



 



Advertisement

Worth A Click