Shadow Vale Forums: A few engine things I found - Shadow Vale Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

A few engine things I found

#1 User is offline   N-methyl D-aspartic acid Icon

  • Materia Girl
  • PipPipPipPip
  • Group: Members
  • Posts: 435
  • Joined: 26-January 07

Posted 28 July 2007 - 04:07 PM

This came up in a discussion with Laz...

0- Dawn
250- Full Light
3750- Dusk
4000- Night
4250- Twilight
4750- Daybreak

...and I realized I hadn't shared it yet. So yeah, there: The light schedule for BoA, so far as I can tell.

And determining HP for monsters based merely off of level:
Level VS. Health...

CODE

1  |2  |3  |4  |5  |6  |7  |8  |9  |10 |
---+---+---+---+---+---+---+---+---+---|
9  |13 |14 |19 |20 |27 |29 |37 |39 |49 |

11 |12 |13 |14 |15 |16 |17 |18 |19 |20 |
---+---+---+---+---+---+---+---+---+---|
52 |63 |66 |79 |83 |97 |101|117|122|139|

21 |22 |23 |24 |25 |26 |27 |28 |29 |30 |
---+---+---+---+---+---+---+---+---+---|
144|163|169|189|195|217|224|247|254|279|

31 |32 |33 |34 |35 |36 |37 |38 |39 |40 |
---+---+---+---+---+---+---+---+---+---|
287|313|321|349|358|387|396|427|437|469|

41 |42 |43 |44 |45 |46 |47 |48 |49 |50 |
---+---+---+---+---+---+---+---+---+---|
479|513|524|559|570|607|619|657|669|709|

51 |52 |53 |54 |55 |
---+---+---+---+---|
722|763|776|819|833|


And some buff information:

CODE

        BLESS: Up to 5 ranks of damage, +25% to hit, +25% to dodge
    Ranks:    1/ 2/ 3/ 4/ 5/ 6/ 7/ 8/ 9/10/11/12/
        --+--+--+--+--+--+--+--+--+--+--+--+
    Bonus:    1/ 1/ 2/ 2/ 2/ 3/ 3/ 3/ 4/ 4/ 4/ 5/

    Adds 1d3 +3 per spell level (including the first)

        HASTE:

    WB- (Intelligence + Priest) / 8 ranks
    Haste- (spell level)d3 + (Intelligence + Mage)/3 ranks


And finally:

CODE

SKILL RESISTANCES:
Dexterity - +5% Fire, +5% Cold, +5% Magic every 4 ranks
Intelligence - +5% Mental every 2 ranks
Endurance - +5% Poison
Hardiness - +1% Fire, +1% Cold, +1% Magic; +5% Poison every 2 ranks; +5% Fire, +5% Cold, +5% Magic every 4 ranks
Mage Spells - +5% Magic, +5% Mental every 2 ranks
Priest Spells - +5% Mental every 2 ranks
Luck - +5% Fire, +5% Cold, +5% Magic, +5% Poison, +5% Acid
Magery - +5% Magic, +5% Mental
Resistance - +5% Fire, +5% Cold, +5% Magic, +5% Mental

0

#2 User is offline   Nioca Icon

  • Dervish
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,779
  • Joined: 19-January 07
  • Location:Ermarian

Post icon  Posted 28 July 2007 - 08:09 PM

I wish the level-to-HP chart went all the way up to L100. That'd make it easier to adjust monster HP, rather than guessing and seeing how close to the goal I ended up. Still this is helpful stuff, and I'm pinning it.
0

#3 User is offline   Ephesos Icon

  • Voice of Reason
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,116
  • Joined: 15-January 07
  • Location:Somewhere dark... damn torch still won't light.

Posted 28 July 2007 - 10:44 PM

w00tage. Thanks, TM and Nioca. Mostly TM.
0

#4 User is offline   Samson Icon

  • Gone Bunburrying
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 3,212
  • Joined: 23-January 07
  • Location:England.

Posted 29 July 2007 - 01:50 PM

Thanks. I did have the daylight shizzle worked out and on a scruffy scrap of paper (thank you Twilight Valley), but the health chart especially will be awesomely helpful.
IPB Image
0

#5 User is offline   Arancaytar Icon

  • Dervish
  • Icon
  • Group: Administrators
  • Posts: 1,935
  • Joined: 17-January 07
  • Gender:Male
  • Location:das Germany, ja.

Posted 29 July 2007 - 04:55 PM

Is there enough of this stuff to make another Wikibook page or another PDF reference like Westra's cookbook?
Eternity lies ahead of us, and behind. Have you drunk your fill?
The 8 digits of π beginning from 242422 places after the decimal point are 42424242. --Wikipedia
IPB Image
0

#6 User is offline   Nioca Icon

  • Dervish
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,779
  • Joined: 19-January 07
  • Location:Ermarian

Posted 29 July 2007 - 07:14 PM

Here's a completed Level -> HP comparison chart for monsters.
CODE

1   |2   |3   |4   |5   |6   |7   |8   |9   |10  |
----+----+----+----+----+----+----+----+----+----|
9   |13  |14  |19  |20  |27  |29  |37  |39  |49  |

11  |12  |13  |14  |15  |16  |17  |18  |19  |20  |
----+----+----+----+----+----+----+----+----+----|
52  |63  |66  |79  |83  |97  |101 |117 |122 |139 |

21  |22  |23  |24  |25  |26  |27  |28  |29  |30  |
----+----+----+----+----+----+----+----+----+----|
144 |163 |169 |189 |195 |217 |224 |247 |254 |279 |

31  |32  |33  |34  |35  |36  |37  |38  |39  |40  |
----+----+----+----+----+----+----+----+----+----|
287 |313 |321 |349 |358 |387 |396 |427 |437 |469 |

41  |42  |43  |44  |45  |46  |47  |48  |49  |50  |
----+----+----+----+----+----+----+----+----+----|
479 |513 |524 |559 |570 |607 |619 |657 |669 |709 |

51  |52  |53  |54  |55  |56  |57  |58  |59  |60  |
----+----+----+----+----|----+----+----+----+----|
722 |763 |776 |819 |833 |877 |891 |937 |952 |999 |

61  |62  |63  |64  |65  |66  |67  |68  |69  |70  |
----+----+----+----+----|----+----+----+----+----|
1014|1063|1079|1129|1145|1197|1214|1267|1284|1339|

71  |72  |73  |74  |75  |76  |77  |78  |79  |80  |
----+----+----+----+----|----+----+----+----+----|
1357|1413|1431|1489|1508|1567|1586|1647|1667|1729|

81  |82  |83  |84  |85  |86  |87  |88  |89  |90  |
----+----+----+----+----|----+----+----+----+----|
1749|1813|1834|1899|1920|1987|2009|2077|2099|2169|

91  |92  |93  |94  |95  |96  |97  |98  |99  |100 |
----+----+----+----+----|----+----+----+----+----|
2192|2263|2286|2359|2383|2457|2481|2557|2582|2659|

0

#7 User is offline   Lord Grimm Icon

  • I am the Very Model of a Modern Forum Spammer
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,242
  • Joined: 14-January 07
  • Gender:Male
  • Location:A top-secret bunker hidden somewhere in New Jersey

Posted 30 July 2007 - 01:33 PM

I wonder, will someone be posting this info on a permanent website, or will we simply have to direct everyone to this topic?

Not that I mind publicizing Shadow Vale; it just seems like this needs to go in a databse somewhere.
0

#8 User is offline   Parus major Icon

  • Skribbane Smuggler
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,311
  • Joined: 29-January 07
  • Location:the Netherlands

Posted 05 August 2007 - 10:15 AM

QUOTE(Lord Grimm @ Jul 30 2007, 08:33 PM) View Post

I wonder, will someone be posting this info on a permanent website, or will we simply have to direct everyone to this topic?


I'm quite certain i will put this up on my webpage very, very soon.

Thanks TM and Nioca!

EDIT: I put it up, here.
The Wrath of the Elderburry Cheesecake, home of my stuff, including my scenarios, scripts, graphics and the Largas NephilseŃs grammar and vocabulary guide.

[end of plug]
0

#9 User is offline   N-methyl D-aspartic acid Icon

  • Materia Girl
  • PipPipPipPip
  • Group: Members
  • Posts: 435
  • Joined: 26-January 07

Posted 01 December 2007 - 08:38 PM

Also note: There are 63 lines of text in the box below the main view. In case, for whatever reason, you'd want to clear the party's text box.
0

#10 User is online   Niemand Icon

  • Ineffectual Mayor No. 352
  • PipPipPipPipPip
  • Group: Members
  • Posts: 628
  • Joined: 19-January 07
  • Gender:Male
  • Location:Wisconsin

Posted 04 January 2008 - 12:43 AM

A tricky engine detail related to scripting: It appears, although I haven't been able to completely verfiy this, that Avernumscript does NOT utilize short circuit evaluation of binary operators.

For persons not familiar with the jargon, this means that in an example like
CODE
if(call_1() && call_2())
    //do stuff

call_2 will be executed even if call_1 evaluates to false. This is unlike more sophisticated systems in which the evaluation of call_2 would be skipped in this situation if call_1 proves to be false, since if call_1 is false no possible value of call_2 could make the && evaluate to true.

This has two effects: (1)lack of speed and (2)lack of safety:
(1) is fairly simple: if you write
CODE
if(A && B && C && . . . && Z)
    //do stuff

the avernumscript interpreter will ploddingly evaluate A, B, C and so on all the way to Z, even if B turns out to be false and most of the work could have been skipped.

(2) is more complicated and rarer, but often the more serious; as an example I have found the the char_attitude_to_char call doesn't like having being asked to evaluate a character's attitde toward an invalid character number like -1. But what if you wanted to do something if character i hates the character to its north? It's then natural to write:
CODE
if(char_attitude_to_char(i, char_on_loc(char_loc_x(i),char_loc_y(i)  - 1) == 2)
    //do stuff

However, char_on_loc may return -1 if there is no character at the specified location, which would make char_attitude_to_char unhappy. Unfortunately, trying
CODE
if((char_on_loc(char_loc_x(i),char_loc_y(i)  - 1) > -1)
  && (char_attitude_to_char(i, char_on_loc(char_loc_x(i),char_loc_y(i) - 1) == 2))
    //do stuff

won't cut it; the game discovers that, by golly, there's nobody at that location, and then tries the attitude call anyway. The safe way to do this check is:
CODE
if(char_on_loc(char_loc_x(i),char_loc_y(i)  - 1) > -1){
    if(char_attitude_to_char(i, char_on_loc(char_loc_x(i),char_loc_y(i) - 1) == 2)
        //do stuff
}


Although I haven't been able to think of a clear test for this, the chunk of the interpreter code which is in the 3D Edior supports this theory, and is likely equivalent to the game's own code. I have also observed the problems described in the last example, so I'm reasonably certain that all this is accurate.

In conclusion, try to avoid writing really long chains of &&'s and ||'s because they will always be slow, and be aware that every bit of code you write in a condition will run if any of it runs.

0

#11 User is offline   Arancaytar Icon

  • Dervish
  • Icon
  • Group: Administrators
  • Posts: 1,935
  • Joined: 17-January 07
  • Gender:Male
  • Location:das Germany, ja.

Posted 04 January 2008 - 01:15 PM

That is extremely useful to know, and I didn't know. Thanks.
Eternity lies ahead of us, and behind. Have you drunk your fill?
The 8 digits of π beginning from 242422 places after the decimal point are 42424242. --Wikipedia
IPB Image
0

#12 User is offline   Lazarus Icon

  • Kakistocrat
  • Icon
  • Group: Administrators
  • Posts: 572
  • Joined: 14-January 07

Posted 20 May 2008 - 05:56 PM

Some spell formulas that aren't in the manual.

Divine Restoration:Full healing, +40 HP over the maximum for each spell level above 1.

Arcane Shield:*
(3 + ((Spell level + 1) / 2) + Bonus/10) Levels of resistance
(8 + Spell Level + Bonus/6) Levels of shielding
(3 + ((Spell level + 1) / 2) + Bonus/10) Levels of martyr's shield (Starts at spell level 2)
(Spell Level - 2) Levels of invulnerability (Starts at spell level 3)

*Exact formulas for status levels could be off. These are the formulas I came up with to most closely fit the data I gathered. They didn't come out too pretty.
0

#13 User is offline   N-methyl D-aspartic acid Icon

  • Materia Girl
  • PipPipPipPip
  • Group: Members
  • Posts: 435
  • Joined: 26-January 07

Posted 25 May 2008 - 01:05 AM

get_unlock_spell_strength()

It's not listed in the appendices, so:
lvl*3 + (MAG+INT)/2

(lvl being, obviously, that of Unlock Doors)
0

#14 User is offline   N-methyl D-aspartic acid Icon

  • Materia Girl
  • PipPipPipPip
  • Group: Members
  • Posts: 435
  • Joined: 26-January 07

Posted 25 May 2008 - 06:02 PM

Note on party_size()

It does NOT count joined NPCs. If you want to count joined NPCs, set a flag when they join and unset it when they leave/die. (Use the START_STATE of the scenario to check for their deaths if you must.)
0

#15 User is offline   Lazarus Icon

  • Kakistocrat
  • Icon
  • Group: Administrators
  • Posts: 572
  • Joined: 14-January 07

Posted 26 May 2008 - 11:59 AM

Or char_ok(4/5)
0

#16 User is offline   N-methyl D-aspartic acid Icon

  • Materia Girl
  • PipPipPipPip
  • Group: Members
  • Posts: 435
  • Joined: 26-January 07

Posted 26 May 2008 - 10:56 PM

That is, presumably, what I had meant that one ought to check for. No matter.
0

#17 User is offline   Nioca Icon

  • Dervish
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,779
  • Joined: 19-January 07
  • Location:Ermarian

Posted 03 July 2008 - 03:40 PM

On a species-related note, Giants (species 4) are not considered humanoid by the game engine.
0

#18 User is offline   Nioca Icon

  • Dervish
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,779
  • Joined: 19-January 07
  • Location:Ermarian

Posted 14 July 2008 - 08:08 PM

Okay, I was curious about the effects of the skill Luck. I was noticing that a moderately-armored character that I had pumped luck into was taking less damage than my heavily-armored bruiser. So, I decided to run a little test on luck.

The effects per point of Luck are:
+5% to Elemental, Poison, and Magic Resistances
+0-2% Physical Damage Resistance
+5% Chance of Saving Character from a Fatal Blow (maxing out at 90%, which requires 18 luck)

In other news, I am now putting a lot of luck into my fighters.
0

#19 User is online   Niemand Icon

  • Ineffectual Mayor No. 352
  • PipPipPipPipPip
  • Group: Members
  • Posts: 628
  • Joined: 19-January 07
  • Gender:Male
  • Location:Wisconsin

Posted 17 April 2009 - 11:42 PM

Node counting in Avernumscript:

As we are all well aware, there is a strict upper limit to how many 'nodes' of Avernumscript the game will execute before it assume that the script has entered an infinite loop and kills it. The question which had always bothered me was: What is a 'node' in Avernumscript? The following is derived from the script interpreter code contained in the editor, but I have found no relevant differences in behavior between that code and the code actually used in the game.

From reading the code, I found that each of the following objects costs one node:
  • if(...){ or if(...)
  • while(...){
  • foo(...)
  • var=...; where var is some variable
  • ; (an extra not associated with any other statement
  • }

This shows that, unlike what one might guess, 'nodes' do not correspond at all directly to tokens, since the items in the list above range from 'if(...){' which contains a minimum of 5 tokens to '}' which is a single token. Happily, they aren't totally incomprehensible, as they will tend to correspond pretty much one-to-one with complete statements. The weirdest one, and something of a surprise, is '}' which counts even though it is typically not thought of as actually doing anything (especially in the case of an if statement, where it merely serves to hint to the interpreter which statements are inside and which aren't, and really does do nothing at run time).

I tested this by testing each of the little block below, and found them to all have the node counts that the above rules predict:
	i=10000+(5+j)/(1+j); //counts as a single node
	
	i=5; //counts as 17
	while(i>0){
		i = i - 1;
	}
	
	i=5; //counts as 3
	if(i<10)
		j=1;
	
	i=5; //counts as 4
	if(i<10){
		j=1;
	}
	
	i=5; //counts as 3
	if(i>10)
		j=1;
	else
		j=2;


(note that there is a separate limit on the length/complexity of arithmetic expression: they may not contain more than 100 tokens.)

So, from this we see that is probably advantageous to pack as much work into fewer statements as possible when trying to fit within the node limit. This could take the form of refactoring code like:
a=(get_health(target)-get_energy(ME))/2;
if(a<10)
	//do one thing
else if(a<20)
	//do something else
else
	//sit down and cry

into a form more like:
if(((get_health(target)-get_energy(ME))/2)<10)
	//do one thing
else if(((get_health(target)-get_energy(ME))/2)<20)
	//do something else
else
	//sit down and cry

Basically manually inlining computations that are reused, rather than storing them in an intermediate variable. This will make the code execute slower, but, if I'm correct, trick the game into believing that there's less of it.

Also, I wasn't sure if I had ever seen a specific, actual value for the games limit on the number of nodes. In testing, I found that I could execute 32000 'nodes' according to the above criteria before the script was cut off. The code I used was:
beginstate 24;
	x=10666;
	while(x>0){
		x = x - 1;
	}
break;


The variable initialization takes one node, the loop takes 10666*3, the final, failing check of the loop condition takes one, for a total of exactly 32000. Any further added code caused the script to be killed.
0

#20 User is online   Niemand Icon

  • Ineffectual Mayor No. 352
  • PipPipPipPipPip
  • Group: Members
  • Posts: 628
  • Joined: 19-January 07
  • Gender:Male
  • Location:Wisconsin

Posted 16 January 2011 - 11:37 PM

The documentation for item_type_in_slot claims:

Quote

Returns the type of item held by character which_char in slot which_slot. The item type will be from 1 to 499, or -1 if there is no item in that slot.

This neglects a very important possibility: The item may be one which was carried in from another scenario. In this case the item type will be in the range [1000,1159]. Note that there is generally no way to tell what the type the item was in the scenario from which it originated, as items are renumbered based on where they are in party's inventory at the time of switching scenarios.
0

#21 User is offline   Enraged Slith Icon

  • Ineffectual Mayor No. 352
  • PipPipPipPipPip
  • Group: Members
  • Posts: 966
  • Joined: 05-July 07

Posted 17 January 2011 - 06:48 PM

Interesting find. I can't imagine a scenario where this would cause any difficulties, though.
Go here for some super awesome graphics:
Enraged Slith's Graphics
PS: I made them with you in mind
0

#22 User is online   Niemand Icon

  • Ineffectual Mayor No. 352
  • PipPipPipPipPip
  • Group: Members
  • Posts: 628
  • Joined: 19-January 07
  • Gender:Male
  • Location:Wisconsin

Posted 17 January 2011 - 07:06 PM

It makes a world of difference for something else I'm researching at the moment. :p

One reason it might conceivably matter would be if one were working with raw item numbers and wrote a sanity check constraining the item number to be less than 500. However I admit that this doesn't seem like a problem that's very likely to come up.
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Cethin skin by Eric Colon.
logo