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.
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...
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
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...
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.
Edited by the Author.
I have proven new mathematic formula to be true...
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
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...
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!
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)
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
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.
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.
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.
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.
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)
Edited by the Author.
I have proven new mathematic formula to be true...
Yay now it works perfect. This was important part to get, so I can try to unite the apps. I have already few ideas and skepts of it. Hoping this will go into download page by tomorrow. I just remembered old one is on GOTW, but heck Ill delete it now .
By looking up the code I now know why I messed fastloop. I didn't know about the DimX...
Edited by the Author.
I have proven new mathematic formula to be true...
Ok this is weird! Now I got my update reasy and I was going to put the version to TDC. But I thought I'll take some new screenshots of it. Well, aster that I noticed part 2 isn't opening! The source opens, but if I press build, then it says "error while opening" and none of the sub-apps would open. I've tried everything, but I don't know how this has become! When running from source it works greatly. I can't understand :/
You can download it from here. Has anyone occured or know how to fix this?
Wrong file names? I'm not sure how it compiles the subapps if they are separate .mfa or .exe files? Like it might need them as external files in the same directory, and might need to reference the directory name instead of having a direct address to them.
I'm not sure why this worked. My best guess is that there is some kind of a problem with one or more of the subapps - I'm assuming their .ccn files are the "external files" it's talking about. If you made changes to them you might have to rebuild those as "internet application's" separately. To be honest though, I never even knew you could open .ccn files in subapps til now, so I'm just taking wild guesses.
Incidentally, you have a bug with the "Load Image" button. Firstly, the button text stays highlighted after you've loaded an image. Secondly, you can only press the button once - after that, pressing it again has no effect. I haven't looked into the cause because, to be honest, I just couldn't be bothered. I'd guess it'll be a quick fix though.
Yea it worked. Weird problem, but I have to but that back of my head, so i'll remember that next time.
The load picture is done on purpose, so the picture loading doesn't bug. I'm having lots of bugs, like part1 doesn't have the map movement, because I messed it, but part 2 has working one. Same is with part 1 pic load and part 2 pic load. I don't know what have I messed, but next version I'm going to write the hole code over again, so it should work!
I have proven new mathematic formula to be true...