Two small things which would improve Arcanum

Discussion in 'Modding and Scripting Support' started by Muro, Sep 26, 2010.

Remove all ads!
Support Terra-Arcanum:

GOG.com

PayPal - The safer, easier way to pay online!
  1. Muro

    Muro Well-Known Member

    Messages:
    4,184
    Likes Received:
    22
    Joined:
    May 22, 2007
    I'm going to talk about two things which theoretically are in the game, but don't work the way they should. Quite sad it is, because their presence would make the game an even better one.

    1.1. IDLE SOUNDS AND ANIMATIONS

    Have you ever heard a dog howl? A kite sing? A demon growl while crossing his talons? Or a mechanical arachnid make clunky sounds while shaking his abdomen?

    Chances are you haven't, even though all of that and more is present in the game. I'm not entirely sure, but it may very well be that every single animal, beast and mechanical creature (plus orcs and ogres) have an idle animation and sound.

    For some reason though, those sounds and animations only show up during your first loaded game in a session. Load a game while you're already playing one and no more idle curiosities for you. Disappointing, isn't it?

    1.2. DYNAMIC CHANGE OF SUNLIGHT

    A feature that works, but not as deftly as it should. Surely you have noticed that it's bright in the middle of the day, semidark in the evening and dark in the night. However, the game remembers to check the time and adjust the sunlight to it only in two situations – directly after waiting/sleeping and a whole in-game hour after you load the game.

    1 in-game hour = 7,5 real life minutes

    This means that if one quickloads his game more often than once per 7,5 minutes, the sunlight in his game will pretty much never change, with the exception of the times when he waits/sleeps. Is 7,5 minutes a lot? If you'd ask me, yes, yes it is. Especially if one plays like myself and likes to examine the whole dialogue tree with each NPC before eventually quickloading and following the most desired route.

    The result? Here's an example: I've just spend a most delightful day in Tarant, talking with the witty inhabitants of the fine city and and whatnot. Yet time passes quickly in such excellent company and wouldn't you know it, it's past seven o'clock in the evening already! The game should tell me in a climatic way that the city is soon going to bed, just like this. However, because of my frequent quicksaves and quickloades, all I get is this. Even the street lights know that it's evening already, but the sun doesn't seem to be that bright (oh, the pun!). Quite boring and anti-climatic, frankly.

    2. THE GODDAMN POINT

    Okay, Muro, but why are you writing about all of this in the modding forum? Ah, an excellent question! Allow me to explain.

    Sadly, I know little about the clockwork of the clock known as Arcanum. I'm no modder, but some of you people out there are and I though I can provide an idea, an inspiration to make the game a better one.

    I thought that perhaps someone will know why idle sounds and animations turn out after the second load and why does it take a whole hour for the proper sunlight to load. Know, or at least have an idea how to check these things.

    Even more importantly, perhaps someone will know how to change these things, making idle animations and sounds present no matter how many times the game is loaded and making the sunlight adjust instantly to the clock. Hell, the street lights do it (they turn on exactly at 6 PM, if I'm not mistaken), why can the sun do so as well. Perhaps someone will know where to start.

    So... Any of you gentlemen feel inspired, by any chance?
     
  2. Charonte

    Charonte Member

    Messages:
    899
    Likes Received:
    0
    Joined:
    Jul 19, 2009
    I'm no modder either, but honestly I doubt you could fix the sunlight issue without hacking the executable (and it probably wouldn't be a small nor easy hack...)

    No idea on the idle sound, though, but you are right in saying it'd make a hell of a lot of difference.
     
  3. Crypton

    Crypton Member

    Messages:
    589
    Likes Received:
    2
    Joined:
    May 22, 2008
    Are you sure that in Arcanum time flows exactly 7.5x faster? Because I've calculated that its more, exactly 8.0x faster. I also checked that there is no floating point arithmetic involved in time calculation, so even if its 7.5, its rounded up, which is 8.

    btw, making a good dynamic weather system is harder than you think, only that dynamic lighting/shadow mapping is hell to implement properly, so thats no surprise that its not working properly.

    However, I'm pretty sure that everything you listed here is fixable, so now you only need to find somebody who will fix it :D
     
  4. Frigo

    Frigo Active Member

    Messages:
    2,107
    Likes Received:
    0
    Joined:
    Jan 21, 2006
    Is sunlight time and game time even related? If not then you might "just" find and hex edit that ~8x multiplier.
     
  5. Charonte

    Charonte Member

    Messages:
    899
    Likes Received:
    0
    Joined:
    Jul 19, 2009
    Not too difficult, I wrote an algorithm for it in an isometric engine some time ago.

    It has to be *very* primitive to maintain any sort of efficiency, though. The main limitation is that most games just dump contents of the map onto the screen without any semblance of layering.

    Best way to do it is to hold a separate layer for objects that you want to cast "shadows" and maintain the current position for the sun at a given time. Then you use a basic form of ray casting from the centre of the 'sun' which throws rays out at a fixed interval; if one of these hits a shadow-casting object, remove it from the object map and cast a shadow. It begins to look around 10^23 times better if you give each object a Z coordinate as well as an x and y - you then use a standard 3D transformation matrix to interpolate Z with X & Y before drawing each to the screen.

    I'll admit it was more engineered to be implemented from scratch in a new engine/game - doing it in something like Arcanum would be near-impossible. It could be modified to fit Arcanum but it'd be very, very basic, very slow and still very difficult to do so. It's not something I'll be attempting.

    Besides, I don't think dynamic lighting is what Muro was asking for. Just having the 'sunlight' adjust properly for the current time would be something.
     
  6. Frigo

    Frigo Active Member

    Messages:
    2,107
    Likes Received:
    0
    Joined:
    Jan 21, 2006
    There are quite a few tricks to implement shadows and directional or point light sources in isometric view, and of course you can use stencil shadows in 3D. Besides, Arcanum's sunlight system looks like a simple ambient light source, not that difficult to implement.
     
  7. Crypton

    Crypton Member

    Messages:
    589
    Likes Received:
    2
    Joined:
    May 22, 2008
    Offtopic: Really? Its not so difficult to understood/implement? Then I must be dumb as lame, because such thing is/was difficult to me to understand/implement. Why I even bother myself by trying to make Arcanum's clone, you guys go ahead and make Arcanum 3 directly :lol:

    (I mean that in good way, no slant in that.)

    btw, Arcanum's lighting is very simple, its using 2d lightmaps for lights, such as this one: http://mdeverdelhan.developpez.com/tuto ... ghtmap.png
     
  8. Charonte

    Charonte Member

    Messages:
    899
    Likes Received:
    0
    Joined:
    Jul 19, 2009
    It's not hard to understand, or hard to implement if you're doing it from scratch (aka your own engine etc). Trying to hack it into Arcanum without the source would be as near to impossible as you're ever likely to get. Like I said, not something I'm ever going to try.

    Lightmaps are a very cheap and easy way of doing lighting, but they do not cast shadows and can't really be used dynamically.

    We were more talking about ambient lighting and having an actual dynamic day/night system that generated shadows.
     
  9. RunAwayScientist

    RunAwayScientist Member

    Messages:
    229
    Likes Received:
    0
    Joined:
    Apr 20, 2003
    No 666 in your picture this time Muro?


    On a more serious note, since the others are touching off on lighting, I'll try tackling the idle anims/sounds issue, which is of interest to me.


    If you recruit the lizard fellow, Warromon, he does play his idle animation quite a bit. I'm not sure if you've noticed this, Muro. Might be something to go check out.


    If one looks through WorldEd.doc, they'll notice under the play animation (num) command there's one for "conceal fidget" and "pickpocket"...like the "magical hands" for Fallout. I believe "conceal fidget" is the anim num for idle anims.

    I guess the main way to apply it to the current Arcanum would to hex edit the .exe and trigger idling to on. If the lizard Worromon creatue already idles, perhaps it's a game exec flag that simply limits the others or some script/code that should be commented out or circumvented.


    Alternatively, one can create a module and create a script attached to the "Heartbeat" slot that plays the "conceal figet" followed by the appropriate idle sound and have that loop or be randomly triggered, then include it in the next UAP or WIP......or....hmmmm....

    Perhaps, if you were to create a modules/Arcanum/scr folder and replace Virgil's heartbeat script to trigger a second script which runs kind of like a shell, which detects nearby NPCs and runs a random check then has them play the sound plus anim...maybe that might work instead of hexxing .exe code....I think I'll go try that out right now.



    I've thought about trying to do something like this, with regards simply to weather. Have you made any progress in that area? I'd like to know anything you've found out, if you wouldn't mind.
     
  10. Crypton

    Crypton Member

    Messages:
    589
    Likes Received:
    2
    Joined:
    May 22, 2008
    Actually I did, I found addresses of all rendering functions, which also includes light and shadow rendering. However, it will be crazy to try modify that weather system via disassembler.

    I could do one thing:

    Modify Arcanum's executable, inject code for loading my own dynamic library (written in c/cpp), (this will probably require creating new pe section, but that's not so hard anyway), then patch rendering function, and redirect all rendering commands to my own rendering function, which will modify that parameters and states and then call back Arcanum's rendering function, or not, it depends...

    (Simply, it will hook all rendering stuff.)

    ...but I'm not going to do that, because it will be wasting of time, since I'm working on new engine :p :lol: :-o
     
  11. Grossenschwamm

    Grossenschwamm Well-Known Member

    Messages:
    7,630
    Likes Received:
    4
    Joined:
    Feb 21, 2006
    I never had a problem with the idle animations. I always hear when the dog howls. Then again I never play more than one game in any given session, so I'll shut up now.
     
  12. RunAwayScientist

    RunAwayScientist Member

    Messages:
    229
    Likes Received:
    0
    Joined:
    Apr 20, 2003
    Hey, Gross, where do you find the Dog at? I personally never was able to locate him.


    Terrible news Muro. My computer exploded into 1,000 different pieces when I attempted to integrate my scripting dynamic. Poor game engine never stood a chance.


    In all seriousness, I fixed up a script with sounds for you. It will do what you're looking for, but I didn't extensively test it and it might not suit your needs (the idles may play too quickly for you, for example.)

    Here's the instructions:


    1. Download from (~2MB): http://duguayster.com/sites/hosting/ras ... erwrap.rar


    2. Extract both folders (scr + sound) to Arcanum\modules\Arcanum\

    3. Start up a game. (It appears to work for loaded games as well as new ones)

    4. Go to the shrine at the crash site

    5. Move your mouse over the shrine and 'examine' it

    6. Wait a bit and you or someone in your party will play an idle anim. Any animals/undead nearby will howl/cluck/moo/growl etc. as well, usually at a higher frequency than biped NPCs. Orcs are counted as animals in game code. Funny that.


    Potential Problems/Annoyances:


    -> The examine command fires multiple times at once. So this may result in multiple instances of script 503Figet.scr being run...which means there's a higher chance of the game crashing or animals/followers/NPCs playing an idle plus sound. I think I accounted for this by canceling out any queued up scripts when you examine the shrine, so that only one script runs, but it's possible the commands won't have an effect.

    -> During testing, the script cut out due to an excessive amount of goto calls. This is done by the engine to prevent infinite loops....but I think I fixed this. If it stops working, just go back to the shrine and examine it again.

    -> You get annoyed at the frequency. In which case, use SockMonkey or Script Ed 1.5.0 (DO NOT USE SCRIPT ED 1.0) to edit the random values on lines 48 (for humans/critters) and line 58 (for animals/undead/creatures)...or I can do it.

    -> It may not be necessary to start a new game...it may be that the shrine simply removes its script somehow after you first look at it and Virgil confronts you. I don't know about the validity of this statement.....didn't test it extensively yet. Looking at the script, it doesn't have any commands to do that....but I dunno...might do it in Virgil's dialog script.

    -> Extra space taken up by unnecessary sound files: The game play sound command won't play sounds from the critters.mes when I was developing this script on a separate mod, so I edited the usr_sounds.mes and also copied the sounds from Arcanum.dat into a sound folder. I didn't try deleting the .wavs and seeing if it still ran. I suppose I'll need to test that.

    -> Orcs not working? During my tests, I don't think the orc played idle anims.

    -> Blinking NPCs/animals: This is a screw-up on my part on detecting the NPC/animal/undead. If it blinks, it means it's playing an animation file that doesn't exist for its art type.

    -> Player Figets Interrupt Movements: Any fidget anims played by the player will stop you whilst you are running/walking. It's not possible to detect when the player is moving, so the only other way to circumvent this (if it annoys you) is to store the Object Type of the Attachee and when it is == to 15 THEN goto line 30....which excludes the PC from playing idles.



    So, give it a test and report back any findings. I'll go do the same sometime later on. I've had enough Arcanum for now.

    Oh, also, here's a funny suggestive pic I took whilst testing, if you're interested: http://duguayster.com/sites/hosting/ras/Arcanum2010-09-2814-08-59-32.jpg
     
  13. Frigo

    Frigo Active Member

    Messages:
    2,107
    Likes Received:
    0
    Joined:
    Jan 21, 2006
    Enter Ashbury and try to locate him very quickly.

    Ah man, I just remembered the first time I got into Ashbury. From Tarant, with train, it was night and the Will'O'Wisps were glowing in their fully glory ^^
     
  14. RunAwayScientist

    RunAwayScientist Member

    Messages:
    229
    Likes Received:
    0
    Joined:
    Apr 20, 2003
  15. Grossenschwamm

    Grossenschwamm Well-Known Member

    Messages:
    7,630
    Likes Received:
    4
    Joined:
    Feb 21, 2006
    As soon as you enter Ashbury, keep running until you get to the Ashbury Hostelry. Around the corner will be a man kicking the mutt.
     
  16. Viktor_Berg

    Viktor_Berg New Member

    Messages:
    319
    Likes Received:
    0
    Joined:
    Dec 23, 2006
    7.5x8 = 60

    He said every 7.5 minutes, which makes it 8x, so nothing wrong here.
     
  17. Crypton

    Crypton Member

    Messages:
    589
    Likes Received:
    2
    Joined:
    May 22, 2008
    Ah, really, my bad, I did not read that post carefully :roll:


    To RunAwayScientist: Many thanks for your mod. :thumbup:
     
  18. Muro

    Muro Well-Known Member

    Messages:
    4,184
    Likes Received:
    22
    Joined:
    May 22, 2007
    In a way, indeed. There is a different sunlight state for each period between full hours. For some reason a whole one in-game hour must pass before the correct sunlight state pops in, though.

    Perhaps "Dynamic change of sunlight" could be considered an unfortunate choice of words on my part. Naturally, having sunlight dynamically affecting shadows would be simply wonderful, but here I had something simpler in mind, namely the instant adjust of the sunlight state to the time.

    Shame on me, I knew I forgot something crucial.

    From my experience, Waromon acted just like any other creature possessing idle animations and sounds, namely showing them off until the second load in a session.

    I say, seeing how resourceful Ran Away Scientists are, I think we should make it our life goal to free as much as possible from the place they are being held.

    You wouldn't believe how carelessly overjoyed I was to just stand in the middle or Shrouded Hills and hear the chickens cluck and see them peck some seeds from the ground.

    Some initial reports:

    Didn't have that problem.

    Ditto.

    Doesn't seem to be necessary.

    Witnessing Void lizards and arrayas yawn and whistle while blinking was quite entertaining in a way, though.
    I didn't do much testing just yet, so all that I have seen blinking so far were the two types of creatures as mentioned above and Bedokaans (even though they have a working idle animation+sound at the same time).

    Perhaps turning it off for the PC would be a good idea. A PC with idle sounds and animations is enjoyable, but seeing how he has the urge to stop in the middle of a run in order to yawn or whistle would become tiresome quick quickly, especially if one tends to use maps and waypoints to travel across a location, seeing how playing an idle animation makes the PC forget about the remaining path.

    Other things that have been noticed so far:
    • Conversation ends when the player chooses a dialogue line while the NPC with which he speaks plays an idle animation. Seeing how conversations ending abruptly can lead to the inability of recreating the dialogue and sometimes an NPC may start its animation just after your hand begins to click the mouse and just before you notice what's going on and stop, this has the potential of becoming quite an annoyance.

      The two above points made me come to a conclusion that perhaps idle animations should only be left for the non-sentient (therefore not capable of conversation) beings, meaning animals, beasts (without Bedokaan, orcs and ogres), mechanical creatures and undead (I'm not sure about skeletons, though. It would be a shame to disable their idle animation & sound, but than again both the conversations of Torian Kel and Stringy Pete would be endangered otherwise).
    • I've seen enemies run to attack me, stop to make their idle animation and continue to run after me. The funnier the more out of place the animation is. Rather entertaining than game-breaking.
     
  19. RunAwayScientist

    RunAwayScientist Member

    Messages:
    229
    Likes Received:
    0
    Joined:
    Apr 20, 2003
    There is a condition statement/check that will prevent NPCs that you are in conversation with from playing an idle sound. I specifically took it out because I thought it would add to immersion, having them move around whilst talking. But that's quite unfortunate it causes diags to cancel.

    Sure, I'll go ahead and add in the PC check to prevent the PC from playing idles.


    As for the void creatures....hmmm....I'll have to look into that one.
     
  20. Muro

    Muro Well-Known Member

    Messages:
    4,184
    Likes Received:
    22
    Joined:
    May 22, 2007
    I noticed that waiting/sleeping for a longer time and fast travel using the world map causes the game to play a slight cacophony of idle sounds of followers. Annoying (especially during fast travel, when the passage of time is fastest and the idle sounds interrupt the otherwise climatic main theme), but I guess there isn't much that can be done about it if we want those sounds to be there in the first place.

    That changes everything. If that's the case, I change my suggestion to leaving all idle animations+sounds and turning off idle animations+sounds during dialogues.

    That
    and turning off idle animations+sounds for the PC
    and turning off the incorrect idle animations&sounds causing some creatures to blink and yawn/whistle
    and turning on orc idle sounds
    and your mod will be pretty much flawless, if I'm not mistaken.
     
Our Host!