home home

downloads files

forum forum

docs docs

wiki wiki

faq faq

Cube & Cube 2 FORUM


Two Sauerbraten "Issues"

by Titanic12ship on 08/11/2010 04:56, 13 messages, last message: 10/08/2010 01:28, 3757 views, last view: 05/03/2024 03:13

Hello,

I have been doing a lot of editing and scripting in Sauerbraten using the new Justice edition, and it's been going very well so far. However, there are a couple of problems/issues that I have been running into. These aren't bugs with the game, but rather just little things that don't have to be dealt with, but it would be nice if they were since they're preventing me from editing and scripting certain things in Sauerbraten. Here are the two problems:

One: The first problem is very weird. When I was editing a map I decided to make an underwater room. So I made the body of water that the room would be located in, and then I made the room itself in the body of water, under the surface. Once that was done, I decided to make some windows in the room that look out into the body of water, so I made them. This is where the problem happens. After I made the windows and I looked out of them into the water, there was no water there, just air. However, that's only how it looked from inside the room, because when I left the room the water was there. Then when I went back into the room and looked out the window the same thing happened: Instead of seeing underwater through the window, I just saw air. It's very weird. I tried a lot of different things, but no matter what, the problem always happens. I don't know if it's just my computer, or if it's Sauerbraten that's making it happen. Either way, I just can't get if fixed, and it really is starting to annoy me, since it doesn't look real at all when you look out of a window in an underwater room and see air instead of water through the window. Is there anything that can be done to fix this? Is it my computer, or is it Sauerbraten that's doing this? More information would be a big help.


Two: The second problem in Sauerbraten is even worse. It has to do with scripting and aliases/variables and their values. To explain the issue, I'm going to describe a basic example/scenario where it occurs:

Let's say that in a map's config we have 3 aliases:

1. "a"
2. "b"
3. "c"

Aliases "a" and "b" each hold a value that changes a lot, for example whenever the player pushes a certain button or clicks a certain item in a gui/menu. Their values are constantly being updated by the player throughout the course of the map.

Alias "c" is defined as this: "alias c (- $b $a)"
This just gets the difference between the two aliases "a" and "b" (by subtracting)
Remember that aliases "a" and "b" change a lot throughout the course of the map, so I'd expect that alias "c" would always be updating to reflect the new values of "a" and "b". In other words, I'd expect that alias "c" would constantly be getting the difference between "a" and "b" as they change, using their latest values. It might sound kind of complicated, but it's not.

However, when I went to test this exact system for real in Sauerbraten, for some very weird reason, it didn't work at all. The alias "c" wasn't updating to reflect the new values of "a" and "b" as their values updated and changed whenever the player changed them. That is the problem. Alias "c" just won't update to reflect the new values of the other two aliases. Instead, it just gets stuck with using the very first values of each of them, and whenever they get new values, it completely ignores them and sticks with using the first values. How could something this simple not work? I just don't get it. I have no idea what's causing this to happen, or how I can fix it.

Unfortunately, I don't have the exact config anymore, because I got so mad because it wasn't working and I couldn't fix it, so mad that I deleted the config!

Does anyone know why this is happening, and what I can do to fix it? I really want to get this working, since I have something very creative I could implement it into.

Again, I don't know if these problems are my computer's fault, or if they're Sauerbraten's fault and everyone experiences them in the game.


Thanks,
Titanic12ship

   Board Index   

#1: ..

by SheeEttin on 08/11/2010 09:00

One: occlusion/culling error. Could be due to graphics drivers, and it may not happen on other systems. (Me, I get horrible screwups for materials in editmode. Just my graphics driver.)

Two: Of course it doesn't do what you expect! Once you assign a value to C, it's not going to change until you assign something else to it.
If this is a GUI, eliminate C entirely and just use "(- A B)".
If it's part of the map, e.g. controlling the state of a door, evaluate "(- A B)" when you change A or B. If it returns the appropriate value, call the trigger.

reply to this message

#2: ..

by Razgriz on 08/11/2010 10:43

i'm not sure whether "alias" as a command reacts as dynamically as = would. but anyway.

as SheeEttin said, if C is in a gui, do C = (- $A $B) and place it inside the gui so its spammed and updates the value each time, or use (- $A $B) directly where it's needed

as for the material problem, its well known that water is not "shown" correctly when behind glass. i doubt you'll find a way around this, maybe transparent geometry can fix this, try what you can.

reply to this message

#3: ..

by Nixot on 08/11/2010 13:25

Answer to problem 1: You probably put glass in the windows, neighboured immediately by water, amirite? In this case, there will be no waterfall-style effect, since there's not air next to the water, but glass. It's perfectly normal so far.
However, when you're in water, your whole screen is tinted blue as can be seen if you're on the surface and can see half above the water and half under. So, certain blocks of water don't actually blend what's inside it.
Secondly are the caustics. They are completely invisible when you're out of water and cover everything when you're in water. This is a bug with the engine.
So to conclude, when you're in the room and look out, there's no sign of water as there's no blending and no caustics. To solve this, you'll have to use some sort of horrible workaround (stick blue lights in the watery area, make a gap of air between the water and glass so there's a waterfall effect, etc.). Sorry.

Solution to problem 2 is as above. You don't need to use $c, just use (- $b $a).

reply to this message

#4: Thanks For Helping & I Have Another Question

by Titanic12ship on 08/11/2010 21:44

Ok, thanks for your help everyone. That's a shame about the first problem, but thanks for explaining it to me. As I said before, I have already tried a lot of different things to see if I could get it to work properly, but it just won't. Maybe it could be fixed in the next version of Sauerbraten, since a lot of other people experience it too.

As for the second problem, I took the advice and replaced "$c" with "(- $b $a)" wherever it was needed in the code, and it worked! Thanks for explaining it to me everyone. I guess that's just how it has to be in order for it to work right.

I forgot to include this in my first post, but I actually had another question/problem in Sauerbraten and I forgot to include it. This problem is also very strange, and I can't seem to find a way to fix it. Here it is:

When I was trying to create an elevator system with a platform that moved when buttons were pushed and doors at each floor, something weird happened. I was almost done the elevator system so I decided to test it. The platform was fully programed, and all the doors and buttons had been placed and set up. I also double-checked the code to make sure there were no errors, and there weren't any. All that was left was to just do a few little tweaks, an then it would be completely finished. So then I started to test it I called the elevator at one of the floors, got onto the platform, and waited a little while before I selected a floor. This was so that I could make sure the door closed properly. However, it didn't close. I waited a long time, and still, it didn't close. My first thought was that it wasn't closing because maybe I was standing too close to the door, so I left the elevator, went a good distance away from it, and waited, but it still wouldn't close. I checked the config to make sure it was programmed to close, and it was, so what was going on? Then I got back into the elevator, selected a floor, which made the elevator start moving, and as soon as the platform got at a certain distance away from the open door, it closed. I was very confused. It was like the door couldn't close when the platform was near it, and as soon as the platform was at a certain distance away from it, it was able to close with no problem. What was weird, though, was it opened without any problem when the platform was near it, but it simply wouldn't close. I tried to see if it would work on any of the other floors, but it didn't, which means that it was happening on all of the floors, not just the first one I tried it on. I don't know why this was happening. Is it an error in my scripting, or is it something that always happens in Sauerbraten, no matter how you script it? Either way, is there a way that I can fix it, because no matter what I do, I can't fix it, and it's starting to get very annoying now. Any information would be appreciated.


Thanks again for your help.


-Titanic12ship

reply to this message

#5: Re: Thanks For Helping & I Have Another Question

by Razgriz on 08/11/2010 23:40, refers to #4

we cannot help you fix something we cannot see :P

reply to this message

#6: Re: Thanks For Helping & I Have Another Question

by LeftClicker on 08/12/2010 02:48, refers to #4

Did you maybe program the door for distance from the elevator and not the player? Also, your posts are particularly long, which is somewhat annoying. People don't like to read a lot, so you may want to include a tl;dr.

reply to this message

#7: ..

by Titanic12ship on 08/12/2010 03:33

@ Razgriz: Do you need to see the config that contains the code for the elevator? Is that what you're talking about? I'm not sure what you mean.

@ LeftClicker: I didn't program the door to close using distance at all. I just programmed it to close when the player pushes a button to start the elevator, but when I tried this, it waited until the platform was a certain distance away from the door for it to close. I just don't get why it's doing this, but I really don't think it's the programming of the elevator that's making it happen.

Also, I know that the long posts are annoying, but I'm trying to include as much information as possible about the things I'm talking about, like in this case, the door problem. I guess I could include a little "summary" version of whatever I'm posting about, at the bottom of my post that gets right to the point without any details, like you said. That way people won't have to read the whole thing if they didn't want to. Or I could just shorten my posts a little. That would work, too, since people wouldn't need to read as much.

reply to this message

#8: Re: ..

by LeftClicker on 08/12/2010 06:40, refers to #7

The details are important, but a clear, concise summary is as well. Maybe first post a quick description of the problem, then the code? Actually, maybe you should post the code, unless it is an exceptionally complex script.

reply to this message

#9: Config

by Titanic12ship on 08/15/2010 20:31

Here is the config for the map that contains the elevator. Note that this is only the part of the config that deals with the elevator; the rest I didn't include here. Notice how I don't mention any doors opening/closing in the config at all. This is because I changed the doors to auto-close (10) for now to see if that would help. Of course, it didn't help, though, since they still won't close when the platform is nearby! I didn't bother to make the doors locked (11) again and put back all of the code that opens and closes them in the config again. The script isn't too long, but it is very annoying to have to define each level trigger in the config. The same with the guibuttons in the menu. Feel free to make any suggestions if you see a way to improve it, and also please tell me how to fix the door problem.



THE CONFIG:


alias a 2 //Destination Floor
alias b 1 //Current Floor


up = [if (> (- $a $b) 0) [echo "Positive!! Going Up!"; platform 1 1; sleep (* (- $a $b) 5000) [platform 1 0; echo "Arrived!"; alias b $a]]]

down = [if (< (- $a $b) 0) [echo "Negative. Going Down!"; platform 1 -1; sleep (* (* (- $a $b) 5000) -1) [platform 1 0; echo "Arrived!"; alias b $a]]]

go = [up; down] //Execute both "Up" and "Down" and the one that is true will do what it needs to; the other one won't do anything

//Elevator Control Menu-Not to Be Used For Calling The Elevator!

newgui econtrol [
guitext "Choose A Floor"
guibutton "Floor 1" [echo "Starting Elevator"; alias a 1; go]
guibutton "Floor 2" [echo "Starting Elevator"; alias a 2; go]
guibutton "Floor 3" [echo "Starting Elevator"; alias a 3; go]
guibutton "Floor 4" [echo "Starting Elevator"; alias a 4; go]
guibutton "Floor 5" [echo "Starting Elevator"; alias a 5; go]
guibutton "Floor 6" [echo "Starting Elevator"; alias a 6; go]
guibutton "Floor 7" [echo "Starting Elevator"; alias a 7; go]
guibutton "Floor 8" [echo "Starting Elevator"; alias a 8; go]
]

//Elevator Call Buttons-One on each floor

level_trigger_10 = [echo "Calling Elevator."; alias a 1; go]
level_trigger_11 = [echo "Calling Elevator."; alias a 2; go]
level_trigger_12 = [echo "Calling Elevator."; alias a 3; go]
level_trigger_13 = [echo "Calling Elevator."; alias a 4; go]
level_trigger_14 = [echo "Calling Elevator."; alias a 5; go]
level_trigger_15 = [echo "Calling Elevator."; alias a 6; go]
level_trigger_16 = [echo "Calling Elevator."; alias a 7; go]
level_trigger_17 = [echo "Calling Elevator."; alias a 8; go]

reply to this message

#11: Re: Config

by LeftClickersPhone on 08/23/2010 01:53, refers to #9

Hmm. I'm no CubeScript expert, but that code looks sound -- for what it does. Where is the part that closes the door?

reply to this message

#12: Re: Config

by Titanic12ship on 09/10/2010 21:21, refers to #11

Thanks for your response. As for the part of the config that deals with the doors, I had said in a previous post that I took out the code for the doors and made them auto-close to see if that would help, but it didn't, though, because they still wouldn't close when the platform was near them. They would only close when the platform wasn't nearby. I still can't figure it out. I just don't understand why that's happening.

reply to this message

#13: Still Not Fixed

by Titanic12ship on 10/08/2010 01:21

Does anyone know why this is happening? I still can't seem to fix it.

reply to this message

#14: ..

by SirAlex on 10/08/2010 01:28

alias c [- $a $b]

reply to this message

   Board Index   


Unvalidated accounts can only reply to the 'Permanent Threads' section!


content by Aardappel & eihrul © 2001-2024
website by SleepwalkR © 2001-2024
53870139 visitors requested 71645341 pages
page created in 0.012 seconds using 10 queries
hosted by Boost Digital