Jump to content
  • Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

73 Neutral


About MarcusAseth

  • Rank

Personal Information

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. MarcusAseth

    alternative to NVidia FX Composer?

    Thanks Hodgman, I'll consider that as well in case I don't find anything closer to FX Composer. I've also found this one trough google called ShaderFlex, do you guys know anything about it? On that page it says but it also says and I have no idea if "this years" means 2018 or if is an old abandoned page 😕
  2. Hi guys, I was reading trough Real-Time 3D Rendering with DirectX and HLSL, the bookuses NVidia FX Composer for the examples but since that software is abandoned and doesn't support DirectX11 I was wondering: what is a similar software more up to date that I can use to practice with HLSL and making shaders?
  3. Nevermind guys, I think I've got it right now. The solution was to get away from the keyboard and just scrible on paper, so now I got this (code below) Though I'm always calculating two vectors (one that goes toward the target clockwise, the other counterclockwise) and picking the one with the smaller dot product with the desired moving direction, so I wonder if there is some better way to do it in a single calculation :\ FVector AShooterPawn::CalculateNewMovingAngle(FVector const & MovingDirection, FVector const & DesiredDirection, float const TurnRate) { //exit early if no input was passed, keep going in the same direction of the last frame if (DesiredDirection.IsNearlyZero()) { return MovingDirection; } float CurrAngle = FMath::Atan2(MovingDirection.Y, MovingDirection.X); float DesiredAngle = FMath::Atan2(DesiredDirection.Y, DesiredDirection.X); //avoid calculation if current TurnRate allows us to reach the DesiredDirection this frame in a single sweep if (FMath::Abs(DesiredAngle - CurrAngle) <= FMath::DegreesToRadians(TurnRate)) { return DesiredDirection; } //find the two vector such that one is TurnRate degree bigger than the MovingDirection //and the other is TurnRate degree smaller than the MovingDirection float AngleARad = CurrAngle + FMath::DegreesToRadians(TurnRate); float AngleBRad = CurrAngle - FMath::DegreesToRadians(TurnRate); FVector AngleA(FMath::Cos(AngleARad), FMath::Sin(AngleARad), 0.f); FVector AngleB(FMath::Cos(AngleBRad), FMath::Sin(AngleBRad), 0.f); //return the angle wich has the highest DotProduct with the current moving direction return (Dot(AngleA, DesiredDirection) > Dot(AngleB, DesiredDirection))? AngleA : AngleB; }
  4. Well, now I'm thinking would be smarter if my TurnRate is expressed in Degree/second and I can just add a degree rotation to the current direction vector as to bring it closer toward the input vector from the gamepad. Though I am not quite sure of how I can achieve that, on the math side x_x Can someone point me toward some useful page?
  5. Oh my bad, it has nothing to do with Epic, is C++. That zero initialization syntax doesn't work on class, and I think I once knew and forgot :\ Also in the image below I'm getting smooth movement so I think it is working, only problem is if I apply an input 180° opposite to the red arrow in the image below, the direction won't change...I'll try figuring this out on paper (even though I think that could be because the resulting vector on two 180° apart vectors is just a scalad down version of the current direction vector, which then get normalized back to 1, so it never gets to actually rotate toward the second) but if you guys have any tips, I'll appreciate
  6. Well, I found my bug... Apparently, if you do this in UnrealEngine FVector DesiredMovingDirection{}; You are not getting a vector with the elements zeroed out, I was getting a vector with X = -223476324987etc.... impossible number so the right way is: FVector DesiredMovingDirection = FVector::ZeroVector; Why Epic?! x_x
  7. Hi guys, as the title says I'm trying to interpolate movement based on character turning speed, I first put my tought process on paper but I'm getting some odd behaviour I am not sure about in the code, so before trying and debug it I would like to submit the math to you to be sure I am doing it right in the first place In the image below, my reasoning. So the orange vector is what I am trying to obtain. The code inside the unreal engine is this CurrentMovingDirection = CurrentMovingDirection + ((DesiredMovingDirection - (-CurrentMovingDirection)) * MovementTurnRate); But I am also assuming that `(-CurrentMovingDirection)` is returning me the vector with the components with a flipped sign, and if that is not the case, that's already a mistake I think :\ Also I wrote "NewVelocity" but I meant "NewPosition", and T is assumed to me 0.5 in the image
  8. I can't anymore, I needed to move forward and I thought noone knew, so I got rid of that code, refactored stuff into classes and now I'm using only D2D x_x Still, if I attempt it in the future one more time, I'll make sure to refer back to this topic and try that as well, thanks
  9. I found this page , so if I got it right to get this work I needed to create the device using D3D10.1 and not 11? I tried that and still got the same error...in the end, now I'm using only D2D I kind of don't like this api, there are too many way to get it wrong from what I see... or maybe I am simply not good enough for it x_x
  10. I'm getting the error "WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT" so clearly I'm doing something wrong, I just don't understand what :\ Do you guys see anything wrong in my code? //Create D3d device, context, swapChain ID3D11Device* d3dDevice; ID3D11DeviceContext* d3dContext; IDXGISwapChain* swapChain; DXGI_SWAP_CHAIN_DESC swapChainDesc{}; swapChainDesc.BufferDesc.Width = appWidth; swapChainDesc.BufferDesc.Height = appHeight; swapChainDesc.BufferDesc.RefreshRate = { 60,1 }; swapChainDesc.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_CENTERED; swapChainDesc.SampleDesc.Count = 1; // for AntiAliasing swapChainDesc.SampleDesc.Quality;// for AntiAliasing swapChainDesc.BufferCount = 2; swapChainDesc.OutputWindow = appWindow; swapChainDesc.Windowed = true; if (HRESULT hr = D3D11CreateDeviceAndSwapChain(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, D3D11_CREATE_DEVICE_BGRA_SUPPORT, nullptr, 0, D3D11_SDK_VERSION, &swapChainDesc, &swapChain, &d3dDevice, nullptr, &d3dContext ); hr != S_OK) { printError("Error during D3d initialization", hr); return 1; } //Create D2d factory, renderTarget ID2D1Factory* d2dFactory; ID2D1RenderTarget* renderTarget; if (HRESULT hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_MULTI_THREADED, &d2dFactory); hr != S_OK) { printError("Error during D2d factory creation", hr); return 1; } //get backBuffer IDXGISurface* dxgiSurface; if (HRESULT hr = swapChain->GetBuffer(0, __uuidof(dxgiSurface), reinterpret_cast<void**>(&dxgiSurface)); hr != S_OK) { printError("Error retrieving dxgiSurface", hr); return 1; } float dpiX, dpiY; d2dFactory->GetDesktopDpi(&dpiX, &dpiY); D2D1_RENDER_TARGET_PROPERTIES props{}; props.type = D2D1_RENDER_TARGET_TYPE_DEFAULT; props.pixelFormat = D2D1::PixelFormat(DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED); props.dpiX = dpiX; props.dpiY = dpiY; if (HRESULT hr = d2dFactory->CreateDxgiSurfaceRenderTarget(dxgiSurface, props, &renderTarget); hr != S_OK) { printError("CreateDxgiSurfaceRenderTarget() function failed", hr); //THIS FAIL system("pause"); //THIS FAIL return 1; //THIS FAIL }
  11. MarcusAseth

    Multiplayer Pac-man Challenge

    I'll give it a try, thanks for sharing
  12. MarcusAseth

    Multiplayer Pac-man Challenge

    I'll give it a try, thanks for sharing
  13. MarcusAseth

    Multiplayer Pac-man Challenge

    I agree, I wasn't sure if this was going to change to a different more general solution because I still have no idea about how to send input to the ghosts, so I made it the quick and dirty way using the function pointer
  14. MarcusAseth

    Multiplayer Pac-man Challenge

    I agree, I wasn't sure if this was going to change to a different more general solution because I still have no idea about how to send input to the ghosts, so I made it the quick and dirty way using the function pointer
  15. MarcusAseth

    Multiplayer Pac-man Challenge

    My idea for the input was to have a map of keybinding with key=SDL_Keycode and value=void(*)() so that I can link the functions to the key and just pass the key pressed to the map and have it call the right thing, code below. I'm not even sure this work since is the first time I try, furthermore since the Ghost are Creature type too, how are they supposed to get inputs? I guess I need to figure out a secondary method to give input to them. Also, does this even work if both players are holding down a key to move ther character? Hopefully an SDL_Event contain info about all the key currently pressed... I'll keep going, but if you guys have any article that can help me/ put me on the right track, I would appreciate
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!