Developer's Blog
Register Low Fi Mark Forums Read

Reply
 
Thread Tools
Old 08-23-2012, 02:30 AM   #21
Bashtime
Member
 
Bashtime's Avatar
 
Join Date: Jun 2009
Location: European
Posts: 485
Blog Entries: 1
Bashtime is offline

Default Need help debugging fog triggers.


so I don't quite understand how efficient code works. There is a trigger and you got functions. Meanwhile I wrote a little in the code. Luckyly I had a backup. I got compiling errors.
__________________
My ideas:

I support following ideas and give the soldier a T-up by clicking

  Reply With Quote
Old 08-23-2012, 02:30 AM   #22
Bashtime
Member
 
Bashtime's Avatar
 
Join Date: Jun 2009
Location: European
Posts: 485
Blog Entries: 1
Bashtime is offline
Default Re: Need help debugging fog triggers.

so I don't quite understand how efficient code works. There is a trigger and you got functions. Meanwhile I wrote a little in the code. Luckyly I had a backup. I got compiling errors. But some intended changes worked.
__________________
My ideas:

I support following ideas and give the soldier a T-up by clicking

  Reply With Quote
Old 08-23-2012, 07:49 PM   #23
MauranKilom
Member
 
MauranKilom's Avatar
 
Join Date: Jan 2010
Location: Germany
Posts: 5,042
MauranKilom is offline
Default Re: Need help debugging fog triggers.

Was there a question in that?
__________________
I might edit my p0sts frequently and rapidly after posting.

DotA code of the week:
Jass:
function Func0243 takes nothing returns nothing
  call Func0242()
endfunction

Fix OD combo! IMPLEMENTED!
  Reply With Quote
Old 08-24-2012, 12:40 AM   #24
Bashtime
Member
 
Bashtime's Avatar
 
Join Date: Jun 2009
Location: European
Posts: 485
Blog Entries: 1
Bashtime is offline
Default Re: Need help debugging fog triggers.

Yes. How is JASS more efficient? when I need to refer to a function in evry if-case the game goes slower?
__________________
My ideas:

I support following ideas and give the soldier a T-up by clicking

  Reply With Quote
Old 08-24-2012, 04:04 PM   #25
MauranKilom
Member
 
MauranKilom's Avatar
 
Join Date: Jan 2010
Location: Germany
Posts: 5,042
MauranKilom is offline
Default Re: Need help debugging fog triggers.

Exactly. It's just unneeded, and the GUI-Jass is just painful to watch. If you create an if-condition, it does horrible things with nots to it and so on.

The point is, many functionsbe especially careful with those that have BJ in their name use many more CPU cycles than necessary. While that doesn't matter for most smaller maps, if you want a stable map with lots of features (like >400 unique triggered abilities on >100 heroes) you should think about what makes the game slower.
__________________
I might edit my p0sts frequently and rapidly after posting.

DotA code of the week:
Jass:
function Func0243 takes nothing returns nothing
  call Func0242()
endfunction

Fix OD combo! IMPLEMENTED!
  Reply With Quote
Old 08-26-2012, 09:17 AM   #26
-Kobas-
Member
 
-Kobas-'s Avatar
 
Join Date: Aug 2010
Location: Serbia, Belgrade
Posts: 52
-Kobas- is offline
Default Re: Need help debugging fog triggers.

Any huge map should have at least core systems coded in v/jass.
You probably know that Skibi's Castle TD map created by Blizzard o.O?
What if I tell you that converting code into jass, optimizing it and cleaning leaks can remove all lag from game.

Btw here you go the most simple example, GUI will generate BJ functions just like MauranKilom said above, and they look like this:
Jass:
function CameraSetSmoothingFactorBJ takes real factor returns nothing
    call CameraSetSmoothingFactor(factor)
endfunction
It just make no sense to use function when you can call native directly, at least in this and half of other bj functions.
__________________
  Reply With Quote
Old 08-26-2012, 01:47 PM   #27
Bashtime
Member
 
Bashtime's Avatar
 
Join Date: Jun 2009
Location: European
Posts: 485
Blog Entries: 1
Bashtime is offline
Default Re: Need help debugging fog triggers.

I didn't use native since I dont know how to use them. Let's say a unit receives debuff "thunderclap" and I want it to be hexed.

It would be something like this in GUI I assume

function qz takes nothing returns boolean
'A000'==castedspell

function trigger_actions takes nothing returns nothing
locals unit u
player p
if (qz())
set u= createUnit(*owner of casting unit*,'U000',30.)
call u to use 'A002' at casted unit
call triggersleepaction(1)
call removeunit u

function Init_trigger_**** takes nothing return noithing
call Addactions (Init_trigger_****,TriggerActions)

I think I could write
if ('A000'==castedspell)
instead, right?
So I had 1 function less
How do natives work?
I dont want to do a trigger everytime for: A unit dies, Elapsed Time, aquires item, yea

Btw: 1 smaller problem, I faced:
http://www.youtube.com/watch?v=UaQcT...ature=youtu.be
I created the endboss looking this way. I changed it's collision size to 800 assuming it's the size a unit can walk through. However, look: You can walk through it. Why?
__________________
My ideas:

I support following ideas and give the soldier a T-up by clicking

  Reply With Quote
Old 08-26-2012, 01:58 PM   #28
Bashtime
Member
 
Bashtime's Avatar
 
Join Date: Jun 2009
Location: European
Posts: 485
Blog Entries: 1
Bashtime is offline
Default Re: Need help debugging fog triggers.

I know there was a -snow command in earlier DotA. I want to transform a part of the map into same terrain of Sentinel Spawning Zone. So after you completed your quest in Valhalla you'll be sent back to DotA world. The spawning zone is supposed to symbolize it.
__________________
My ideas:

I support following ideas and give the soldier a T-up by clicking

  Reply With Quote
Old 08-26-2012, 04:08 PM   #29
MauranKilom
Member
 
MauranKilom's Avatar
 
Join Date: Jan 2010
Location: Germany
Posts: 5,042
MauranKilom is offline
Default Re: Need help debugging fog triggers.

I'm not sure you understand what "native" means.

I believe collision size can't take arbitrary values (according to this 48 is the upper limit), so setting it to 500 does nothing. Can the boss move? If not, consider placing pathing blockers around him.

You can set the terrain at a specified location to a specified "texture". I'll look how it is/was done in dota though.
__________________
I might edit my p0sts frequently and rapidly after posting.

DotA code of the week:
Jass:
function Func0243 takes nothing returns nothing
  call Func0242()
endfunction

Fix OD combo! IMPLEMENTED!
  Reply With Quote
Old 08-27-2012, 12:15 AM   #30
Bashtime
Member
 
Bashtime's Avatar
 
Join Date: Jun 2009
Location: European
Posts: 485
Blog Entries: 1
Bashtime is offline
Default Re: Need help debugging fog triggers.

thank you. Fortress has 176 collision size
__________________
My ideas:

I support following ideas and give the soldier a T-up by clicking

  Reply With Quote
Old 08-27-2012, 06:14 PM   #31
Bashtime
Member
 
Bashtime's Avatar
 
Join Date: Jun 2009
Location: European
Posts: 485
Blog Entries: 1
Bashtime is offline
Default Re: Need help debugging fog triggers.

I gonna recode every unit placement again with loops, natives etc. If I understood correctly natives are already implemented functions.

Another questions. I got the Code from 6.67 deprotected. wouldn't it be the easiest way to get item data hero data and unit data from it and delete the spawning units + unit placement part?
__________________
My ideas:

I support following ideas and give the soldier a T-up by clicking

  Reply With Quote
Old 08-28-2012, 03:09 AM   #32
Bashtime
Member
 
Bashtime's Avatar
 
Join Date: Jun 2009
Location: European
Posts: 485
Blog Entries: 1
Bashtime is offline
Default Re: Need help debugging fog triggers.

How do actions work? E.g.
Player_event_death
if (true) then ...

Will the code beneath REgisterEVent always be executed or only if the event is really triggered?
__________________
My ideas:

I support following ideas and give the soldier a T-up by clicking

  Reply With Quote
Old 08-28-2012, 09:32 AM   #33
-Kobas-
Member
 
-Kobas-'s Avatar
 
Join Date: Aug 2010
Location: Serbia, Belgrade
Posts: 52
-Kobas- is offline
Default Re: Need help debugging fog triggers.

Code:
Test
    Events
        Unit - A unit owned by Player 1 (Red) Dies
    Conditions
        (Unit-type of (Triggering unit)) Equal to Footman
    Actions
        Skip remaining actions
Each time when some player Red owned unit dies, this trigger will be fired.
It will check it's condition next, if returned boolean equal to true, actions will be executed. In our example, if player red owned footman dies our trigger will do nothing.

That's why people created many scripts named libraries that handle and recycle such events.

Imagine having 100 spells in your map, each time when unit cast spell 100 triggers fire their condition function/s and check for right one. Ofc only 1 will run actions below, but conditions can often be huge and complex so it will slow down map. I won't even mention bad jass coding where you use conditions as actions to speed up your code.

But to return to topic you should always register as many events you can within single trigger, it's always better to have 1 trigger, 1 event, and 1 huge "if then else" with function calls (Execute/Run trigger in GUI) instead 100 triggers that do some checking each time unit cast spell or do something else.
__________________
  Reply With Quote
Old 08-28-2012, 10:15 AM   #34
MauranKilom
Member
 
MauranKilom's Avatar
 
Join Date: Jan 2010
Location: Germany
Posts: 5,042
MauranKilom is offline
Default Re: Need help debugging fog triggers.

Quote:
Originally Posted by -Kobas- View Post
Imagine having 100 spells in your map, each time when unit cast spell 100 triggers fire their condition function/s and check for right one. Ofc only 1 will run actions below, but conditions can often be huge and complex so it will slow down map. I won't even mention bad jass coding where you use conditions as actions to speed up your code.
How ironic that this is exactly the way dota is coded... Only it has twice as many spells and most of them are packed into the conditions of the triggers. Had a good laugh though
__________________
I might edit my p0sts frequently and rapidly after posting.

DotA code of the week:
Jass:
function Func0243 takes nothing returns nothing
  call Func0242()
endfunction

Fix OD combo! IMPLEMENTED!
  Reply With Quote
Old 08-28-2012, 07:59 PM   #35
Bashtime
Member
 
Bashtime's Avatar
 
Join Date: Jun 2009
Location: European
Posts: 485
Blog Entries: 1
Bashtime is offline
Default Re: Need help debugging fog triggers.

Quote:
Originally Posted by -Kobas- View Post
But to return to topic you should always register as many events you can within single trigger, it's always better to have 1 trigger, 1 event, and 1 huge "if then else" with function calls (Execute/Run trigger in GUI) instead 100 triggers that do some checking each time unit cast spell or do something else.
You mean:
Event: unit dies
Condition: none
Actions: If Spell=A00 then .. else (If Spell==A01 then.. else( If Spell=A02 then.. else (if Spell=A03 .....
__________________
My ideas:

I support following ideas and give the soldier a T-up by clicking

  Reply With Quote
Old 08-28-2012, 08:39 PM   #36
MauranKilom
Member
 
MauranKilom's Avatar
 
Join Date: Jan 2010
Location: Germany
Posts: 5,042
MauranKilom is offline
Default Re: Need help debugging fog triggers.

Yes, that's what he meant. But again, dota has probably over 200 spells that each have their own trigger, and most of them throw their actions into the conditions (even for timer stuff). So don't worry too much about what he said.
__________________
I might edit my p0sts frequently and rapidly after posting.

DotA code of the week:
Jass:
function Func0243 takes nothing returns nothing
  call Func0242()
endfunction

Fix OD combo! IMPLEMENTED!
  Reply With Quote
Old 08-28-2012, 09:50 PM   #37
Bashtime
Member
 
Bashtime's Avatar
 
Join Date: Jun 2009
Location: European
Posts: 485
Blog Entries: 1
Bashtime is offline
Default Re: Need help debugging fog triggers.

Quote:
Originally Posted by MauranKilom View Post
Yes, that's what he meant. But again, dota has probably over 200 spells that each have their own trigger, and most of them throw their actions into the conditions (even for timer stuff). So don't worry too much about what he said.
Do you mean Conditions Into Actions?

I want to summarize, say if Im right.
call RegisterTriggerEvent <- if this line is not executed following code of the function won't be executed


This is my recoded Map Init func

function InitTrig_init takes nothing returns nothing
local integer i=0
local integer k=1
local integer j=0
local integer l=0
local unit u
set gg_trg_init = CreateTrigger( )

loop
exitwhen k==6
call SetPlayerAlliance(Player(k),Player(0),ConvertAllia nceType(3),true)
call SetPlayerAlliance(Player(k),Player(0),ConvertAllia nceType(4),true)
call SetPlayerAlliance(Player(0),Player(k),ConvertAllia nceType(3),true)
call SetPlayerAlliance(Player(0),Player(k),ConvertAllia nceType(4),true)
call SetPlayerMaxHeroesAllowed( 1, Player(k) )
if(IsPlayerSlotState(Player(k),ConvertPlayerSlotSt ate(1))) then
set udg_PlayersPlaying=udg_PlayersPlaying+1
endif
set k=k+1
endloop

//====UNIT PLACEMENT================
loop
exitwhen j==6+2*udg_PlayersPlaying
set u=CreateUnitAtLoc(Player(6), 'nmcf',GetRectCenter(Rect(-3650.00, -9450.00, -3200.00, -9000.00)), GetRandomDirectionDeg() )
call IssuePointOrderLocBJ( u, "patrol", Location(-2400.,-9050.))
set u=CreateUnitAtLoc(Player(6), 'nmcf',GetRandomLocInRect(Rect(-4350.00, -11350.00, -3800.00, -11050.00)), GetRandomDirectionDeg() )
call IssuePointOrderLocBJ( u, "patrol", GetRandomLocInRect(Rect(-3300.,-11300.,-3400,-11100)))
set j=j+1
endloop
loop
exitwhen i==5
call SetPlayerStateBJ( Player(i+1), PLAYER_STATE_RESOURCE_GOLD, 1450-150*udg_PlayersPlaying)
call CreateFogModifierRectBJ( true, Player(1), FOG_OF_WAR_VISIBLE, Rect(-900.,-8000.,900.,-5300.) )
set i=i+1
endloop
call FogEnable(true)
call SetTimeOfDay( 22.00 )
call UseTimeOfDayBJ( false )
call SetPlayerFlagBJ( PLAYER_STATE_GIVES_BOUNTY, true, Player(6) )

//====Difficulty===================

call SetPlayerHandicap(Player(6),.75)
if (udg_PlayersPlaying ==3) then
call SetPlayerTechResearchedSwap('Rhme',1, Player(6))
call SetPlayerHandicap(Player(6),1.)
endif
if (udg_PlayersPlaying ==4) then
call SetPlayerTechResearchedSwap('Rhme',2, Player(6))
call SetPlayerHandicap(Player(6),1.2)
endif
if (udg_PlayersPlaying ==5) then
call SetPlayerTechResearchedSwap('Rhme',3, Player(6))
call SetPlayerHandicap(Player(6),1.5)
endif

//============================D O O D A D S==============================

set udg_Bomb[9]=CreateDestructable('LTex',-5216.,-1056.,269.,2.,0)
set udg_Bomb[8]=CreateDestructable('LTex',-9888.,-4832.,269.,2.,0)
set udg_Bomb[7]=CreateDestructable('LTex',-10080.,-4512.,269.,2.,0)
set udg_Bomb[6]=CreateDestructable('LTex',-10272.,-4256.,269.,2.,0)
set udg_Bomb[5]=CreateDestructable('LTex',-10272.,-4000.,269.,2.,0)
set udg_Bomb[4]=CreateDestructable('LTex',-10080.,-4000.,269.,2.,0)
set udg_Bomb[3]=CreateDestructable('LTex',-10016.,-3808.,269.,2.,0)
set udg_Bomb[2]=CreateDestructable('LTex',-9952.,-4000.,269.,2.,0)
set udg_Bomb[1]=CreateDestructable('LTex',-10080.,-3424.,269.,2.,0)
set udg_Bomb[0]=CreateDestructable('LTex',-7840.,1440.,269.,2.,0)
set udg_Bomb[17]=CreateDestructable('LTex',-8544.,-2400.,269.,2.,0)
set udg_Bomb[16]=CreateDestructable('LTex',-8864.,-1312.,269.,2.,0)
set udg_Bomb[15]=CreateDestructable('LTex',-10400.,-1312.,269.,2.,0)
set udg_Bomb[14]=CreateDestructable('LTex',-10400.,-2144.,269.,2.,0)
set udg_Bomb[13]=CreateDestructable('LTex',-7456.,-1952.,269.,2.,0)

//====DOORS PLACEMENT================

set udg_EisenTorVert[0]=CreateDestructable('DTg5',-7872.,2304.,270.,.9,0)
set udg_EisenTorVert[1]=CreateDestructable('DTg5',-2688.,-9600.,270.,.9,0)
set udg_EisenTorVert[2]=CreateDestructable('DTg5',-9600.,-5504.,270.,.9,0)
set udg_EisenTorVert[3]=CreateDestructable('DTg5',10816.,-576.,270.,.9,0)

set udg_EisenTorHor[0]=CreateDestructable('DTg7',-5504.,-1280.,.0,.9,0)
set udg_EisenTorHor[1]=CreateDestructable('DTg7',-7552.,-10816.,.0,.9,0)
set udg_EisenTorHor[2]=CreateDestructable('DTg7',-6016.,1088.,.0,.9,0)
set udg_EisenTorHor[3]=CreateDestructable('DTg7',-1536.,-10688.,.0,.9,0)
set udg_EisenTorHor[4]=CreateDestructable('DTg7',-384.,2496.,.0,.9,0)
set udg_EisenTorHor[5]=CreateDestructable('DTg7',-4864.,1152.,.0,.9,0)
set udg_EisenTorHor[6]=CreateDestructable('DTg7',-9216.,3136.,.0,.9,0)
set udg_EisenTorHor[7]=CreateDestructable('DTg7',-4672.,-11328.,.0,.9,0)
set udg_EisenTorHor[8]=CreateDestructable('DTg7',8128.,-6848.,.0,.9,0)
set udg_EisenTorHor[9]=CreateDestructable('DTg7',8128.,-7488.,.0,.9,0)
set udg_EisenTorHor[10]=CreateDestructable('DTg7',8128.,-8128.,.0,.9,0)
set udg_EisenTorHor[11]=CreateDestructable('DTg7',-5696.,-7744.,.0,.9,0)
set udg_EisenTorHor[12]=CreateDestructable('DTg7',9152.,-6848.,.0,.9,0)
set udg_EisenTorHor[13]=CreateDestructable('DTg7',9152.,-7488.,.0,.9,0)
set udg_EisenTorHor[14]=CreateDestructable('DTg7',9152.,-8128.,.0,.9,0)
set udg_EisenTorHor[15]=CreateDestructable('DTg7',8128.,-8768.,.0,.9,0)
set udg_EisenTorHor[16]=CreateDestructable('DTg7',9152.,-8768.,.0,.9,0)
set udg_EisenTorHor[17]=CreateDestructable('DTg7',-4992.,-5760.,.0,.9,0)
set udg_EisenTorHor[18]=CreateDestructable('DTg7',1024.,-10688.,.0,.9,0)
set udg_EisenTorHor[19]=CreateDestructable('DTg7',-9344.,-8640.,.0,.9,0)
set udg_EisenTorHor[20]=CreateDestructable('DTg7',-5376.,2432.,.0,.9,0)
set udg_EisenTorHor[21]=CreateDestructable('DTg7',4928.,-11072.,.0,.9,0)
set udg_EisenTorHor[22]=CreateDestructable('DTg7',4608.,-1344.,.0,.9,0)
set udg_EisenTorHor[23]=CreateDestructable('DTg7',6272.,-3968.,.0,.9,0)
set udg_EisenTorHor[24]=CreateDestructable('DTg7',-8704.,3136.,.0,.9,0)
set udg_EisenTorHor[25]=CreateDestructable('DTg7',4928.,-10432.,.0,.9,0)

set udg_ElvDoors[0]=CreateDestructable('LTe1',.0,-5440.,270.,.9,0) // ArenaDoor
set udg_ElvDoors[1]=CreateDestructable('LTe1',-9792.,-1216.,270.,.9,0) //Door to Catapults

set udg_LGatesHor[0]=CreateDestructable('LTg1',-9664.,-2944.,270.,.9,0) // BombRoom Door
endfunction
__________________
My ideas:

I support following ideas and give the soldier a T-up by clicking

  Reply With Quote
Last edited by Bashtime; 08-28-2012 at 10:07 PM.
Old 08-28-2012, 10:22 PM   #38
MauranKilom
Member
 
MauranKilom's Avatar
 
Join Date: Jan 2010
Location: Germany
Posts: 5,042
MauranKilom is offline
Default Re: Need help debugging fog triggers.

I'm not even sure what your question is right now...

When a trigger is fired because of any event (those are added by TriggerRegisterEvent()), the condition function(s) will be executed and if it(all of them) returns true, the action function(s?) will be executed.
Now, nothing prevents you from placing the code to be executed into the condition function rather than the action function. But this is apparently considered bad coding by the mapmaking community, which icefrog seemingly doesn't care about.
__________________
I might edit my p0sts frequently and rapidly after posting.

DotA code of the week:
Jass:
function Func0243 takes nothing returns nothing
  call Func0242()
endfunction

Fix OD combo! IMPLEMENTED!
  Reply With Quote
Old 08-29-2012, 02:23 PM   #39
Bashtime
Member
 
Bashtime's Avatar
 
Join Date: Jun 2009
Location: European
Posts: 485
Blog Entries: 1
Bashtime is offline
Default Re: Need help debugging fog triggers.

The worst part in the map right now is the trivia part by the former developer. there are 700 lines Code for 70 questions with ABCD. About 200 boolean functions integer=20,21...70. How can I make this code better?
__________________
My ideas:

I support following ideas and give the soldier a T-up by clicking

  Reply With Quote
Old 08-30-2012, 11:25 AM   #40
-Kobas-
Member
 
-Kobas-'s Avatar
 
Join Date: Aug 2010
Location: Serbia, Belgrade
Posts: 52
-Kobas- is offline
Default Re: Need help debugging fog triggers.

@MauranKilom well it's sad to see such bad coding in such popular map.
I still remember how some ultimate spells used to freeze my old PC ^_^
__________________
  Reply With Quote
Reply
  Entertainment Programming


Forum Jump

Thread Tools