ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Fri Nov 24, 2017 2:10 am

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Envisioning Auras
PostPosted: Fri Feb 24, 2012 11:17 pm 
Offline
Retired Ninja

Joined: Fri May 28, 2010 4:38 pm
Posts: 3756
Auras have come up in IRC a few times now and I wanted to lay out my thoughts on how they should work so hopefully someone who's much better at math then I am can take these ideas and make them possible.

ToME has a few Aura type effects already. Ice Storm is a good example of a map effect style aura. Conversely Gloom is a good example of an entity based aura.

What I'd like to see out of an engine function is a blend between the two. Auras should be tied to the entity but should update map effects each turn. To take just lite as an example. Right now we have a lite flag on an entity but all it's really doing is checking our Line of Sight radius. Lite is never really applied to the map, shading is instead applied to make the map appear to be lit (via applyLite).

In order to tell if a grid an actor is standing in is lit, you need to find the difference between it and every actor on the map with the lite attribute. If the lite attribute is greater then the distance then you know that the actor is in a lit tile. What I'd like is a function that simply tells the map grid that it is lit, that the source of that effect is Foo, and that Foo needs to update the map grid every time it moves, dies, or whatever. Then, to tell if the grid is lit all we'd need to do is ask it.

Of course the above is just a simple example. Ultimately the grid would need to work much like current map effects. When an actor steps into the grid the actor should ask the grid if there's any active auras and apply them to itself as needed. Some things would be fairly simple, others more complex. But I think with these building blocks we could do something like this.

Code:
if game.level.map:hasAura("icestorm") then
   local src = game.level.map.icestorm_aura.src
   local t = src:getTalentFromId(src.T_ICE_STORM)
   t.doIceStorm(src, self)
end


Granted, each aura should probably have a unique ID. So in the instance above we'd really be pulling all icestorm effects from the map and checking all sources and doing all doIceStorm functions.

Anyway, that's just my thoughts on how it could behave and how it could possibly be implemented.

_________________
Jack's Cheese and Bread Snack


Top
 Profile  
 
 Post subject: Re: Envisioning Auras
PostPosted: Sat Feb 25, 2012 9:43 pm 
Offline
Uruivellas

Joined: Sun Sep 05, 2010 5:11 am
Posts: 683
just thinking out loud but should each tile then have a table with functions about what they do?

code 1
Code:
map {} // map table


code 2
Code:
map {tile} // the tile is an element in the map


code 3
Code:
function1(x,y) // declare the function
return z

map {
 tile {
   x=2,
   y=20,
   function_table{function1(var_x,var_y), function2(var), ...}
 }
}


Since the functions are elements of the table, they can store different variables. You can then declare the functions somewhere else to see what they do with the variables.

Then talents should read/write intelligently these functions+variables.

If you (or an actor) enters a tile, then the game iterates over all functions stored in the table of that tile, parses the arguments to the function, and the function returns the effect? The function that does this iteration will have to do it somewhat intelligently (merge certain effects, do them in the right order, etc.).

So you are not asking if the table has function1, you just go over all elements of the table and the tile then tells you that it has function1 with variables var_x and var_y (if you can execute that function directly, then you don't need to run 'if then'?).

I have no idea, since I can't really code ;) still kinda fun to think about.


Top
 Profile  
 
 Post subject: Re: Envisioning Auras
PostPosted: Sat Feb 25, 2012 10:07 pm 
Offline
Uruivellas

Joined: Sun Sep 05, 2010 5:11 am
Posts: 683
Each talent owned by an actor must have a unique ID somewhere right?
Since you can call :hastalent(T_TALENTNAME) that means that this must be stored in a table somewhere?
Should you not be able to change whatever T_TALENTNAME refers to into a table with a unique ID (each talent name owned by the player table is itself a table)?
Then you can store a function in that table (with a unique ID connected to that specific actor)
Then you can store a variable in the tile table, and link it with the table stored in the T_TALENTNAME?
(you can link multiple variables to the same table in lua right?)

Then you make the act() function update the tile table to add/remove the variables linked to the T_TALENTNAME table:
when you call act(), first run removetilevariables() then move() then addtilevariables().
(on act you can do a cross-reference check by using the table ID's to see what variables belong to the actor, and then remove those? - I don't know if that makes any sense :P)

This way no functions are stored directly in the tile table, and you can have many talents with the same name that all refer to a different ID.

Just thinking out loud, because I don't have any idea :D.
cheers.


Top
 Profile  
 
 Post subject: Re: Envisioning Auras
PostPosted: Mon Mar 05, 2012 7:39 pm 
Offline
Spiderkin

Joined: Wed Jan 26, 2011 3:47 pm
Posts: 557
I would like something that lets me do this:

An actor has a talent x: get effect when an actor in range x takes a critical hit.


Last edited by Dekar on Mon Mar 05, 2012 8:44 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Envisioning Auras
PostPosted: Mon Mar 05, 2012 8:17 pm 
Offline
Retired Ninja

Joined: Fri May 28, 2010 4:38 pm
Posts: 3756
Dekar basically wanted an easy way to do something like...

Actor A has a power that goes off whenever someone nearby gets Crit (regardless of who causes the crit).

Something like a Blood Frenzy proc I'm assuming.

_________________
Jack's Cheese and Bread Snack


Top
 Profile  
 
 Post subject: Re: Envisioning Auras
PostPosted: Tue May 27, 2014 9:22 pm 
Offline
Retired Ninja

Joined: Fri May 28, 2010 4:38 pm
Posts: 3756
Bump so someday I can make a shadow caster.

_________________
Jack's Cheese and Bread Snack


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group