Giter VIP home page Giter VIP logo

perfect_dark's Introduction

Perfect Dark port

This repository contains a work-in-progress port of the Perfect Dark decompilation to modern platforms.

To run the port, you must already have a Perfect Dark ROM, specifically one of the following:

  • ntsc-final/US V1.1/US Rev 1 (md5 e03b088b6ac9e0080440efed07c1e40f).
    This is the recommended version to use.
    Called NTSC version 8.7 final on the boot screen.
  • ntsc-1.0/US V1.0 (md5 7f4171b0c8d17815be37913f535e4e93).
    Technically supported, but not recommended.
    Called NTSC version 8.7 final on the boot screen as well.
  • jpn-final (md5 538d2b75945eae069b29c46193e74790).
    Technically supported, but requires a separate custom-built executable.
    Called JPN version 8.9 final on the boot screen.
  • pal-final (md5 d9b5cd305d228424891ce38e71bc9213).
    Technically supported, but requires a separate custom-built executable.
    Called PAL 8.7 final on the boot screen.

Status

The game is in a mostly functional state, with both singleplayer and split-screen multiplayer modes fully working.
There are minor graphics- and gameplay-related issues, and possibly occasional crashes.

The following extra features are implemented:

  • mouselook;
  • dual analog controller support;
  • widescreen resolution support;
  • configurable field of view;
  • 60 FPS support, including fixes for some framerate-related issues;
  • fixes for a couple original bugs and crashes;
  • basic mod support, currently enough to load a few custom levels;
  • slightly expanded memory heap size;
  • experimental high framerate support (up to 240 FPS):
    • set Game.TickRateDivisor to 0 in pd.ini to activate;
    • in practice the game will have issues running faster than ~165 FPS, so use VSync or Video.FramerateLimit to cap it.

Currently only 32-bit platforms are supported, namely x86 Windows and Linux.
Note that 32-bit binaries will still work on 64-bit versions of those platforms, though you might have to install some additional libraries.

Download

Latest automatic builds for supported platforms:

If you are looking for netplay builds (the port-net branch), see this link.

Running

You must already have a Perfect Dark ROM to run the game, as specified above.

  1. Create a directory named data next to pd.exe if it's not there.
  2. Put your Perfect Dark NTSC ROM named pd.ntsc-final.z64 into it.
  3. Run pd.exe.

If you want to use a PAL or JPN ROM instead, put them into the data directory and run the appropriate executable:

  • PAL: ROM name pd.pal-final.z64, EXE name pd.pal.exe.
  • JPN: ROM name pd.jpn-final.z64, EXE name pd.jpn.exe.

Additional information can be found in the wiki.

A GPU supporting OpenGL 3.0 or above is required to run the port.

Controls

1964GEPD-style and Xbox-style bindings are implemented.

N64 pad buttons X and Y (or X_BUTTON, Y_BUTTON in the code) refer to the reserved buttons 0x40 and 0x80, which are also leveraged by 1964GEPD.

Support for one controller, two-stick configurations are enabled for 1.2.

Note that the mouse only controls player 1.

Controls can be rebound in pd.ini. Default control scheme is as follows:

Action Keyboard and mouse Xbox pad N64 pad
Fire / Accept LMB/Space RT Z Trigger
Aim mode RMB/Z LT R Trigger
Use / Cancel E N/A B
Use / Accept N/A A A
Crouch cycle N/A L3 0x80000000 (Extra)
Half-Crouch Shift N/A 0x40000000 (Extra)
Full-Crouch Control N/A 0x20000000 (Extra)
Reload R X X (0x40)
Previous weapon Mousewheel forward B D-Left
Next weapon Mousewheel back Y Y (0x80)
Radial menu Q LB D-Down
Alt fire mode F RB L Trigger
Alt-fire oneshot F + LMB or E + LMB A + RT or RB + RT A + Z or L + Z
Quick-detonate E + Q or E + R A + B or A + X A + D-Leftor A + X

Building

Windows

  1. Install MSYS2.
  2. Open the MINGW32 prompt. (NOTE: not the MSYS prompt or the MINGW64 prompt)
  3. Install dependencies:
    pacman -S mingw-w64-i686-toolchain mingw-w64-i686-SDL2 mingw-w64-i686-zlib make git
  4. Get the source code:
    git clone --recursive https://github.com/fgsfdsfgs/perfect_dark.git && cd perfect_dark
  5. Run make -f Makefile.port.
    • Add ROMID=pal-final or ROMID=jpn-final at the end of the command if you want to build a PAL or JPN executable respectively.
  6. The resulting executable will be at build/ntsc-final-port/pd.exe.
  7. If you don't know where you downloaded the source to, you can run explorer . to open the current directory.

Linux

  1. Ensure you have gcc, g++ (version 10.0+) and 32-bit versions of SDL2 (version 2.0.12+), libGL and ZLib installed on your system.
    • On a 64-bit system you also need to have gcc-multilib and g++-multilib (or your distro's analogues) installed.
  2. Get the source code:
    git clone --recursive https://github.com/fgsfdsfgs/perfect_dark.git && cd perfect_dark
  3. Run the following command:
    • On a 64-bit system: make -f Makefile.port TARGET_PLATFORM=i686-linux
    • On a 32-bit system: make -f Makefile.port
    • Add ROMID=pal-final or ROMID=jpn-final at the end of the command if you want to build a PAL or JPN executable respectively.
  4. The resulting executable will be at build/ntsc-final-port/pd.exe.

Currently only i686-linux and i686-windows are supported, using gcc -m32 and i686-w64-mingw32-gcc as compilers, respectively.
Alternate compilers can be specified by passing TOOLCHAIN=i686-whatever- as a command line argument.

You can build an executable with PAL or JPN ROM support by adding ROMID=pal-final or ROMID=jpn-final to the make command.
You will need to provide a jpn-final or pal-final ROM to run those, named pd.jpn-final.z64 or pd.pal-final.z64.

It might be possible to build a 32-bit ARM executable, but this has not been tested.

Credits

  • the original decompilation project authors;
  • doomhack for the only other publicly available PD porting effort I could find;
  • sm64-port authors for the audio mixer and some other changes;
  • Ship of Harkinian team, Emill and MaikelChan for the libultraship version of fast3d that this port uses;
  • lieff for minimp3;
  • Mouse Injector and 1964GEPD authors for some of the 60FPS- and mouselook-related fixes;
  • everyone who has submitted pull requests and issues to this repository and tested the port;
  • probably more I'm forgetting.

perfect_dark's People

Contributors

abgrac avatar axdoomer avatar babbygremlin avatar bobbar avatar calinou avatar djdv avatar fgsfdsfgs avatar hyh19962008 avatar iamgreaser avatar jamoreno-larios avatar kronflux avatar maikelchan avatar neonnyan avatar nyxem avatar paulgrandperrin avatar phnod avatar ryandwyer avatar silentexception avatar squiddingme avatar throwaway29292 avatar tmyqlfpir avatar twitchbronbron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

perfect_dark's Issues

Crash looking down Defection elevator shaft

Got an unknown GBI opcode on the elevator after it started moving down towards the lobby. I was fooling around with some cheats at the same time, and have reliably replicated and narrowed it to looking down the shaft while holding the Phoenix. I wish I could provide more information of what command value it was trying to process but I'm unsure of how to read the stderr buffer or how to run this through a debugger.

2023 08 18 T(22 28 00)pd_6Cv4RRwOCA

2023 08 18 T(23 04 58)pd_1QSsr6PcBw

2023 08 18 T(22 26 47)pd_gKBrRHsVAq

Models "squish" on some spots

Specially noticeable with mines, but also just had a guard do it in real time. Not sure what triggers it, seems to be dependant on the map geometry.

squished.model.mp4

Base Profile Screenshot 2023 08 16 - 13 06 04 99

Broken depth on view models

Villa, Air Base and Crash Site have broken depth with the viewmodels, making them clip through the wall if you move up close.

Base Profile Screenshot 2023 08 16 - 12 50 46 35
Base Profile Screenshot 2023 08 16 - 12 53 14 98
Base Profile Screenshot 2023 08 16 - 12 53 51 29

Slider settings change too fast

Assuming this is related to switching to 60fps, slider settings(for example, the sliders in the Limits menu in combat simulator) move way too fast to reliably choose a desired setting.

I'm guessing if/when a mouse cursor is added this won't be too much of an issue, though.

CTD loading Crash Site

Unsure when this first began appearing, as video shows, some game sessions Crash Site will be working and can be loaded perfectly fine, either from abort reload or from institute. Other game sessions it will crash any time it's loaded.
2023-08-20 15-00-52.webm
Attached video is;
-Abort reload
-Abort reload
-Carrington load
-Reboot game
-Carrington crash
-Reboot game
-Carrington crash

Happens across multiple savefiles, but haven't seen it occur with any other level.

Any specific reason why gcc -m32 isn't used for Linux?

In order to get it to build on my system I had to change the CFLAGS/CXXFLAGS/LDFLAGS to have -m32 in the string and deleted $(TOOLCHAIN) from CC and CXX, leaving them as gcc -std=c11 and g++ -std=c++20.

On Debian(and Ubuntu, I'm guessing), using gcc multilib, you can compile the 32-bit binary by using 64-bit gcc by simply adding -m32.

Is there some reason why the toolchain setup is complex? It results in a CC variable that is something like 'i686-linux-gnu-gcc' which is only available if you install a the 'i686-linux-gnu-gcc' package which breaks gcc-multilib.

Small gaps impassable at high framerates.

2023-08-20.18-06-06.webm

See video. Unsure what the "intended" behavior should be considered here, it's likely the devs just didn't realize that gap was impassable without the regular lag the n64 version experienced.

RC-P120 Silver challenge impossible to complete

In the recently fixed gun range, the RC-P120 Silver challenge is impossible to complete as the targets won't react to the player turning invisible. They're meant to slowly turn around when using the alt fire option to cloak, but they won't do it.

rcp120.bug.mp4

Will update with other challenges that aren't possible to complete, if any.

[Feature Request] Fix geomtery seams around portals.

seams

seams2

There is noticeable seams around portals that will shift and create holes in the geometry depending on your view. This happens occasionally in GoldenEye when there's mismatches between room and portal geometry, but in Perfect Dark these seams are nearly everywhere.

I'm assuming this is caused by some sort of rounding/precision error with portal coords under https://github.com/fgsfdsfgs/perfect_dark/blob/8c9c0abee637fd0bb18dfec91fc6a007b3903a88/src/game/portalconv_c.c

Environment mapped surfaces look incorrect

It looks like the texture coordinates generation (G_TEXTURE_GEN) has an issue, or the normals are being read incorrectly... The opening logos demonstrate it pretty well.

Emulation Current
simple64-gui_2023_08_20_02_44_22_791 pd_2023_08_20_02_47_01_293
simple64-gui_2023_08_20_02_44_18_604 pd_2023_08_20_02_45_56_326
simple64-gui_2023_08_20_02_44_33_035 pd_2023_08_20_02_46_10_110

[Feature request] Setting for antialiasing

Hi! Would it be possible to add options for hardware antialiasing? (i.e. multisampling AA and FSAA)

It's technically possible to force it from the GPU driver, but doing that breaks framebuffer effects.

No AA MSAA FSAA
No AA MSAA FSAA

Slow Motion/Combat Boost does not work.

To reproduce: Start a multiplayer match with the Slow Motion option enabled, or use the Combat Boost in Carrington Institute Defense. The game will run the same speed than slow down as intended.

Slow Audio Both SFX and Music

This one is probably known but didn't see an open issue for it so I am just dropping this here
All Music and SFX are crackly and appear to be running slow.

Scroll Wheel bindings don't work

VK_MOUSE_WHEEL_UP and VK_MOUSE_WHEEL_DN don't appear to work inside the kbbinds. Looking it up it seems like they'd need to be handled inside the SDL_PollEvent as a SDL_MOUSEWHEEL event and grab the event.wheel.y value? My experience with regular C projects is a little lacking and I'm struggling to figure out how to link the values properly back to the input file, and if there's a proper way to access the values.

Multiple issues with the CamSpy.

  1. Portal rendering does not work correctly with the CamSpy, as they will be ignored if too close to the sides of the screen.
camspy portals
  1. The CamSpy's rotation in the inventory is bugged, it will jitter and shake. In testing I saw this not happen with any other item but it may be a global issue.
CamSpyRot.mp4
  1. Mouse look does not work with the CamSpy, you are stuck using the arrow keys to look left/right, hover up/down, and WASD to move it.

Crash after opening sequence

Getting a crash after loading into the Institute menu that I've narrowed down to having something to do with the radial menu section bondmove.c Line 1417 g_Vars.currentplayer->amdowntime = 0; in the radial menu in commit ffae454. Haven't been able to figure out how to actually debug the project so I'm not sure why this causes a crash, but when I comment it out, it stops crashing for me. Does anyone else get this crash?

Link to line
https://github.com/fgsfdsfgs/perfect_dark/blob/8c6d6df5fc396bef8ca393397296a9562b70683e/src/game/bondmove.c#L1417C45-L1417C45

dedicated crouch buttons

  • toggle half-crouch (1964 behavior) - implemented by #184
  • toggle full-crouch (1964 behavior) - implemented by #184
  • cycle crouch (xbla L3 behavior) - implemented by #184
  • implement hold / toggle flag per/player for 1964-style bindings

Three-point filtering shouldn't be applied to some textures

When using TextureFilter=1, some objects like the distant buildings here still use nearest neighbour filtering.
Normal
This matches up with the original game running in an emulator, so that's not a problem. (Simple64/Parallel)
Emulated
However, when using TextureFilter=2, those objects have three-point filtering applied, as well as the UI.
Three point

Stairs on Villa are broken

Some of the stairs on Villa do not allow the player to descend or ascend, notably the interior stairs. Exterior stairs seem to work fine in my testing.

Some characters get stuck in place

Some characters can get stuck in place, repeating an animation loop. This can result in a failed mission if the character is necessary to the objective.

Scrolling through heads disrupts textures

Not a major one, but funny enough to point out. Scrolling through heads in the Character menu causes some of the UV maps to mess up. Only applies in the head menu, even tabbing down to bodies immediately corrects the issue in the preview window
image

Text in multiplayer flickers before it appears

Text will appear as either fully green, or red squares for a brief moment before it correctly fades in.

Text.flicker.mp4

EDIT: I have not seen this happen to me in singleplayer yet, so I have edited the issue to specify.

Mouse wheel not working

The mouse wheel doesnt work, it doesn't change weapons. I think it's still in development.

Datadyne: Defection Carpet Texture Broken

Probably known, but there's no issue open, so I'm opening one for it. The carpet texture in Datadyne: Defection seems to be corrupted in some way, looks like when you decode a texture the wrong way in the GoldenEye Setup Editor. There could be more things affected in this way, I just haven't found them.

How it looks in the port:
Datadyne Defection Floor Port

How it looks normally, in 1964 GEPD Edition:
Datadyne Defection Floor Emulator

Crash in Air Force One

How to reproduce: Play through Air Force One until you reach the cutscene, the game will then crash

Controller Sensitivity

I know it's early days but the controller especially looking with the right stick seems very sensitive. Is there any setting i can change? or just wait for things to mature, thanks.

Tranquilizer weapon causing crash

In missions where there is an enemy that uses a tranquilizer or there is a psychosis gun in the world(Maian SOS) the game can crash. This may be two separate bugs but they both share a weapon model in common. In a recent livestream, Graslu00 implements a workaround by walking backwards into the psychosis gun to prevent it from appearing on screen, preventing the crash.

Mouselook senstivity affected by zoom and crouch.

To reproduce: Use any item that grants the player zoom, or crouch. When they try looking around their sensitivity will be lowered, and when using 30x zoom, you can barely use the mouse (Easily done on Villa on Agent/Special Agent).

[Feature Request] Possibility of switching to per-pixel dynamic lighting?

Currently, the game engine uses a rather weird room-based dynamic lighting system where the entire room lights up when firing weapons. Perhaps it would be better to just use OpenGL lights, ideally per-pixel for a better effect.

I don't know if graphics enhancements are being considered for this project but I have always thought that the dynamic lighting in PD(and GE) was held back because of the hardware constraints.

For clarification, I ONLY mean the lighting associated with gunfire or anything else that causes the room the light up such as explosions. The base game's map lighting is just fine the way it is. I just felt that the original dynamic lighting system was lacking.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.