Thanks for this. I have an idea what is going on and will upload a new file later when I get back from the office. Real test will be firing up the original PC release in Dosbox and seeing how they compare.
Watching the demos play out in MESS vs the real thing in Dosbox, it is hard to tell much of a difference in timing. The real thing seems to have much smoother motion, and I don't know if the N64's DPAD has anything to do with how weird the timing seems when moving? I wish I could play it on my N64 to test. If I ever get enough extra money for a flash cart I will do more to try and remedy that concern. In the meantime, I changed how my port computes the time count internally, using a different libdragon function. I am hoping it makes a difference for the better. Will post a new ROM in a bit.
Here is a new V64 file -- note that in order to not blow through my attachment file size quota, I have removed the older builds that I posted. I modified get_TimeCount to use libdragon's "get_ticks_ms()" call, converting milliseconds to Wolf3D tics (which are 1/70th of a second according to the source port I based my port off of -- it was a *NIX Wolf3D port that used be found on icculus.org, by Tim Sneddon, I believe?). I have a feeling it won't make much of a difference to the overly fast gameplay, but try it out and let me know how it is. I can code in a player-modifiable time-scaling factor if need be. (see newest post for download)
I have three immediate goals for improving the port. The first task is coming up with a good controller mapping, and figuring out how to interface with the Wolf3D menus to allow re-mapping through the game itself, instead of requiring the user to recompile the code. Speaking of this, if there are any recommendations for a decent default control mapping, please post them in this thread. Second up would be getting save games working, either by controller pak or cartridge saving. I don't really know how to do either of those yet but the documentation for libdragon has been pretty helpful so I'm sure I will figure it out. Finally, getting sound working. I have been trying my hand at some small demo programs to output digital audio. I will make it happen. Fingers crossed.
I was able to code up a simple tone generator, putting out a sine wave with controller-adjustable frequency. I am getting a hang of doing audio with libdragon and the N64 now, so it is just a matter of debugging the Wolf3D code to get rid of the bad pointer accesses, and hopefully it will just work. Sorry about the formatting, I can't figure out how to use this forum software I guess. -- begin AudioTest.c -- #include <stdio.h> #include <malloc.h> #include <math.h> #include <libdragon.h> short nextSinSample(double sampleFrequency, double waveFrequency, double timeIndex) { return (short)( 32767.0 * sin( ( ( 2.0 * M_PI ) * waveFrequency * timeIndex ) / sampleFrequency ) ); } int main(void) { init_interrupts(); controller_init(); console_init(); audio_init(44100, 4); double sampleFreq = audio_get_frequency() * 1.0; double waveFreq = 100.0; double timeIndex = 0.0; int buffer_len = audio_get_buffer_length(); short *audio_buffer = (short*)malloc(buffer_len*sizeof(short)*2); while(1) { controller_scan(); struct controller_data keys_pressed = get_keys_down(); struct controller_data keys_held = get_keys_held(); struct SI_condat pressed = keys_pressed.c[0]; struct SI_condat held = keys_held.c[0]; if(pressed.up) { waveFreq += 20.0; } if(pressed.down) { waveFreq -= 20.0; if(waveFreq < 0.0) { waveFreq = 0.0; } } if(pressed.A) { waveFreq = 0.0; } if(pressed.B) { waveFreq = 22050.0; } if(held.right) { waveFreq += 100.0; } if(held.left) { waveFreq -= 100.0; if(waveFreq < 0.0) { waveFreq = 0.0; } } printf("Current frequency: %f Hz\n", waveFreq); if(audio_can_write()) { for(int i=0;i<buffer_len;i++) { short nextVal = nextSinSample(sampleFreq, waveFreq, timeIndex); timeIndex += 1.0; audio_buffer[(i*2) + 0] = nextVal; audio_buffer[(i*2) + 1] = nextVal; } audio_write(audio_buffer); } } return 0; } -- end AudioTest.c --
I coded a "blue-screen-of-death" (well, red in this case) style exception handler so hopefully I can start figuring out where things are going wrong without instrumenting every line of code in the entire program with a printf.
I just wanted to say this is a cool project and I hope you go far with it. New N64 homebrew is definitely a good thing. And Wolf3D is legendary. I was impressed when I found there was a Wolf3D port for PSP.
Nope, same problem. I have the last working build (with the printing and palette removed) if it's needed.
Always clean your build directories! This prevents two scenarios: old things from randomly getting linked in that serve no purpose, and old things with links that are now invalid because memory addresses shuffled around getting compiled in because they "didn't change". If you poke at the binary (debugger or otherwise) it should be apparent what's going on, and my money's on #2. Then never forget the three most important rules: check your code, check your code again, then check your code again again!
When I said I do a build, I mean that I am doing "make clean; make" each time. I run into enough build problems in my day job that I always clean my working copy before building anything (usually its Java builds using Maven... always, ALWAYS doing "mvn clean" before anything). I probably changed some code at 3 AM and forgot what I changed the next day. This is very likely. I only get to work on this stuff after spending 8 to 10 hours staring at code at the office, then another hour or two driving home. Besides that, I can only run out these builds in MESS, and I only post them when I see them running and playable in it, so I am unsure what is going on, short of, it could potentially be the exception handler code I tried to add, or half-implemented sound code, or who knows. I stripped a bunch of stuff out and rebuilt and played through a few levels, so I am going to post that. If this still doesn't work, I will have to start over by doing a diff against the wolf3d-20011028 sources I started with.
tried it on my 64drive, here are my thoughts: - if you press the dpad franticly in all directions and walk into walls and so on the game freezes - movement speed should be half of what it is now - picture is perfect but no sound Suggested controls: - analog stick up/down to move forward/back, the more you push the stick the faster you go. this would resolve the movement speed issue - analog stick left/right to turn left/right - C-Left to strafe left, C-Right to strafe right - B button to open doors - Start to go back to the menu - A button to select things like levels and menu options - Z button to shoot
It has been a while, was busy wrapping things up before taking a holiday mini-vacation. I just started doing some more work on the port tonight. Started coding up a control-mapping screen that can be accessed in game. Still trying to debug sound as well. Hope to post new updated binaries and source soon.
Some new screen grabs, showing off the addition of a "Map Controller" menu. The actual mapping screen is unfinished so there are no text labels yet, but you can get a feel for how it is going to work when it is done.
You use the d-pad to change which control is selected/high-lighted, then follow on-screen directions for re-mapping that control. It seems to finally work. Analog stick is currently not supported. Trying to figure out how to use that to do fine-grained movement within the restrictions of the Wolf3D engine code. Uploading shortly. The following PC keys: "none", "Up", "Right", "Down", "Left", "Escape", "Enter", "Space", "Control", "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z", "0","1","2","3","4","5","6","7","8","9" can be mapped to the 14 buttons/directionals available on the N64 controller. I can add Function keys later if it is felt they are necessary.
See first post in thread for newest V64 file upload. Also duplicating it here just in case. [HR][/HR] LATEST V64 FILE POSTED @ 2013-11-26 01:11 EST -- View attachment 8535 Wolfenstein 3D built with the shareware data files. Latest changes: 1) Added a new control menu (select "MAP CONTROLLER" from the Main Menu and follow on-screen directions) 2) Added the classic DOS exit screen, seen when exiting game from Main Menu This first post will always have a link to the newest upload.
Just wanted to follow up on this post... originally I was going for Doom, ran into trouble with that. What impressed me and made me go for another Wolf3D port was seeing the 32X port that ChillyWilly put together. That one is impressive.
That is a very cool project! Is it possible to use the GFX files from the Mac Version? These GFX is less pixelated like the Hand or Guns. I think some Console Ports use them too.