GrangerHub / tremulous

Other
81 stars 18 forks source link

tremulous: bucket system #107

Closed dGr8LookinSparky closed 4 years ago

dGr8LookinSparky commented 4 years ago
cengique commented 4 years ago

@dGr8LookinSparky how do you enable this? I couldn't get it to change the menu song.

dGr8LookinSparky commented 4 years ago

As a side note, I'm cleaning up the bucket selection code a bit, and will have this pushed to this branch shortly.

@cengique , it should happen automatically, everytime you start the client, it should play different music (randomly selected), until all of the music has been selected. Basically when you turn on the client it will select one of the main menu music files, then when you turn off the client and start the client again, another music file would be randomly selected. Also the main menu music would change when you disconnect from a server and get back to the main menu.

cengique commented 4 years ago

@dGr8LookinSparky it definitely doesn't change the song for me, no matter how many times I restart.

dGr8LookinSparky commented 4 years ago

that is odd, do you see a cvar in the console called ui_mainMenuSelectedMusic, if so, what value is it set to?

cengique commented 4 years ago

@dGr8LookinSparky it's not set. I tried setting it to "1", but didn't change.

dGr8LookinSparky commented 4 years ago

it isn't meant to be set by the user, that is suppose to track which songs have been previously played.

cengique commented 4 years ago

I see. It still stays empty.

dGr8LookinSparky commented 4 years ago

check to see if there are music files in sound/ui/main_menu_music/ in the data pk3 file for this build version, should be in the gpp folder of the build.

cengique commented 4 years ago
        0  01-11-2020 19:52   sound/ui/
        0  01-11-2020 19:52   sound/ui/main_menu_music/
  2092749  01-11-2020 19:52   sound/ui/main_menu_music/Black_mistUntitled_3.ogg
  1414387  01-11-2020 19:52   sound/ui/main_menu_music/Granger_Foley_v1.ogg
  1187910  01-11-2020 19:52   sound/ui/main_menu_music/heartbeat.wav
   462735  01-11-2020 19:52   sound/ui/main_menu_music/tremfusion_heartbeat.ogg
  3045248  01-11-2020 19:52   sound/ui/main_menu_music/Finally_Heartbeat.ogg
dGr8LookinSparky commented 4 years ago

Looks like you definitely have the files. were there any error messages in the console?

cengique commented 4 years ago

hmm, not really.

dGr8LookinSparky commented 4 years ago

maybe try to see if connecting to a server, and then using the command /disconnect would change the music.

dGr8LookinSparky commented 4 years ago

@cengique , is it playing any music at the main menu? if so, is it just the old default music, or another one?

dGr8LookinSparky commented 4 years ago

@cengique , I'm not sure if this would help the issue you are experiencing, but I just updated this branch with a new commit (was mainly for cleaning up the bucket selection code).

cengique commented 4 years ago

@dGr8LookinSparky I pulled the new commit, but no change. It's playing the old theme song.

cengique commented 4 years ago

Music doesn't change when I connect to a server and /disconnect either.

dGr8LookinSparky commented 4 years ago

@cengique , which OS and distro are you currently testing on?

dGr8LookinSparky commented 4 years ago

@cengique , perhaps start tremulous with gdb, and set a break point at ui_shared.c:1840 which is located here: https://github.com/GrangerHub/tremulous/blob/911c0987cb5c43b8129e6ab710d469856fd704da/src/ui/ui_shared.c#L1840

You can then step through from there and see if it is working.

dGr8LookinSparky commented 4 years ago

@cengique , I just thought of a possible cause of your issue, make sure that vorbis is not disabled. The original default main menu music file is in .wav format, but all of the other files I've included in .ogg. Maybe if vorbis is disabled, the file search would not include the .ogg files.

cengique commented 4 years ago

@dGr8LookinSparky I realized it may be using my older builds, so I deleted the build directory completely. This time, I'm getting an stuck at a black screen. It gives an error during initialization and it loops forever:

GL_VENDOR: X.Org
GL_RENDERER: AMD CYPRESS (DRM 2.50.0 / 4.14.10-gentoo-r1, LLVM 3.9.1)
GL_VERSION: 4.1 (Core Profile) Mesa 17.3.1
GL_EXTENSIONS: Not available (core context, fixme)
GL_MAX_TEXTURE_SIZE: 16384
GL_MAX_TEXTURE_UNITS_ARB: 0

PIXELFORMAT: color(24-bits) Z(24-bit) stencil(8-bits)
MODE: 8, 1918 x 1078 windowed hz:N/A
GAMMA: hardware w/ 1 overbright bits
texturemode: GL_LINEAR_MIPMAP_LINEAR
picmip: 0
texture bits: 0
compiled vertex arrays: disabled
texenv add: disabled
compressed textures: disabled
----- finished R_Init -----
Loading vm file vm/ui.qvm...
File "vm/ui.qvm" found at "./gpp"
...which has vmMagic VM_MAGIC_VER2
Loading 801 jump table targets
VM file ui compiled to 765040 bytes of code
ui loaded in 4922912 bytes on the hunk
Loaded 64 of 97 emoticons (MAX_EMOTICONS is 64)
UI menu file 'ui/menus.txt' loaded in 182 msec
UI menu file 'ui/ingame.txt' loaded in 9 msec
UI menu file 'ui/tremulous.txt' loaded in 8 msec
UI help file 'ui/help.txt' loaded in 0 msec (16 infopanes)
File "ui/" found in "./gpp/data-v1.3.0-alpha.0.13-9-g911c0987.pk3"
********************
ERROR: Q_strncpyz: NULL src
********************
forcefully unloading ui vm
RE_Shutdown( 0 )
------- FBO_Shutdown -------
------- R_ShutdownVaos -------
------- GLSL_ShutdownGPUShaders -------
Hunk_Clear: reset the hunk ok
----- R_Init -----
------- FBO_Init -------
------- GLSL_InitGPUShaders -------
loaded 80 GLSL shaders (32 gen 28 light 20 etc) in  0.02 seconds
------- R_InitVaos -------
Initializing Shaders
dGr8LookinSparky commented 4 years ago

@cengique , yeah, not deleting your build folder before building does often cause issues. With this setup, after you delete the build folder, and then rebuild, you have to redownload the default pk3 files, which you can do by executing from the root of the repo the script ./misc/download-paks.sh (or you could keep a copy of those default pk3 files separate from the build folders, and copy them back into the appropriate spots in the build folder after each time you rebuild). This is inconvenient in this setup to do for development purposes, at some point I need to get a better way working.

Regarding using tremulous in gdb (if the not deleting your build directory was causing this issue, you may not have to use gdb for this particular case, I don't know how familiar you are with using gdb outside of trem, but gdb is a very useful tool that can come in handy for you in the future, and I recommend getting at least some familiarity with it for trem development), first you have to ensure that when you build, instead of using just make, you use make debug, that generates the debug symbols that gdb would need. Then when you run tremulous in gdb, you have to ensure that on startup vm_cgame, vm_ui, and vm_game are all set to 0, and sv_pure is set to 0 (if you are connecting another client to a server started by your local client, this is not good settings to use, as you would usually need to set sv_pure to 1, but if you are only testing your current build without other clients connected, then sv_pure 0 should be fine, but make sure that your gpp folder in your tremulous homepath is cleared out of any additional pk3 files, you can find your tremulous homepath by checking the cvar fs_homepath). To execute those settings while starting tremulous in gdb, execute the following:

gdb -ex run --args tremulous +set vm_game 0 +set vm_cgame 0 +set vm_ui 0 +set sv_pure 1

If you aren't familiar with using gdb, it is generally pretty straight forward to find information on its usage on the interwebs. In particular, the most commonly used commands to know are: print, bt, break, info b, del, watchpoint, continue, step, next, 'run', 'quit'.

If you are running tremulous in gdb, the way to temporarily exit tremulous so that you can entire gdb commands is with ctrl+c, and then after you have executed the gdb commands you wanted to execute and wanted to continue running tremulous where you left off, you would execute the gdb command continue. You can lookup information on the other gdb commands I listed above.

cengique commented 4 years ago

@cengique , yeah, not deleting your build folder before building does often cause issues. With this setup, after you delete the build folder, and then rebuild, you have to redownload the default pk3 files, which you can do by executing from the root of the repo the script ./misc/download-paks.sh (or you could keep a copy of those default pk3 files separate from the build folders, and copy them back into the appropriate spots in the build folder after each time you rebuild). This is inconvenient in this setup to do for development purposes, at some point I need to get a better way working.

@dGr8LookinSparky oh I forgot about this step! I will try tomorrow.

Regarding using tremulous in gdb (if the not deleting your build directory was causing this issue, you may not have to use gdb for this particular case, I don't know how familiar you are with using gdb outside of trem, but gdb is a very useful tool that can come in handy for you in the future, and I recommend getting at least some familiarity with it for trem development),

I've used gdb before! And you answered my questions because I was wondering about the lack of debugging symbols and command line setup. But there's a ERROR: Q_strncpyz: NULL src error in my logs - if it's not due to the missing assets, it may not be hard to find. I'll try gdb still to pinpoint the line numbers.

cengique commented 4 years ago

@dGr8LookinSparky ok, I don't know what changed, but after I built the debug version and ran it in gdb, it actually ran without crashing. Now, even the regular build runs. It may have something to do with setting the command line arguments correctly. But one issue remains: whenever it's heartbeat.wavs turn, it's filled with static noises. I tracked it down to the actual file that was committed under the assets folder: assets/sound/ui/main_menu_music/heartbeat.wav. You may need to replace it.

dGr8LookinSparky commented 4 years ago

Hmm, @cengique how does that particular heatbeat.wav file sound outside of trem when you play it in a separate media player like vlc (or whichever media player you prefer)?

dGr8LookinSparky commented 4 years ago

Oh jeeze, @cengique , I just downloaded that file from the branch, and played it in vlc, and I do hear the static, I'm not sure why that is, I'll look into recommitting a good version.

cengique commented 4 years ago

I like the music options, by the way! Except the very quiet one.

I'll keep an eye out for the Q_strncpyz error and check it with gdb. I could not see any obvious candidates in the code you committed. Did you get this bucket system from the Quake repo?

dGr8LookinSparky commented 4 years ago

I coded it from scratch. I did implement this bucket system more generally in the ui (not just for the main menu music), it could potentially be used by any menu that wants to have multiple music files chosen in this way to be played in the background. Also more general than that, this bucket selection system could be used by anything that wants that kind of selection, like potentially for the map rotation system for example (like if you want a set maps chosen for a particular range of number of players, but want the maps randomly selected, while not playing more than one of them twice before all of the others are selected) .

cengique commented 4 years ago

That's cool! Although there could be memory bugs lurking with untested code, which would explain the error.

I keep getting dropped from Der Bunker and I think it's related to this crash.

dGr8LookinSparky commented 4 years ago

There could potentially be a memory leak, as I made use of dynamic array lists. Although I don't think this system would cause you to be dropped from that server, as this system is currently only being used in the ui, the ui has an internal allocator system, when the ui shuts down that allocator is cleared, and that server would use a different server. Did you see if you are dropped from other servers like GrangerPub, GrangerLab, Unitremia, that zombie mod server, etc? I do have this bucket system in the engine code (which would include the client), but it is currently unused there (except I do have a part of the code that is suppose to free the memory used by buckets on shutdown).

cengique commented 4 years ago

You're probably right, I was thinking that it cannot be the reason for me to drop. I got the "connection lost" message, but everyone else was fine. It may also be some other part of the client crashing. Will try to use a debug version if this happens again.

dGr8LookinSparky commented 4 years ago

@cengique , I removed the heartbeat.wav file and then readded it and recommitted it with a fresh copy from the 1.1 data pk3 (which sounds fine without any static when I played that directly from that copy), but when I pushed to github, and downloaded that copy, it still has the static for some reason. Then I downloaded the other music files I included, and they all are corrupted in some way. Black_mistUntitled_3.ogg and tremfusion_heartbeat.ogg have numerous skips in them, Finally_Heartbeat.ogg and Granger_Foley_v1.ogg have problems with even playing at all. This is when I tried playing those files on vlc. I don't know why this is happening, nor how to fix it currently.

dGr8LookinSparky commented 4 years ago

I posted this on the github community forums:

https://github.community/t5/How-to-use-Git-and-GitHub/Sound-files-pushed-are-corrupted-on-my-repo-on-github/m-p/43881#M10120

cengique commented 4 years ago

@dGr8LookinSparky this may have to do with what type of file git thinks it is. You may need to add .ogg file extension into a config file. It may treat it as a text file and change line endings or something.

cengique commented 4 years ago

This is the culprit @dGr8LookinSparky : https://github.com/GrangerHub/tremulous/blob/buckets/.gitattributes

All files in the repo are treated as text and line-endings are converted to lf.

dGr8LookinSparky commented 4 years ago

Nice find @cengique ! I may have time on Sunday to fix that up, then if all goes well, hopefully we can merge this shortly :) .

dGr8LookinSparky commented 4 years ago

@cengique , I merged the recent updates from the master branch into this branch, which includes an adjustment to the .gitattributes file, and it looks like that did the trick for not distorting the main menu music files! When you get a chance, feel free to test out this branch and confirm that the music works as it is suppose to. Then, unless you find any other issues, I think this pull request should be ready for merging into master.

cengique commented 4 years ago

All good now!