Jump to content
  • Advertisement
    1. Today
    2. Bregma

      Custom size_t

      I imagine the root of this redundancy is the fact that Microsoft's toolchain does (did?) not support C99, and by inference standard C++. C99 introduced size_t and uintptr_t, and C++ has always provided std::size_t and since C++11 (where is moved to C99 instead of C89) std::uintptr_t. If you want cross-platform portability you often have to work around the non-conforming platforms or else give in and lock in. Always good for party conversation, that Microsoft toolchain. They try.
    3. Hope rises as pieces of the overworld are coming together. Weighed down by post-delay sad vibes all week and only just now getting back into the swing of things as I write this at 3:30am on a Wednesday. This week was code fever and I wore a programmer cap tight while sprucing up BGP's bones. Lots of things are working better than ever, and lots more are sure to come. The real issue right now is seeing how much can get up and running before BronyCon. The panel is going to be a slideshow about game development in general, some Q&A between slides, how I came up with and created BGP, and what features I have left to create and how I plan to implement them. And all that will be sandwiched between a Trailer to show off the game and a gameplay demo of the battle system and overworld. Then I'd like to have some sort of teaser finale to send everyone off with and encourage them to download the demo to their phones on the way out so they can remember the game later. But how much I can show depends on how far I get in the next 6 days, so fingers crossed, I won't hit any more road blocks. Every precious minute counts right now, and I think I might just barely make it. So let's see what's been done in the past few days.Read More: yotesgames.com
    4. lawnjelly

      Hard sell and coercive tactics from Unity

      Resign.
    5. I personally went for entities being simple ids with no pointers or references to components whatsoever. The main pros are it's simple and does not have the problem of needing to update pointers (therefore removing the risk of dangling pointers to dead entities/components). For example, if you want to reshuffle the components in a single system for more cache friendly performance, then the entities and other systems don't need to know because each system is completely decoupled. The main con is components and entities don't directly know about each other so a slightly more complicated way of communicating (e.g. an event messenger or the observer pattern) needs to be designed. Although there is the temptation to include pointers to components early on when everything is simple, as your engine grows and becomes more complicated, this becomes a horrible spaghetti mess of interdependent systems and components. Having ids with events/messages to communicate does not get more complicated. It can get slower if your messaging is not done in a sensible way, but this is more an optimisation problem for later (e.g. allow particular systems to subscribe to certain messages so the overall number of messages sent around is small). I don't know if you've read this online book before, but many of these issues are discussed here ( http://gameprogrammingpatterns.com/component.html )
    6. Hi All I was just wondering is any one knows what database is used in Football manager 2018 Thanks
    7. TeaTreeTim

      Help with FBXSDK

      I have but a while ago now so I'll try to remember a few points: Some of the official examples are wrong. They don't account for nurbs or only accout for a particular fbx format.I remember you will have an easier time if you triangulate before saving your meshes, although you should really expand your code to support nurbs (see below near the end for how). There's more to it than that but I'd have to look back over my work to remember sorry. Just take it for granted you will have to practice loading several different examples of fbx meshes with slightly different formats before you get it all working (eg coloured vertices, multiple nodes, multiple uv coordinates, skin and joints). Also the data like vertex positions can be direct or indexed but I don't remember the terminology they use to describe that. Here is some code of mine that works for a lot of different sources of fbx's. It wont plug and play (it references some of my own stuff) but should help give you an idea I hope. If you don't plan to animate you could probably strip out half of it, but I added it verbatim in-case that's your intention: EDIT: The colour stuff is my own system, ignore it if its confusing. void AnimMesh::AddMeshFBX(FbxMesh* mesh, FbxSkin *skin, FbxAMatrix geometryMatrix) { float maxDist = 0; Vector4 maxWV; Vector4 maxW; Vector3 min = Vector3(1000, 10000, 10000); Vector3 max = Vector3(-1000, -10000, -10000); std::vector<std::string> bonePos; bonePos.clear(); int mTriangleCount = mesh->GetPolygonCount(); int vertexCounter = vertices.size(); int * fbxIndices = mesh->GetPolygonVertices(); FbxVector4 * fbxVertices = mesh->GetControlPoints(); FbxStringList uvSetNameList; mesh->GetUVSetNames(uvSetNameList); int uvSetCount = uvSetNameList.GetCount(); const fbxsdk::FbxGeometryElementUV* lUVElement = nullptr; if (uvSetCount > 0) { const char* lUVSetName = uvSetNameList.GetStringAt(0); lUVElement = mesh->GetElementUV(lUVSetName); } const fbxsdk::FbxGeometryElementVertexColor* colorElement = mesh->GetElementVertexColor(); Vector4 diffuseColor = DiffuseMaterial(mesh); transformOffset = geometryMatrix; unsigned int numOfClusters = 0; WeightMap *weights[BONES_PER_SKELETON]; for (int i = 0; i < BONES_PER_SKELETON; i++) weights[i] = nullptr; if (skin) { numOfClusters = skin->GetClusterCount(); for (unsigned int clusterIndex = 0; clusterIndex < numOfClusters; ++clusterIndex) { FbxCluster* currCluster = skin->GetCluster(clusterIndex); std::string currJointName = currCluster->GetLink()->GetName(); AnimNode *jointNode = rootNode->NodeFromName(currJointName); int jointID = -1; if (jointNode) jointID = jointNode->id; if (jointID >= 0) { FbxAMatrix bonePose; currCluster->GetTransformLinkMatrix(bonePose); FbxVector4 boneTrans = bonePose.GetT(); jointNode->bonePose = bonePose; meshPose; currCluster->GetTransformMatrix(meshPose); FbxVector4 meshTrans = meshPose.GetT(); FbxVector4 fbxBoneHead = boneTrans; jointNode->boneHead = Vector4(fbxBoneHead[0], fbxBoneHead[1], fbxBoneHead[2], 1); jointNode->hasDeformer = true; jointNode->currentMatrix = bonePose.Inverse() * meshPose * geometryMatrix; WeightMap newMap = WeightMap(jointID, currCluster->GetControlPointIndicesCount(), currCluster->GetControlPointIndices(), currCluster->GetControlPointWeights()); weights[jointID] = (WeightMap *)malloc(sizeof(WeightMap)); memcpy(weights[jointID], &newMap, sizeof(WeightMap)); } else { dprintf(" NOT FOUND\n"); } } } for (unsigned int polygonIndex = 0; polygonIndex < mTriangleCount; polygonIndex++) { int pointsInPoly = mesh->GetPolygonSize(polygonIndex); if (pointsInPoly < 0) { dprintf("Mesh Error\n"); exit(ERROR); } int firstVert = vertices.size(); for (unsigned int polyVertexIndex = 0; polyVertexIndex < pointsInPoly; polyVertexIndex++) { int ctrlPointIndex = mesh->GetPolygonVertex(polygonIndex, polyVertexIndex); if (ctrlPointIndex < 0) { dprintf("Vert Index -1\n"); } else { AnimNode::AnimVertice vert; FbxVector4 currCtrlPoint = geometryMatrix.MultT(fbxVertices[ctrlPointIndex]); vert.position = Vector4(currCtrlPoint.mData[0], currCtrlPoint.mData[1], currCtrlPoint.mData[2], id); FbxVector4 norm; mesh->GetPolygonVertexNormal(polygonIndex, polyVertexIndex, norm); vert.normal = Vector3(norm.mData[0], norm.mData[1], norm.mData[2]); int texIndex = mesh->GetTextureUVIndex(polygonIndex, polyVertexIndex); if (texIndex < 0) { vert.texCoord = diffuseColor; fbxsdk::FbxGeometryElementVertexColor *color = mesh->GetElementVertexColor(ctrlPointIndex); if (color) { fbxsdk::FbxColor col = color->GetDirectArray()[0]; vert.texCoord = Vector4(col.mRed, col.mGreen, col.mBlue, -16); } } else { FbxVector2 lUVValue = lUVElement->GetDirectArray().GetAt(texIndex); vert.texCoord = Vector4(lUVValue.mData[0], lUVValue.mData[1], iType, 0); } if (colorElement) { FbxColor color = GetColor(colorElement, ctrlPointIndex, vertexCounter); int red = (int)(4 * color.mRed); if (red == 4) red = 3; int green = (int)(4 * color.mGreen); if (green == 4) green = 3; int blue = (int)(4 * color.mBlue); if (blue == 4) blue = 3; vert.texCoord.w = red + green * 4 + blue * 16; } vert.weights = Vector4(0, 0, 0, 0); int weightV[4] = {}; for (int cWeight = 0; cWeight < BONES_PER_SKELETON; cWeight++) { WeightMap *weightMap = weights[cWeight]; if (weightMap) { for (int ccp = 0; ccp < weightMap->count; ccp++) { if (weightMap->controlPoints[ccp] == ctrlPointIndex) { SortWeight(weightMap->weights[ccp], cWeight, weightV, vert.weights); } } } } vert.weightID = weightV[0] * 0x1000000 + weightV[1] * 0x10000 + weightV[2] * 0x100 + weightV[3]; float weightTotal = 0; for (int cb = 0; cb < 4; cb++) weightTotal += vert.weights[cb]; if (weightTotal > 0) for (int cb = 0; cb < 4; cb++) vert.weights[cb] /= weightTotal; Vector4 newPos = Vector4(); for (int cb = 0; cb < 4; cb++) { if (vert.weights[cb] > 0) { AnimNode *jointNode = FindNode(weightV[cb], rootNode); newPos += (vert.position + jointNode->boneHead) * vert.weights[cb]; } } vertices.push_back(vert); int vertexIndex = vertices.size() - 1; if (polyVertexIndex > 2) { indices.push_back(vertexIndex - 1); indices.push_back(vertexIndex); indices.push_back(firstVert); } else { indices.push_back(vertexIndex); } vertexCounter++; } } } for (int i = 0; i < BONES_PER_SKELETON; i++) { if (weights[i]) free(weights[i]); } bonePos.clear(); }
    8. a light breeze

      Custom size_t

      Short version: yes, use std::size_t in C++ and plain size_t in C. There are a handful of cases where you want more than 32 bits even in 32 bit mode (e.g. when dealing with the size of multi-gigabyte data files that are never loaded into memory in their entirety). In those cases, use std::uint64_t instead. But don't try to reinvent size_t. As for the Unreal engine code, I can think of two possibilities: Workaround for crappy console SDKs. This may be a valid reason for reinventing size_t, but only if and when you actually run into it. NIH syndrome. This is never a good reason for doing anything.
    9. C++ is not a windows language, there really is no such thing as a windows language. If these things confuse you, like compilers, source code????? and what philosophies btw? Then you are not a programmer honestly. The language used rarely matters, pick the best one for the job. A data structure is a data structure regardless of the language (within a few limitations) so if you know data structures you should be able to fairly easily switch languages. Your post was very short sighted that really did nothing to contribute to the OP.
    10. Anyone used the fbxsdk? I want to load models into my engine but when I load them, something is wrong. I load a sphere made and triangulated with maya and it looks like only the bottom of the sphere gets into the program. I did a cube too and it looks like just one side gets in. What is going on in FBXImport and the dx11 related functions in source.cpp? IT looks ok to me. :( Here is some code: FBXImport.h #pragma once #include <fbxsdk.h> #include <winerror.h> #include <vector> #include <d3d11.h> #include <d3dx11.h> #include <d3dx10.h> #include <xnamath.h> #include "wx/wx.h" #include "wx/notebook.h" #include <wx/timer.h> #include <wx/time.h> using namespace std; struct Vertex { Vertex() {} Vertex(float x, float y, float z, float cr, float cg, float cb, float ca) : pos(x, y, z), color(cr, cg, cb, ca) {} XMFLOAT3 pos; XMFLOAT4 color; }; void InitFBX(); void DestroyManager(); HRESULT ImportFile(vector<Vertex>* pos, vector<DWORD>* indices, wxTextCtrl* ctrl); FbxImport.cpp #include "FBXImport.h" #include <assert.h> #include <xnamath.h> FbxManager* fbxMgr = nullptr; vector<Vertex> vrx_positions; void InitFBX() { fbxMgr = FbxManager::Create(); } void DestroyManager() { fbxMgr->Destroy(); } HRESULT ImportFile(vector<Vertex>* pos, vector<DWORD>* indices, wxTextCtrl* console) { if(fbxMgr == nullptr) InitFBX(); FbxIOSettings* ios = FbxIOSettings::Create(fbxMgr, IOSROOT); fbxMgr->SetIOSettings(ios); FbxImporter* importer = FbxImporter::Create(fbxMgr, ""); FbxScene* scene = FbxScene::Create(fbxMgr, "myScene"); bool success = importer->Initialize("C:\\Models\\sphere.fbx", -1, fbxMgr->GetIOSettings()); if (!success) return E_FAIL; success = importer->Import(scene); if (!success) return E_FAIL; importer->Destroy(); FbxNode* root_node = scene->GetRootNode(); if (root_node) { for (int i = 0; i < root_node->GetChildCount(); i++) { FbxNode* child_node = root_node->GetChild(i); if (child_node->GetNodeAttribute() == NULL) continue; FbxNodeAttribute::EType attribute_type = child_node->GetNodeAttribute()->GetAttributeType(); if (attribute_type != FbxNodeAttribute::eMesh) continue; FbxMesh* mesh = (FbxMesh*)child_node->GetNodeAttribute(); FbxVector4* verts = mesh->GetControlPoints(); for (int j = 0; j < mesh->GetPolygonCount(); j++) { int numVerts = mesh->GetPolygonSize(j); assert(numVerts == 3); for (int k = 0; k < numVerts; k++) { DWORD control_pt_index = mesh->GetPolygonVertex(j, k); Vertex vrx((float)verts[control_pt_index].mData[0], (float)verts[control_pt_index].mData[1], (float)verts[control_pt_index].mData[2], 0.6f, 0.8f, 0.6f, 1.0f); pos->push_back(vrx); indices->push_back(control_pt_index); } } } } } Source.cpp #include <windows.h> #include <d3d11.h> #include <d3dx11.h> #include <d3dx10.h> #include <xnamath.h> #include "Source.h" #include "FBXImport.h" //Global Declarations - Interfaces// IDXGISwapChain* SwapChain; ID3D11Device* d3d11Device; ID3D11DeviceContext* d3d11DevCon; ID3D11RenderTargetView* renderTargetView; ID3D11Buffer* squareIndexBuffer; ID3D11DepthStencilView* depthStencilView; ID3D11Texture2D* depthStencilBuffer; ID3D11Buffer* squareVertBuffer; ID3D11VertexShader* VS; ID3D11PixelShader* PS; ID3D10Blob* VS_Buffer; ID3D10Blob* PS_Buffer; ID3D11InputLayout* vertLayout; ID3D11Buffer* cbPerObjectBuffer; ID3D11Buffer* fbx_index_buf; ID3D11Buffer* fbx_vert_buf; //Global Declarations - Others// LPCTSTR WndClassName = L"firstwindow"; HWND hwnd = NULL; HRESULT hr; int Width = 300; int Height = 300; vector<Vertex> verts; vector<DWORD> indices; Vertex* positions; DWORD* index; XMMATRIX WVP; ///////////////**************new**************//////////////////// XMMATRIX cube1World; XMMATRIX cube2World; XMMATRIX cube_fbx; ///////////////**************new**************//////////////////// XMMATRIX camView; XMMATRIX camProjection; XMVECTOR camPosition; XMVECTOR camTarget; XMVECTOR camUp; ///////////////**************new**************//////////////////// XMMATRIX Rotation; XMMATRIX Scale; XMMATRIX Translation; float rot = 0.01f; ///////////////**************new**************//////////////////// //Create effects constant buffer's structure// struct cbPerObject { XMMATRIX WVP; }; cbPerObject cbPerObj; D3D11_INPUT_ELEMENT_DESC layout[] = { { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }, }; UINT numElements = ARRAYSIZE(layout); // Event table for MyFrame wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(wxID_EXIT, MyFrame::OnQuit) EVT_CLOSE(MyFrame::OnClose) wxEND_EVENT_TABLE() // Implements MyApp& GetApp() DECLARE_APP(MyApp) // Give wxWidgets the means to create a MyApp object IMPLEMENT_APP(MyApp) bool MyApp::OnInit() { // Create the main application window MyFrame *frame = new MyFrame(wxT("Worgen Engine Version 0")); // Show it frame->Show(true); return true; } void MyFrame::OnQuit(wxCommandEvent& event) { // Destroy the frame Close(); } void MyFrame::OnClose(wxCloseEvent& event) { timer->Stop(); //Release the COM Objects we created SwapChain->Release(); d3d11Device->Release(); d3d11DevCon->Release(); renderTargetView->Release(); VS->Release(); PS->Release(); VS_Buffer->Release(); PS_Buffer->Release(); vertLayout->Release(); depthStencilView->Release(); depthStencilBuffer->Release(); cbPerObjectBuffer->Release(); event.Skip(); } MyFrame::MyFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition) { // Create a menu bar wxMenu *fileMenu = new wxMenu; // The “About” item should be in the help menu wxMenu *helpMenu = new wxMenu; helpMenu->Append(wxID_ABOUT, wxT("&About...\tF1"), wxT("ABout this program.")); fileMenu->Append(wxID_EXIT, wxT("E&xit\tAlt - X"), wxT("Quit this program")); // Now append the freshly created menu to the menu bar... wxMenuBar *menuBar = new wxMenuBar(); menuBar->Append(fileMenu, wxT("&File")); menuBar->Append(helpMenu, wxT("&Help")); // ... and attach this menu bar to the frame SetMenuBar(menuBar); // Create a status bar just for fun CreateStatusBar(2); SetStatusText(wxT("Welcome to Worgen Engine!")); nbHierarchy = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxSize(200, 300)); nbScene = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxSize(800, 600)); nbInspector = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxSize(200, 300)); console = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(800, 300), wxTE_MULTILINE | wxTE_READONLY); timer = new RenderTimer(); timer->dxPanel = new MyDxPanel((MyFrame*)nbScene); wxPanel* hierarchyWindow = new wxPanel(nbHierarchy, wxID_ANY); nbHierarchy->AddPage(hierarchyWindow, "Hierarchy", false); nbScene->AddPage(timer->dxPanel, "Game", false); wxPanel* inspectorWindow = new wxPanel(nbInspector, wxID_ANY); nbInspector->AddPage(inspectorWindow, "Inspector", false); wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(nbHierarchy, 0, wxEXPAND, 0); sizer->Add(nbScene, 1, wxEXPAND, 0); sizer->Add(nbInspector, 0, wxEXPAND, 0); wxBoxSizer* console_sizer = new wxBoxSizer(wxVERTICAL); console_sizer->Add(sizer, 0, wxEXPAND, 0); console_sizer->Add(console, 0, wxEXPAND, 0); SetSizerAndFit(console_sizer); HRESULT hr = ImportFile(&verts, &indices, console); if (hr == E_FAIL) { wxMessageBox("Error importing fbx"); } positions = &verts[0]; index = &indices[0]; timer->dxPanel->initDx(timer->dxPanel->GetHWND()); timer->dxPanel->initScene(); timer->Start(); } MyFrame::~MyFrame() { delete timer; } wxBEGIN_EVENT_TABLE(MyDxPanel, wxPanel) EVT_PAINT(MyDxPanel::OnPaint) EVT_ERASE_BACKGROUND(MyDxPanel::OnEraseBackground) wxEND_EVENT_TABLE() MyDxPanel::MyDxPanel(MyFrame* parent) : wxPanel(parent) { parentFrame = parent; } MyDxPanel::~MyDxPanel() { } void MyDxPanel::OnEraseBackground(wxEraseEvent &WXUNUSED(event)) { //empty to avoid flashing } void MyDxPanel::updateScene() { rot += .05f; if (rot > 6.26f) rot = 0.0f; XMVECTOR rotaxis = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f); Rotation = XMMatrixRotationAxis(rotaxis, -rot); cube_fbx = Rotation; } void MyDxPanel::render() { //Clear our backbuffer float bgColor[4] = { (0.0f, 0.0f, 0.0f, 0.0f) }; d3d11DevCon->ClearRenderTargetView(renderTargetView, bgColor); //Refresh the Depth/Stencil view d3d11DevCon->ClearDepthStencilView(depthStencilView, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0); WVP = cube_fbx * camView * camProjection; cbPerObj.WVP = XMMatrixTranspose(WVP); d3d11DevCon->UpdateSubresource(cbPerObjectBuffer, 0, NULL, &cbPerObj, 0, 0); d3d11DevCon->VSSetConstantBuffers(0, 1, &cbPerObjectBuffer); d3d11DevCon->DrawIndexed(indices.size(), 0, 0); //Present the backbuffer to the screen SwapChain->Present(0, 0); } void MyDxPanel::OnPaint(wxPaintEvent& event) { wxPaintDC dc(this); updateScene(); render(); } void MyDxPanel::initDx(HWND wnd) { //Describe our SwapChain Buffer DXGI_MODE_DESC bufferDesc; ZeroMemory(&bufferDesc, sizeof(DXGI_MODE_DESC)); bufferDesc.Width = Width; bufferDesc.Height = Height; bufferDesc.RefreshRate.Numerator = 60; bufferDesc.RefreshRate.Denominator = 1; bufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; bufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; bufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED; //Describe our SwapChain DXGI_SWAP_CHAIN_DESC swapChainDesc; ZeroMemory(&swapChainDesc, sizeof(DXGI_SWAP_CHAIN_DESC)); swapChainDesc.BufferDesc = bufferDesc; swapChainDesc.SampleDesc.Count = 1; swapChainDesc.SampleDesc.Quality = 0; swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; swapChainDesc.BufferCount = 1; swapChainDesc.OutputWindow = wnd; swapChainDesc.Windowed = TRUE; swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; //Create our SwapChain hr = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, NULL, NULL, NULL, D3D11_SDK_VERSION, &swapChainDesc, &SwapChain, &d3d11Device, NULL, &d3d11DevCon); //Create our BackBuffer ID3D11Texture2D* BackBuffer; hr = SwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&BackBuffer); //Create our Render Target hr = d3d11Device->CreateRenderTargetView(BackBuffer, NULL, &renderTargetView); BackBuffer->Release(); //Describe our Depth/Stencil Buffer D3D11_TEXTURE2D_DESC depthStencilDesc; depthStencilDesc.Width = Width; depthStencilDesc.Height = Height; depthStencilDesc.MipLevels = 1; depthStencilDesc.ArraySize = 1; depthStencilDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; depthStencilDesc.SampleDesc.Count = 1; depthStencilDesc.SampleDesc.Quality = 0; depthStencilDesc.Usage = D3D11_USAGE_DEFAULT; depthStencilDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL; depthStencilDesc.CPUAccessFlags = 0; depthStencilDesc.MiscFlags = 0; //Create the Depth/Stencil View d3d11Device->CreateTexture2D(&depthStencilDesc, NULL, &depthStencilBuffer); d3d11Device->CreateDepthStencilView(depthStencilBuffer, NULL, &depthStencilView); //Set our Render Target d3d11DevCon->OMSetRenderTargets(1, &renderTargetView, depthStencilView); } void MyDxPanel::initScene() { //Compile Shaders from shader file hr = D3DX11CompileFromFile(L"Effects.fx", 0, 0, "VS", "vs_4_0", 0, 0, 0, &VS_Buffer, 0, 0); hr = D3DX11CompileFromFile(L"Effects.fx", 0, 0, "PS", "ps_4_0", 0, 0, 0, &PS_Buffer, 0, 0); //Create the Shader Objects hr = d3d11Device->CreateVertexShader(VS_Buffer->GetBufferPointer(), VS_Buffer->GetBufferSize(), NULL, &VS); hr = d3d11Device->CreatePixelShader(PS_Buffer->GetBufferPointer(), PS_Buffer->GetBufferSize(), NULL, &PS); //Set Vertex and Pixel Shaders d3d11DevCon->VSSetShader(VS, 0, 0); d3d11DevCon->PSSetShader(PS, 0, 0); D3D11_BUFFER_DESC indexBufferDesc; ZeroMemory(&indexBufferDesc, sizeof(indexBufferDesc)); indexBufferDesc.Usage = D3D11_USAGE_DEFAULT; indexBufferDesc.ByteWidth = sizeof(DWORD) * indices.size(); indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; indexBufferDesc.CPUAccessFlags = 0; indexBufferDesc.MiscFlags = 0; D3D11_SUBRESOURCE_DATA iinitData; iinitData.pSysMem = index; d3d11Device->CreateBuffer(&indexBufferDesc, &iinitData, &fbx_index_buf); d3d11DevCon->IASetIndexBuffer(fbx_index_buf, DXGI_FORMAT_R32_UINT, 0); D3D11_BUFFER_DESC vertexBufferDesc; ZeroMemory(&vertexBufferDesc, sizeof(vertexBufferDesc)); vertexBufferDesc.Usage = D3D11_USAGE_DEFAULT; vertexBufferDesc.ByteWidth = sizeof(Vertex) * verts.size(); vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; vertexBufferDesc.CPUAccessFlags = 0; vertexBufferDesc.MiscFlags = 0; ///////////////**************new**************//////////////////// D3D11_SUBRESOURCE_DATA vertexBufferData; ZeroMemory(&vertexBufferData, sizeof(vertexBufferData)); vertexBufferData.pSysMem = positions; hr = d3d11Device->CreateBuffer(&vertexBufferDesc, &vertexBufferData, &fbx_vert_buf); //Set the vertex buffer UINT stride = sizeof(Vertex); UINT offset = 0; d3d11DevCon->IASetVertexBuffers(0, 1, &fbx_vert_buf, &stride, &offset); //Create the Input Layout hr = d3d11Device->CreateInputLayout(layout, numElements, VS_Buffer->GetBufferPointer(), VS_Buffer->GetBufferSize(), &vertLayout); //Set the Input Layout d3d11DevCon->IASetInputLayout(vertLayout); //Set Primitive Topology d3d11DevCon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); //Create the Viewport D3D11_VIEWPORT viewport; ZeroMemory(&viewport, sizeof(D3D11_VIEWPORT)); viewport.TopLeftX = 0; viewport.TopLeftY = 0; viewport.Width = Width; viewport.Height = Height; viewport.MinDepth = 0.0f; viewport.MaxDepth = 1.0f; //Set the Viewport d3d11DevCon->RSSetViewports(1, &viewport); //Create the buffer to send to the cbuffer in effect file D3D11_BUFFER_DESC cbbd; ZeroMemory(&cbbd, sizeof(D3D11_BUFFER_DESC)); cbbd.Usage = D3D11_USAGE_DEFAULT; cbbd.ByteWidth = sizeof(cbPerObject); cbbd.BindFlags = D3D11_BIND_CONSTANT_BUFFER; cbbd.CPUAccessFlags = 0; cbbd.MiscFlags = 0; hr = d3d11Device->CreateBuffer(&cbbd, NULL, &cbPerObjectBuffer); //Camera information ///////////////**************new**************//////////////////// camPosition = XMVectorSet(0.0f, 3.0f, -8.0f, 0.0f); ///////////////**************new**************//////////////////// camTarget = XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f); camUp = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f); //Set the View matrix camView = XMMatrixLookAtLH(camPosition, camTarget, camUp); //Set the Projection matrix camProjection = XMMatrixPerspectiveFovLH(0.4f*3.14f, (float)Width / Height, 1.0f, 1000.0f); } RenderTimer::RenderTimer() : wxTimer() { } void RenderTimer::Notify() { dxPanel->Refresh(); } void RenderTimer::start() { wxTimer::Start(10); }
    11. dave j

      Assembly language?

      Like Alberth, I skipped 16 bit x86 and went for ARM on an Archimedes, although I'd done 6502 on a Beeb before. If the OP is willing to try ARM rather than x86, a Raspberry Pi would be a good solution. There are lots of tutorials on assembler on the Pi available and the hardware means you can just grab a pointer to the screen buffer and start writing to it.
    12. Yonnji

      Multiplayer-focused Arena TPS game

      New weapon added - shotgun
    13. Gnollrunner

      Switching from Java OpenGL to C++ DirectX 3D

      Do you already have some experience in C++ and/or Direct X, or are you a rank beginner?
    14. SeelenGeier

      Healing during travels in RPG?

      You can always change the cost for the healing to be shared by other (usually more important) skills. The player should have the thought of "should I use my resource for healing or can I survive the next engagement with the health I got?". For example you can have healing cost items looted from monsters that the player can sell for a lot of money if they bring them back to town. The amount of healing would depend on the value of the item which would make every loot be a potential healing item. If the item heals 30% of the unit health but would otherwise sell for enough to hire 3-5 new units, the player will use these sparingly. Of course using Golden statues or non-organic matter might be not suited for healing. Instead you could use biological components like monster parts (tails, wings, intestines, etc.) you looted from wild animals. Or cloth and medicine found from humanoid enemies. Another idea would be to have your healer receive a penalty for healing. This would lead to either less healing or less combat effectiveness for the healer. Or he could use his own health to boost others (e.g. spend 1 point of health to heal 3 points of damage on another unit (except healers)). That would make the player treat healers and healing as a limited resource and he would have to focus more on protecting his healers to keep their health high for future healing. Many games limit healing to infight only (Darkest Dungeon is the best example). This leads to players provoking an easy fight just to heal their troops. I never liked this kind of healing restriction, but having an out-of-fight healing would make many dungeons too easy.
    15. His Majesty, the PrefabI must admit that i’ve been a bit what you could call ‘lazy’ for the past few months. Why is lazy hyphenated? Well, because i’m not really lazy, i just tried to finish a game from 0 knowledge of Unity in under two years, which is not an easy task. I spent a lot of sleepless nights working, had a few burnouts, but one thing ultimately slowed down my progress to almost halt. When i finished most of the mechanics for the game and got to the most important part – making content – i simply couldn’t find any more willpower because of the tedious process involved in making hundreds of enemy waves. I believe someone with better coding skills could make a level editor and finish it much quicker, but with my knowledge, i had to do everything by hand and i kind of lost the motivation. Let’s delve a bit deeper into the problem. One of the things i really love about Unity is use of Prefabs. As someone who is not a programmer by trade, it was easy for me to relate to something drag and droppable, an object with belonging properties that is simple to instantiate and easy to manipulate without much hassle. Two years ago, one of my first questions on Unity Forums was about something that i didn’t even know what is called back then – Nested Prefabs. I couldn’t understand why instantiated objects could have child objects that have child objects who also have child objects can exist in the scene, but not as a Prefab. That pretty much broke my building blocks concept of making a game. Harsh red line reality checkAs you can see, i imagined the waves of enemies to be compiled of squadrons (as well as waypoint and single enemies, about which i wrote in my previous logs) which would be a Prefab object with lots of children objects (singular ships and their engine jets, weapon, tags for missile homing and so on). Unfortunately, Unity supports only one level of vertical nesting in the project, so while an object can have literally hundreds of children, non of them can have their own. Since i read that the Nested Prefabs are something that was planned more than five years ago and not yet in the making i tried a few assets that simulate Nested Prefabs but to no avail. You’ve probably seen the horrible reviews on the Asset Store, most of them are abandoned, buggy, slow or complicated. Since i found no decent asset that will enable me to work the way i imagined, i resorted to the usual workflow of instantiating a Prefab and populating it with components that i needed. The usual get this/set this workflowIt wasn’t too hard for single enemies, all i needed to do was instantiate appropriate objects on designated locations and that’s it. I learned a lot of things in the process, getting and setting the properties of many available components and their variables, the importance of pooling and the way it works, managing performance and so on. I must admit i had more than a handful of situations where i didn’t know how to overcome some of the challenges, but i’m grateful for them since they were an opportunity to learn something new through problem solving. When most of the stuff that make the core of the games look and feel were finished, the harder part of making a game in the true sense of words came. I won’t repeat myself too much, you can read more about my process of making waves in this and this log. In short, instead of dragging and dropping positions where i want the ships to spawn, assign the wanted behavior to each one depending on the wave structure and simply save all that as a prefab i need to: Have specific spawner types. That means single enemy, waypoint enemy and squadron enemy spawner with their locations. Make a specialized movement FSM’s for almost every enemy type that will dictate movement direction and scale of ships and ships’ children. For example, engine jet needs to be a separate object so it doesn’t flash with the ship upon bullet contact but it must be properly rotated and scaled depending on the spawning position and spawner parent of the parent (yeah, even i lost it while reading). Assign more elements to pool which slows down the compilation time and time required to start the game. Instead of pooling one ship with all the needed components i need to pool the ship prefab, jet prefab, weapon prefaband in some cases multiple weapon prefabs so the pool size for ships is actually at least three times the size in terms of object number. I’m fairly certain that it’s better to have fewer objects to instantiate regardless of their complexity (number of components attached). Manually set the spawning position of each ship in the wave. This is the worst part, it got me completely devastated. I need spawners for assigning some general behaviors and general screen position, but all the fine arrangement of ships in the wave must be done by hand. Not completely, but i need to put the ships in the scene so i can get their coordinates, then copy them into the spawning FSM of the squadron. Sure, i need to position the ships with nested prefabs too, but only once and that’s it. Doesn’t sound like much of a fuss, but imagine having hundreds of waves to make with some of them having double digit number of enemies that need to be repositioned upon spawning. Set Position, Set Position, Set PositionI’m sure some people don’t even use prefabs but create instances and populate them on runtime and i presume some more C#-savvy people will find nothing unusual in this and develop their own systems for handling the situation, especially big teams. But i’m neither of those and, for the time being, i really need nested prefabs to finish what i’ve started. Prefabs are great game building blocks that further upgrade great tool that Unity already is and we should be really glad they are taking into account the needs of small or one man teams. I’m anxious to see further improvements that the new prefab system will bring to the table in the future versions. The post Ode to Nested Prefabs from a noob indie dev appeared first on Fat Pug Studio. View the full article
    16. I need advice or tutorial links from anybody that wants to help, but I'm trying to make a game using UWP, DirectX, and C++, because I need it to be able to upload to the Xbox Creators Program, https://www.xbox.com/en-US/developers/creators-program.
    17. Tordin

      Assembly language?

      How i started writing Assembly to my c++ games where just to do those extern "C" void YourFunction(); And then just write that protocol in assembler. After I got a bit more experienced there, I used the disassembly for more hardcore functions and tried to understand what was going on there. that way I got to understand some of that content as well. Besides, I find it very good to look at disassembly sometimes because you can easily learn from whats going on behind the scene. And if you know what goes on behind the scene you can improve on how to write the high-level code. So my advice is basically reverse engineering. Might be time-consuming but it will definitely do the job. And you get to do assembler for games if you chose to. This might not be the best way to code a game or a program. But then again, what is 😃 ?
    18. gaxio

      Assembly language?

      If you want to learn ARM assembly, a Raspberry Pi would probably be a good bet. You can even run your development environment on the machine, which is a big time-saver. But yeah, 16-bit x86 is where I got my start and it's where I return to every now and then. It's a hobby though, and an admittedly masochistic one. You can find tons of info on it but it is 100% obsolete and in no way useful in a modern sense except maybe writing a BIOS bootloader.
    19. Alberth

      Custom size_t

      I don't know how old the Unreal engine is, but that code may pre-date various std:: members by years. So indeed, today you would probably write it different, but existing code doesn't change by itself, likely that code has been "working and stable" for many years already, and attention of the developers is towards other parts of the code. Then there is also the problem of backwards compatibility. Can you be really really sure all old data files that exist at every platform can still be loaded if you change it?
    20. Alberth

      Assembly language?

      Ha! I already skipped DOS 16 bit assembly in the 90s, buying an Archimedes with ARM processor (whopping 8MHz, but out-performing a 386DX 40MHz), and foremost, a nice flat 32 bit address space.
    21. just switch to javascript and webGL to save yerself a few years of headache - my 2 cents. all windows languages/compilers/source code/philosophies are inherently evil, error-prone and time consuming.
    22. Fertile Soil Productions

      Free CC0 3D Modular Assets

      Created a new website containing several 3D modular asset kits at fertilesoilproductions.com Sample images attached: View full story
    23. Fertile Soil Productions

      Free CC0 3D Modular Assets

      Created a new website containing several 3D modular asset kits at fertilesoilproductions.com Sample images attached:
    24. jbadams

      Hard sell and coercive tactics from Unity

      It seems they're now reaching out proactively with the following message: Hopefully the matter is properly resolved and won't be repeated.
    25. jbadams

      Hard sell and coercive tactics from Unity

      It's a very solid technology choice with a good ecosystem around it. I think there are certainly some other very strong contenders (Unreal, Game Maker for certain games, Godot is becoming more established and viable, numerous smaller engines), but unless you have unusual requirements or prefer doing your own low level work I certainly don't think you can go wrong with Unity as a small developer.
    26. devbyskc

      Hard sell and coercive tactics from Unity

      Thank your for sharing this news. I'm currently a hobbyist developer and have been learning and using Unity for a couple years. The reason I chose it was because of its user-friendly licensing, especially as a newbie to game development. I am working full-time overseas as a government contractor and don't have a lot of free-time. However I plan on retiring in another year and start making games full-time to supplement my pension. As noted in your article, I doubt seriously that I will make over the $100K limit. Maybe after a few years hopefully I will. If so, I would definitely upgrade to ensure compliance and additional benefits. As Scouting Ninja said, I am willing to give Unity the benefit of the doubt. It does seem that Unity's marketing department may not have fully vetted the system prior to implementation. As a hobbyist planning on "upgrading" my work, I would hope Unity does fix the problem and from their response they seem to have done so. I don't have plans to change my game engine even though I could easier than say an established small indie studio. But I like Unity, I like the support available, and I like how it works for me.
  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!