Custom Map #1804: Creeperboy. By: Xeos

Started by AutoPost, March 06, 2015, 01:12:42 PM

Previous topic - Next topic

ak

Looks like a really cool map, but it's super choppy on my MacBook Pro.  Maybe some heavy polling CRPL code or something.

Xeos

Quote from: Hubs on March 06, 2015, 08:44:09 PM
Xeos, incredible map! Very cool design concept and original PAC idea. My only beef with it was the lag. Probably from the 1600+ graphics.  I really didn't realize what I had to do until after I killed the second pump, then it clicked.  I caught the signature too.

Thanks Hubs ( The credit for the concept and the design goes totally to Ash (Legola33) ) .

Just one question, why do the static images cause so much lag? What things need to be considered when designing a map in relation to lag? are there any tips etc?
A child of 5 could beat this map ... Go fetch a child of 5 !

warren

Static images will generally cause lag in most video games, as there is rarely opportunity for the engine to know that those images are static, especially when they are on the playfield. In addition, game programmers rarely have the time to work on such a time consuming optimization task as static image detection. As to things to do to optimize code:
  - For range detection (a < b) => (a^2 < b^2) and a^.5 is expensive.
  - Terrain modification is expensive. Avoid.
  - Scanning the map need not be done every frame for every scanning task.
  - Precalculate and store. (an example would be collapsing static images into a single image.)
  - Fail fast tests. (Look for creeper where it was found last time first.)
  - Do not use Delay. It creates chop as the min delay is actually 2.

Xeos

Quote from: warren on March 09, 2015, 08:35:00 AM
Static images will generally cause lag in most video games, as there is rarely opportunity for the engine to know that those images are static, especially when they are on the playfield. In addition, game programmers rarely have the time to work on such a time consuming optimization task as static image detection. As to things to do to optimize code:
  - For range detection (a < b) => (a^2 < b^2) and a^.5 is expensive.
  - Terrain modification is expensive. Avoid.
  - Scanning the map need not be done every frame for every scanning task.
  - Precalculate and store. (an example would be collapsing static images into a single image.)
  - Fail fast tests. (Look for creeper where it was found last time first.)
  - Do not use Delay. It creates chop as the min delay is actually 2.

Thank you for taking the time to post this :) Can you tell me what you would use in place of the delay feature? There is quite often a need for me to use something like this.
Many thanks in advance
A child of 5 could beat this map ... Go fetch a child of 5 !

warren

Virgil has kindly written a timer family of functions, but creating your own is so simple I just do that.

<-t 1 sub ->t
<-t 0 lte if
  <-t <-tDelay add ->t
  @body
endif


OR

<-t 1 add <-tDelay mod ->t
<-t eq0 if
  @body
endif


If the scanning/modification operation is particularly expensive like on the map Mandelbrot, I do something much more complicated. I store a loop variable globally and return periodically from the loop.

Xeos

Thanks for this :) I will use this method in future :)

The only other thing I haven't understood as yet is how to use variables across scripts. I want to take the information I have put into a variable in one script, and modify it in another script on another unit. Is that possible?
A child of 5 could beat this map ... Go fetch a child of 5 !

warren

#21
Absolutely. GetScriptVar and SetScriptVar. Their use is a little complicated.

Script1.crpl:
$isTheScript1:1
$Activated:0

<-Activated if @body endif


Script2.crpl:

<-activated if
  "isTheScript1" 1 GetCoresWithVar 0 do
    ->unit
    <-unit "Script1.crpl" "Activated" 1 SetScriptVar
  loop
endif


Alternatively, you can replace $isTheScript variables with $uniqueID variables. The do loop is still required to prevent bugs if an ID you are looking for is missing or duplicated.

Edit: Usually I split this into to two steps. By putting the (GetCoresWithVar) inside the (:awake Once) I only have to calculate the unit variable once the entire game. This requires that the partner core must exist at the beginning of the game or at the creation of the core. The beginning of the game is the first load after you click compile scripts in the editor for reference.

Xeos

Quote from: warren on March 09, 2015, 07:44:54 PM
Absolutely. GetScriptVar and SetScriptVar. Their use is a little complicated.

Script1.crpl:
$isTheScript1:1
$Activated:0

<-Activated if @body endif


Script2.crpl:

<-activated if
  "isTheScript1" 1 GetCoresWithVar 0 do
    ->unit
    <-unit "Script1.crpl" "Activated" 1 SetScriptVar
  loop
endif


Alternatively, you can replace $isTheScript variables with $uniqueID variables. The do loop is still required to prevent bugs if an ID you are looking for is missing or duplicated.

Yes you're right, that looks a little too complicated for my current level of scripting knowledge but I will play with it and see how it works. Thanks again for your help :)
A child of 5 could beat this map ... Go fetch a child of 5 !

Xeos

I think one of the reasons there is lag is because of the way i did the pump animations. So I am looking at that and working out how to use timers now Warren has kindly given me some excellent advice :) Hopefully that should make it better.. ;D
A child of 5 could beat this map ... Go fetch a child of 5 !

CrusaderDeleters

This is a really great map I've played. I have to admit, like teknotiss, it's unclear where you start from. Didn't take too long to understand, but I went from 2, to 1 (which I did without paying attention to), then 3, and then 4.
I think the graphical detail is extraordinary. Even to the point where you have one bit of the wall near the ground as a floor tile to make it look like the creep has depth to it (and that it's actually flowing if the creeper runs off the wall).
The PAC game itself was kind of meager. The Storyline isn't my type so I won't base it off of that at all. The entire game looked like it was a lot of work (and I bet it was).

In all, grats on the work. It was really fun to play. Only if it was a lot easier to make maps like these. ;)

Xeos

Quote from: CrusaderDeleters on March 14, 2015, 11:20:20 PM
This is a really great map I've played. I have to admit, like teknotiss, it's unclear where you start from. Didn't take too long to understand, but I went from 2, to 1 (which I did without paying attention to), then 3, and then 4.
I think the graphical detail is extraordinary. Even to the point where you have one bit of the wall near the ground as a floor tile to make it look like the creep has depth to it (and that it's actually flowing if the creeper runs off the wall).
The PAC game itself was kind of meager. The Storyline isn't my type so I won't base it off of that at all. The entire game looked like it was a lot of work (and I bet it was).

In all, grats on the work. It was really fun to play. Only if it was a lot easier to make maps like these. ;)

Thanks for your kind comments :) It came from an idea that Ashley (Legola33) had  and we both thought it would be a cool thing to do. It turned out to be quite tricky especially getting the tiles under the images to work properly because they had to be built blind. It took around 70 hours of work in total to make and test so we are pleased that there are some people that have enjoyed it :)
A child of 5 could beat this map ... Go fetch a child of 5 !

hbarudi

Totally stuck after getting the #4 to flip, have no idea how to continue not only the stronger anti creeper emitters strength 100, and I only have strength 10 and 50 emitters, but then the mortars do their work on me while the anti creeper fills up the whole map. Need a walkthrough for this one.

Xeos

Quote from: hbarudi on April 10, 2015, 04:21:20 AM
Totally stuck after getting the #4 to flip, have no idea how to continue not only the stronger anti creeper emitters strength 100, and I only have strength 10 and 50 emitters, but then the mortars do their work on me while the anti creeper fills up the whole map. Need a walkthrough for this one.

The way the map works is that it is constantly creating anti-creep so the time you take is important. If you take too long it will be too powerful to overcome. There is an image above in this thread which shows the four positions in the map where you need to push the creep into to blow up the pumps. So the key is to push/drag the creep around the channels in the map to get them there- you will also notice some collectors across the channels - They feed the power to the cannons etc so destroy them too.
A child of 5 could beat this map ... Go fetch a child of 5 !

arby793

It was kinda confusing for a pac but I really enjoyed it. Sorry I was forced to give it a 10 as I really think that it was under rated. Thanks I had a lot of fun with it.