• What Do You Need Help With? V8
    1,074 replies, posted
Ok, so I'm planning on making a game on either Source or UE and I'm learning C++. With only the fundaments of C++, can I make a fully developed singleplayer game with lightning, characters, animation, levels, etc?
No. And dont use source, at least not source 1 because its old as shit. You would be better off investing your time into learning how to use UE or learn C# and use unity or learn one of the many other 3d engines that exist.
I'd recommend changing your mindset and goals from Making a game to Learning games work. How experience of a programmer are you? You say you're learning C++, but is this your first language? Are you familiar with any of the common development patterns? Using a premade engine will shorten your project span, but at the same time you'll have to learn how to use the features they set up, and then add your own layer of work on top of that. Further, consider the issue of asset creation - are you going to be able to make the models, textures, sounds, shaders, and maps you'll need? if you're just interested in game development, there's also the route of just learning how game engines work, and making your own purely as an educational means. Along the way you'll surely learn a lot more about the language you chose as well.
Hello there! Please use code tags in the future. It makes things much easier to read. Thanks! You're creating two seperate Player classes. One in MainGame and the other in CharacterCreation. Instead, you should pass your created Player object into the MainGame object.
This isn't as much of a programming question as it is a general UE4 question. I've been looking across Google for a long while and I could never find an answer for it, so I'd be extremely glad for something concrete (please). Does UE4 support Bodygroups á la Source Engine? Am I able to switch parts of a mesh on or off without them being separate .fbx files when importing, or am I lost?
Question regarding multiprocess and multithreaded applications: Assuming you can acquire the number of CPU cores in a system at runtime, would it be better to: Create an array/list of length X, with x being the number of CPU cores, with each element being a thread. When a thread finishes it's task, you either assign a new thread to that element, or wait/sleep that thread. Create a priority queue, where only X amount of threads can be executed simultaneously. When a thread is finished, it decrements the counter of used threads, then pops the next thread from the priority queue. Now another question I have is regarding Python specifically: I know Python's Global Interpreter Lock (GIL) doesn't work well with threads, and some people simply just use multiprocess. If I want a multithreaded/multiprocess application, am I better off: Using only threads, using the thread and threading libraries. Using only multiple processes, using the multiprocessing library. Using a mix of multiprocessing and threading libraries, where one process can utilize multiple threads. Ideally, all the processes would share variables that would limit the number of threads to the number of available CPU cores.
I could be mistaken, but I think the better approach is to pre-generate your list of threads rather than keep creating and destroying them, then have them sit idle/keep checking for work to do.
I've reached a dead end trying to debug a crash, maybe anyone has any ideas I get an access violation at 0xc0000005 in my main thread, which after a couple hours of debugging I found happens after a glDrawArrays call (call stack terminates in the driver I think) This crash happens around 50% of the time, around 100 frames after launch. All ID's are the same, crash or no crash (VAO's, VBO's) The triangle count is ~>43k, and this value is correct whether it crashes or not. The vertex and UV data appears the same in both instances Not a single opengl error occurs, and the gl synchronization fence has completed prior to rendering None of my other threads are even touching any of this model's data, nor are performing any explicit secondary-gl-context functions.
Posting code would help, also just in case have you tried on nvidia if you're using amd or vice versa?
I only have a single workstation with an nvidia card. Model loading (threaded): int Model_Importer::import_Model(const string & fulldirectory, unsigned int pFlags, vector<vec3> & vertices, vector<vec2> & uv_coords) { /** Omitting file exist checks, asset already created, etc **/ Assimp::Importer importer; const aiScene* scene = importer.ReadFile(fulldirectory, pFlags); if (scene) { // cycle through all meshes for (int a = 0, atotal = scene->mNumMeshes; a < atotal; ++a) { const aiMesh *mesh = scene->mMeshes[a]; // cycle through all faces in mesh for (int x = 0, faceCount = mesh->mNumFaces; x < faceCount; ++x) { const aiFace& face = mesh->mFaces[x]; // cycle through all indices in face, make triangle ( pFlags enforces triangulation of mesh ) for (int b = 0, indCount = face.mNumIndices; b < indCount; ++b) { const int index = face.mIndices[b]; // create vertex (our type is glm vec3, assim type is aiVector3D const auto &vertex = mesh->mVertices[index]; const auto &uvmap = mesh->HasTextureCoords(0) ? (mesh->mTextureCoords[0][index]) : aiVector3D(0, 0, 0); vertices.push_back(vec3(vertex.x, vertex.y, vertex.z)); uv_coords.push_back(vec2(uvmap.x, uvmap.y)); } } } } return 1; } GL state setup: /** IN SECONDARY CONTEXT (threaded) **/ auto &data = m_asset->m_dataVertex; // vector of vertex data in snippet above auto &uv_data = m_asset->m_dataUV; // vector of uv data in snippet above auto &buffers = m_asset->m_buffers; // GLuint array[2] const size_t &arraySize = data.size(); glGenBuffers(2, buffers); glBindBuffer(GL_ARRAY_BUFFER, buffers[0]); glBufferData(GL_ARRAY_BUFFER, arraySize * sizeof(vec3), &data[0][0], GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, buffers[1]); glBufferData(GL_ARRAY_BUFFER, arraySize * sizeof(vec2), &uv_data[0][0], GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); m_asset->m_fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); glFlush(); /** IN PRIMARY CONTEXT (main thread) **/ glBindVertexArray( vaoID ); // vertex array object ID glBindBuffer(GL_ARRAY_BUFFER, m_buffers[0]); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, m_buffers[1]); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, 0); glBindVertexArray(0);
I've updated my assimp to no avail, and then found they had a sphere model which didn't crash my application. I updated Blender, recreated the mesh, and now the problem has gone away. Hopefully the issue doesn't come back.
Do you guys have any book recommendations on Modern OpenGL and 3D/Game Engine programming for someone who has done considerable amount of programming in other domains but has little to no clue about graphics programming stuff?
Asking all C# gurus here..; is it possible to 'virtually' downsize array in C#? I wish to keep array size fixed (2^16), but I wish that array.Length property would be variable (but not bigger than 2^16). Is there any Reflection magic I can use? Point is, some function wants array as input, which is identity array (array[i] = i), but I can't input length of the array, since function reads array.Length property. Which is lame.
I can't provide books, but there are a plethora of online resources for free. Everything I've learned has been through various websites, blogs, papers, youtube videos. Additionally, many people here and on stackoverflow have provided great help over the years. Over the past 3-4 years I've accumulated way too many bookmarks on the subject, but here's a few key resources that may help OGLdev - A tutorial series that explains the topics and goes over the code, also provides source files for every tutorial https://learnopengl.com/ - A favorite of mine and a place I refer back to many times. Has a section for most important topics (if not all) OpenGL-tutorial - another tutorial series, also provides pictures and explanations Mainly, you want to avoid material that uses the fixed function pipeline and any other old deprecated material, leaving you with anything greater than opengl 4.0.
With OGL, textbooks aren't your best bet. With Vulkan, yeah... but that's because there's not a ton of good online resource yet. The resources already recommended are great. Otherwise, hope in the programming discord channel and feel free to ask more. Lots of good articles and content from single blog posts that's also worth reading, but it's hard to remember to save those. Once you get the basics down, I'd recommend using direct state access: it lowers driver overhead, and then you can avoid that fucking stupid glBind bullshit. Best resource for that is: https://github.com/Fennec-kun/Guide-to-Modern-OpenGL-Functions And the OpenGL reference guide for the relevant functions. that and playing around with it. feel free to dm me if you find me on discord too, I'm always happy to help: just fair warning
Thanks peeps, really useful resources right there. Graphics programming seems really hard and will take me a lot of dedication to get handle of. I wanted to ask, what is the market supply of programmer like in gaming industry these days? Fields like OS, compiler, security, web, mobile engineering seem to be flooded with people these days - what about graphics? Is there more than enough developers or does companies seem to beg for skill because of lack?
This might be a bit of a long shot, since I'm not sure how much this overlaps with C# or if it's even possible, but can you do type constraints for all types that an overloaded function can take? I have the following function, which is trying to be able to use any type that can be used in NetOutgoingMessage.Write (all primitives, and some others like String). For reference, the function is just the following, not sure what to put for the when if its even possible. let inline write<^a when HEREHELP> (value: ^a) (message: NetOutgoingMessage) = message.Write value message Which in C#, would probably be something like this (I don't know C# well, so might be wrong). [MethodImpl(MethodImplOptions.AggressiveInlining)] public NetOutgoingMessage Write<T>(T value, NetOutgoingMessage message) where T : HEREHELP { message.Write(value); return message; }
This might not be the right thread for this question, but does anyone know where I can find good C/C++ tutorials? I was thinking about getting into it (for a number of foolhardy reasons), and wanted to know if there were any good tutorials for absolute strangers to the language.
What other languages are you familiar with? If you're familiar with Java, the transition time was fairly short for me. Any time I come across something I'm uncertain of, I just google it. An unrelated question: Does anyone know how abouts any techniques for projecting a 2D texture onto a cubemap texture, given a directional vector? Kinda like how you would use your phone's camera to generate a panorama.
Yeah I've used panoramic 2D maps for environment mapping a while ago, can't remember the exact maths but basically if you translate the direction vector into spherical coordinates or something you can get the UVs to sample the 2D texture.
A good book will probably be the best bet, I have not encountered a good C++ tutorial that does even most things right. c++ faq
I can't figure out the maths to this yet and I can't find any relevant hits online for what I'm trying to do I'm trying to project a flat texture representing what the user sees, onto the appropriate place in a cubemap. I think I need to create a shader to run over all the faces of the cubemap, and calculate within the texture coordinates to use for sampling this 2D texture
Okay I solved my issue. I knew how to calculate UVW coordinates for a cubemap, such as when trying to render a sky. I figured there might be a way to use that with some math to create unique UV coordinates per pixel, where some would be in the range of the 2D texture but the majority wouldn't. Instead I had a eureka moment and figured out a better solution (or at least something that works for now) I now render a quad for each of the six cameras/sides of the cube map. The quad has the texture I want to map, so in the vertex shader I re-orient the quad so it appears where it should in world. This was done by undoing the perspective and view matrices of the original camera, bringing the quad out to the far plane and inversing the camera's rotation. Then it is multiplied by the cubemap camera's rotation matrix and projection. I suck at explaining things, but it works. In the following picture I took a quick spin around in 1 spot and this was the result. I plan on using this as a last ditch environment map to fall back on in my reflection shader. https://files.facepunch.com/forum/upload/582/a24531f1-3b4b-4a8d-9d8b-dc5a01ca27f2/image.png
I generally agree with you. However, there is an exception that I know of. It is this tutorial: http://www.learncpp.com/ I need to say, as a disclaimer, that I am still learning C++, at the moment, from this site. So, you should take my opinion with a grain of salt. It is very well written, it explains things in great detail while presenting the information in a way that is easy to understand for complete beginners. I also like that it isn’t just about coding; rather, it also teaches you good programming practices and provides good arguments for why they are good practices, with examples of bad code (bad practices) and the problems it can lead to. It is structured very much like a book. It has been around since 2007, I believe, but it is updated very often. I find new updates almost every month. @HolySnickerPuffs
Don't forget the bonuses of learning how to write clean code as well. After you have learned the basics of C++ of course. While this basically applies to most languages, I think it counts more for C++ due to being quite more challenging than most other languages out there. You'd be surprised at how you can clean up your code if you use delegates to write an event-based program. I think that most of the difficulty of C++ comes from beginners not writing clean code, messy C++ code has the tendency to blow up. I started learning C++ 5 years ago but I feel like I didn't know how to write good C++ code before I learned how on my internship. Knowing certain type of code cleanliness 'optimizations' also exposes you more to parts of C++ you'd otherwise never use. Sadly I don't know of any online tutorials that specifically deal with this topic, but maybe I should investigate some time.
None of them. I just learned HTML back in December, but that's a far different beast so I'm sure it wouldn't help. Alright. I'll look into these. Thanks, guys!
If you have absolutely no previous programming skills, then you should definitely check out Bjarne Strostrup's book; it is aimed at complete beginners, and his style of conveying information is amazing. I really regret that I stopped reading that book. Bjarne Stroustrup is the scientist that created C++, btw. Here's a link with information on the book on his site. Stroustrup
I'm working on optimizing my engine a bit today, and I decided to actually look more into DSA I got a question about DSA in openGL in general that I haven't been able to find out online I frequently see examples where 3 LOC are replaced with a single one, such as: glBindTexture(GL_TEXTURE_2D, id); // bind glTexImage(GL_TEXTURE_2D, ... ); glBindTexture(GL_TEXTURE_2D, 0); // unbind glTextureImage2DEXT(handle, GL_TEXTURE_2D, ...); Where this second code block is equivalent to the first block But how does this stack up when doing multiple lines with DSA? For example, consider adding several texture parameter calls between the glTexImage call and the texture unbinding. If using pure DSA versions, each line would be equivocally binding and unbinding. Is that still faster than the old fashion way?
Why do you think the two are equivalent? I can't find anywhere saying that DSA is just a wrapper for binding and unbinding. When you write glBindTexture what happens is that under the hood OpenGL says currentTexture = id and then whenever you modify the parameter via glTexParameter it goes parameter[currentTexture][paramater] = value. When you say glTextureParameter it instead goes parameter[id][parameter]. There's no change of the currentTexture's state, because it is not part of the equation at all. Also why the EXT? DSA is part of the 4.5 core profile.
I was under the impression that it was kind of like a wrapper but on the driver level, so each call was effectively like having a bind and unbind done for you
Sorry, you need to Log In to post a reply to this thread.