[QUOTE=paindoc;51813243]The best argument for separating the two is compile time, in my experience. My project at work is getting huge, and some of the files I wrote long ago have most of the implementation in the header. A good chunk of these are classes I use all over my program, and changing these means the next compile is a lot slower.
Otherwise, when it comes to inlining, the compiler should be smart and usually overrides our choices. There is the "__forceinline" tag in MSVC, so you could play with that and see what happens with your virtual classes and such? I've only used it for intrinsic operations.[/QUOTE]
Thankyou! I definitely should've considered this. I have quite a few header-files for classes that all include my completely header-implemented XML code for a deserialization constructor (taking in an XML node reference). It was taking longer than usual when making slight alterations to these .h files to compile. I'd rate allot of comments on here helpful, but I can't probably because I don't have enough posts :'-C
I just trawled through over 8000 lines of code to find exactly one minor syntax error in a usage of std::find that broke literally everything in my code. I know the library isn't broken, don't lie to me about line 3258 in xutility being the error, VS. I know that shit ain't broken. No, all it took was one minor syntax error breaking one usage of std::find in a way the compiler couldn't figure out because it looked legit still but obviously wasn't.
:(
[QUOTE=Trebgarta;51814901]The new community discord is already overpopulated
Having 20 text channels is counterproductive, this is good
Though programming is often deader than others due to reasons but w/e, I think discords are fine[/QUOTE]
waywo in general is counterproductive, what is your point
[editline]13th February 2017[/editline]
before you jump on me, think of all the time you could be coding instead of sitting your asses here
[editline]13th February 2017[/editline]
ahh fuck me why what I am doing here I have exam tomorrow
[editline]13th February 2017[/editline]
help
[QUOTE=F.X Clampazzo;51815087]I just trawled through over 8000 lines of code to find exactly one minor syntax error in a usage of std::find that broke literally everything in my code. I know the library isn't broken, don't lie to me about line 3258 in xutility being the error, VS. I know that shit ain't broken. No, all it took was one minor syntax error breaking one usage of std::find in a way the compiler couldn't figure out because it looked legit still but obviously wasn't.
:([/QUOTE]
That's one thing I seriously dislike about template usage in VS, it seems to always report the error as being in the templated header file rather than maybe the line where its become apparent to the compiler a function/class needs to be created with the template type parameters. Also, in VS2015 (at least in my experience) C++ name refactoring doesn't seem to affect usage in lambas. And I'd rather not do a find and replace all and hope for the best.
Well to be fair every compiler spews the error up from the point of error (i.e. when the error actually occurs) to the code that calls it erroneously. Cutting out all the in between steps can be bad because then it doesn't produce an actual trace, and showing all the steps can result in hundreds of lines of errors that most people don't know how to interpret. Hence why we have been praying for concepts for the last 20 years. Another way to reduce the spew is to write template code that errors out on incorrect templates early, but it can be really hard and also really annoying. Sometimes it's impossible to know that there will be an error until all the instantiation is done.
I've been working on writing a web server thing that uses Lua - So far I've got it working, with basic functionality such as query strings.
I need to make the query strings a proper lua table though - right now it's just two arrays with matching indexes
[t]http://i.imgur.com/tSQWS0z.png[/t]
[media]https://www.youtube.com/watch?v=8_yOQA6uVTY[/media]
Now it loads in mipmap levels progressively, with a debug texture for materials I haven't implemented yet.
[editline]13th February 2017[/editline]
[img]http://files.facepunch.com/ziks/2017/February/13/frametimes.png[/img]
:dogwow:
[QUOTE=Trebgarta;51817154]If I werent shitposting on FP I would be shitposting on Discord, if not that Id be playing video games, further down the list is coding finals, at the bottom is hobby projects
For example, 3 days ago my final assignment got published and I wrote 0 lines of code. I dont even know what it is about[/QUOTE]
I am enrolled in a Web API course.
I have gone to one lecture.
I have a 100% in the class. :v:
Well anyway I released the lil memory game android app I made.
It would be cool if anyone wants to [url=https://play.google.com/store/apps/details?id=com.qtom.pathfinder]give it a try[/url] so it can be tried on a few different devices. It's not particularly good but it was an interesting exercise to find out how it all works. Just gotta try and come up with some better app ideas now.
Disclaimer: it has ads, but hopefully they aren't too annoying.
Verideth asked me to post a link to his project: [url]https://github.com/Verideth/Voxel/[/url]
[quote=Verideth][img]http://i.imgur.com/jVmsQxi.png[/img][/quote]
It would be nice if someone more versed in C++ than me could have a look at it and give some feedback.
Valve are apparently thinking of putting up the submission fee for steam direct up to $5000
If this happens, that's RIP my game for me, there's no way I could ever afford that, and I'm unwilling to put this on kickstarter or accept money for it in its current state (which would be difficult anyway, greenlight would have been easier as I know the melee combat game community well), particularly because I really want to give it away for free
Sad times. Might be time to get a real job (the horror)
This rework seems way too counterproductive, really.
it won't be $5000, and there are other avenues for distribution if you want to give it away free
Woo, I got CUDA to play nice with OpenGL! I use a simple demo that currently visualizes clusters of the GPU's CUDA cores by assigning them a random color (each 32x32 square = one block, in overall "grid"):
[t]http://i.imgur.com/YOerGZ7.png[/t]
Further, I don't use the fucking pixel buffer directly (thank god) and it otherwise works like most modern OpenGL applications. Here, I'm just using a simple vertex passthrough shader and a fragment shader that reads from the OpenGL/CUDA shared texture. I haven't done speed comparisons, but it should be 2-3x faster according to a number of stack overflow answers about this topic.
At the least, it should make implementing CUDA-accelerated items elsewhere easier. This process isn't easier to setup than the examples, but it only has to be done once instead of every frame. Its more flexible too, since you can specify more about the type of resource/texture CUDA will be working with: (example code)
[cpp]
// texture and pixel objects
GLuint pbo = 0; // OpenGL pixel buffer object
GLuint tex = 0; // OpenGL texture object
struct cudaGraphicsResource *cuda_pbo_resource;
void render() {
uchar4 *d_out = 0;
// Map/bind resource to CUDA
cudaGraphicsMapResources(1, &cuda_pbo_resource, 0);
// Get Pointer to CUDA/OpenGL shared resource
cudaGraphicsResourceGetMappedPointer((void **)&d_out, NULL,
cuda_pbo_resource);
// Launch CUDA kernel
kernelLauncher(d_out, W, H, param, sys);
// Unmap/unbind resource from CUDA
cudaGraphicsUnmapResources(1, &cuda_pbo_resource, 0);
// update contents of the title bar
char title[64];
sprintf(title, "Stability: param = %.1f, sys = %d", param, sys);
glutSetWindowTitle(title);
}
void initPixelBuffer() {
glGenBuffers(1, &pbo);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);
glBufferData(GL_PIXEL_UNPACK_BUFFER, 4 * W*H*sizeof(GLubyte), 0,
GL_STREAM_DRAW);
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
cudaGraphicsGLRegisterBuffer(&cuda_pbo_resource, pbo,
cudaGraphicsMapFlagsWriteDiscard);
}
[/cpp]
Its kind of a pain to use, and using the Pixel buffer like that kinda restricts what you can do with your OpenGL context. It also forces a remap and unmap every frame, which is fairly costly, and doesn't need to be done each frame (it turns out, as of CUDA 3.5). In fact, with some careful calls to CUDA device functions, you don't even have to worry about binding/unbinding the texture from OpenGL either. So long as you call cudaDeviceSynchronize(), execution will wait until the CUDA kernel completes and finishes writing to the texture. Without this call, things can get asynchronous and messy really fast. I'm sure this is less than ideal for every situation, but it's working atm.
Here's how I initialize CUDA in my application:
[cpp]
void Context::CUDA_Initialize(){
// Attempt to register OpenGL resources with CUDA
cudaError_t err = cudaSuccess;
err = cudaGraphicsGLRegisterImage(&CUDA_Texture, Texture, GL_TEXTURE_2D, cudaGraphicsRegisterFlagsSurfaceLoadStore);
cudaAssert(err);
// Map the resource
err = cudaGraphicsMapResources(1, &CUDA_Texture, 0);
cudaAssert(err);
// Bind texture to array
err = cudaGraphicsSubResourceGetMappedArray(&CUDA_Array, CUDA_Texture, 0, 0);
cudaAssert(err);
// Unmap the resource, now that we've bound it to the array
err = cudaGraphicsUnmapResources(1, &CUDA_Texture, 0);
cudaAssert(err);
// Setup resource description object and bind the CUDA Array to it
struct cudaResourceDesc rsrc;
// Zero-initialize the resource description
memset(&rsrc, 0, sizeof(rsrc));
rsrc.resType = cudaResourceTypeArray;
rsrc.res.array.array = CUDA_Array;
// Now set up the surface object, which is what the kernels will write to.
CUDA_Surface = 0;
// Second argument is resource description, third argument can be a cudaTextureDesc
// describing how to interpret the texture along with any extra parameters that may come up
// (filtering, border color, mipmaps, sRGB conversion, etc)
err = cudaCreateSurfaceObject(&CUDA_Surface, &rsrc);
cudaAssert(err);
}
[/cpp]
And the rendering loop for this setup just goes as:
1. Get time between current and last frame, pass it to the CUDA kernel and execute the kernel
2. Some kind of waiting for the kernel to execute
3. Usual OpenGL rendering loop from here
There were two big problems I had: one was that all of the examples were either old and deprecated, new-ish but used mixes of the CUDA driver API (deprecated) and modern OpenGL, or used Modern OpenGL + CUDA Runtime API but in a way that was just short of what I needed. The other big problem was that for a while, launching the CUDA debugger killed my main monitor. It just disappeared as a valid display adapter, and would not reconnect and work until I restarted my computer. Wtf CUDA?
I need to do more experimentation with this, but I also feel like I need to actually tidy up my blog and publish an article on this topic. I don't feel like this topic was covered ANYWHERE I looked, and nothing was ever explained. It took most of my weekend, and really just sucked for most of that, so I'd like to save people the trouble of dealing with that.
[QUOTE=Tamschi;51817902]Verideth asked me to post a link to his project: [url]https://github.com/Verideth/Voxel/[/url]
It would be nice if someone more versed in C++ than me could have a look at it and give some feedback.[/QUOTE]
If you're trying to make a game engine, I can let you know some things that were relevant for me
At the moment you only have the notion of there being one camera. Make the camera publicly accessible, and provide it to the renderer when rendering. Even better would be to wrap up a camera with renderables and pass it into the renderer. This allows you to easily render the same thing multiple times from different perspectives
Camera input is also tied to rendering. Its not extensible, as a game based on your renderer has to modify the engine to have different controls. Consider passing your controls into the renderer as a function and provide defaults, or completely divorce controls from rendering
Use quaternions and rotation matrices. Euler rotations are not ok. Its worth learning the complexity of quaternions to avoid the massive clusterfuck of euler rotations. You will run into issues, and 4 years later I regret picking euler rotations rather a lot, I had to convert most of everything to quaternion rotation later down the line. I spent far too long putting off learning about them, and had to do lots of stuff the hacky shit way. PS also probably don't use degrees, everything takes radians
If you really have to write a vector library, don't write a hardcoded vec3 class. Write a vec<num, underlying_type> class and template the whole thing and use loops. A bit more effort to write, but you won't regret it. I now use mine for things other than simple 3 element float classes, like integer bounds just because I can. But if you need a simple vec2 class then you're boned
[cpp]void Vec3::Normalize()
{
float len = Length();
if (len != 0)
{
[/cpp]
Len != 0 won't work (how you want it to). Length can return a small enough value that will still cause issues but won't be 0. I don't know what the actual minimum value you need to check against is, its not epsilon, but it might be worth setting a low arbitrary bound if you can't figure out the exact value (Edit: Maybe like, ceil(1./FLT_MAX)?)
[cpp]
void Vec3::ChangeX(float xPos)
{
x = xPos;
}
[/cpp]
ChangeX is a little... this is maybe more of a stylistic thing, but I'd name this SetX really
I would personally not implement a Change function that sets the xyz components, but instead implement operator=. This way you can say vec = {1, 2, 3}, which is excellently useful and solves my usecases more nicely than vec.change(1,2,3). I personally implement component access as T& vec::X(){return v[0];} which means I can do vec.x() = 12, however this is a taste thing probably, although personally I think this is significantly clearer
[cpp]Vec3 Vec3::CrossProduct(const Vec3& vec2)
{
return Vec3();
}
[/cpp]
You're probably just getting around to implementing this, but i super don't advise leaving an implementation blank like this. Static_assert here at least
[cpp]inline vec3f cross(const vec3f& v1, const vec3f& v2)
{
vec3f ret;
ret.v[0] = v1.v[1] * v2.v[2] - v1.v[2] * v2.v[1];
ret.v[1] = v1.v[2] * v2.v[0] - v1.v[0] * v2.v[2];
ret.v[2] = v1.v[0] * v2.v[1] - v1.v[1] * v2.v[0];
return ret;
}[/cpp]
Where 0/1/2 are x/y/z, for reference, although you can probably figure this one out its not hard
You've also implemented operator/ and operator /= separately which means code duplication. You might implement operator /= as return *this / num so that you have exactly the same semantics between them
[cpp]Vec3::Vec3(float xPos, float yPos)
{
x = xPos;
y = yPos;
z = NULL;
}[/cpp]
NULL should probably be 0 here. NULL is for pointers
[editline]13th February 2017[/editline]
[QUOTE=No_0ne;51817961]it won't be $5000, and there are other avenues for distribution if you want to give it away free[/QUOTE]
Not if I want anyone to actually play my multiplayer-only game. Valve *are* considering up to $5000
[QUOTE=Icedshot;51817994]
Not if I want anyone to actually play my multiplayer-only game. Valve *are* considering up to $5000[/QUOTE]
You're over-reacting. Reread the news post. They only said $5,000 as an example of what some developers had told them. They acknowledged [b]in the post[/b] that $5,000 was "high".
It's not going to be $5k.
Valve is fucking stupid if they put Direct's cost to $5000
I do not think they are that stupid.
Who knows, maybe it's based off of the individual game and not just one cost for every game?
[QUOTE=Icedshot;51817994][...]
Use quaternions and rotation matrices. Euler rotations are not ok. Its worth learning the complexity of quaternions to avoid the massive clusterfuck of euler rotations. You will run into issues, and 4 years later I regret picking euler rotations rather a lot, I had to convert most of everything to quaternion rotation later down the line. I spent far too long putting off learning about them, and had to do lots of stuff the hacky shit way. PS also probably don't use degrees, everything takes radians
[...][/QUOTE]
Doesn't he only use rotations for the camera right now?
For an FPS camera, Euler angles are appropriate and even preferable (since they won't drift, represent the control scheme perfectly and you can build the resulting matrix faster (if you construct it manually, at least)).
[QUOTE=geel9;51818037]You're over-reacting. Reread the news post. They only said $5,000 as an example of what some developers had told them. They acknowledged [b]in the post[/b] that $5,000 was "high".
It's not going to be $5k.[/QUOTE]
Valve's MO is to gauge community reaction by not committing to something, and then seeing what the response is like to them putting out information. They've given a clear lower and upper bound, and IMO they're simply trying to see what people think is reasonable as they haven't committed to anything yet, which means its totally possible that they might stick it up that high
Edit:
[QUOTE=Tamschi;51818041]Doesn't he only use rotations for the camera right now?
For an FPS camera, Euler angles are appropriate and even preferable (since they won't drift, represent the control scheme perfectly and you can build the resulting matrix faster (if you construct it manually, at least)).[/QUOTE]
Well, none of the vector library supports any kind of quaternion operations, so I suspect they are using euler rotations out of convenience like I did initially
Its actually faster to turn quaternions into a rotation matrix than it is to turn euler angles into a rotation matrix (as far as i can tell)
[url]https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles#Rotation_matrices[/url]
[url]https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix[/url]
No trig for quaternions, roughly equivalent in other respects
As for drift... If you accumulate into euler angles, I guess thats probably more accurate than accumulating quaternion rotations, but I can't see it being noticably different? I guess it might be an issue over the long term
Also euler angles only represent the control scheme perfectly in some cases. If you want to step out of the traditional you might run into issues, or if you want to slerp your camera between two predefined points you're fucked. It also allows you to rotate your camera around arbitrary axis (super useful) as axis angle converts super duper easily to quaternions
What really annoys and concerns me about Steam direct is this is basically the result of dickheads using Greenlight in the past for easy money and shit and it's basically potentially punishing anyone in the future who have a genuine passion of game development who want to release a a decent game simply because of the actions of people in the past, I mean it's not fair if they make it harder for someone with virtually no money like myself to struggle to release a game because some games like fucking bear simulator managed to get massive kickstarter funding and instant greenlight because people were to retarded to realise the guy like many other people are on there for easy money and they fucking support this shit with no evidence of actual work on their game.
Seriously that bear simulator game the dev shoes videos of him downloading models from fucking turbosquid for gods sake.
I'm actually quite okay with Valve's approach. As sad as it as it is for Steam's original rep of always having at least quality games on there, their discovery tools have drastically improved. Plus there's the refund system. There's no way I'll ever be stuck with a bad game, hell I don't even see them pop up on my frontpage or discovery queue. So why care about the trash? Consumers who burn themselves on bad games or kickstarters will learn to be more critical too.
The way I see it if you have a good concept and a fun prototype you shouldn't be concerned with whether or not you can get your game on steam. Hells, if you can't afford the price to get on steam then kickstarter would be an excellent alternative especially if you're only asking for the cost of getting it on the steam platform.
This will hopefully keep the trash off of Steam.
[QUOTE=false prophet;51818486]The way I see it if you have a good concept and a fun prototype you shouldn't be concerned with whether or not you can get your game on steam. Hells, if you can't afford the price to get on steam then kickstarter would be an excellent alternative especially if you're only asking for the cost of getting it on the steam platform.
This will hopefully keep the trash off of Steam.[/QUOTE]
This won't keep the trash off of steam at all in my opinion. If you're willing to pay $100 currently to get your trash game on steam just to "troll" people, you think a $500 will make it any different? All it does is it stops people without money to publish games.
Money is not a replacement for quality control.
And in my opinion, the current 30% cut from steam is ridiculous. But that's another story.
Note to self: Don't accidentally save over a version of the map which took a whole day to build, forcing me to rebuild large parts of it
Now the map is in version control. I'm never making that mistake again, jesus christ
[IMG]https://dl.dropboxusercontent.com/u/9317774/maaaaap.PNG[/IMG]
Ah well. There's the rebuilt map now (unfinished, but good enough for me to start other things). I changed up the rock layout to be a little more interesting than the original at least, and added a little decoration here and there
Getting the ground to look right is going to be a big challenge. I might use normal mapping to add some high frequency detail, as well as produce a higher res mesh, then map heights to colours (lowest in a triangle wins) to try and produce an astroneer-like ground mesh. It will probably end badly, but here's to trying things. I also need to figure out what to do with the rocks, the green doesn't look right at the moment but it may be due to the uncoloured ground
I'm redesigning a lot of my asset loading backend to support bindless textures going forward
At this point all of the meshes in 1 model are merged into a single VAO and rendered in 1 call, improving my performance substantially
Also improved my asset loading time quite a bit - turned out I was doing a lot of inefficient things
[t]http://i.imgur.com/MyQOqmg.png[/t]
Now I just need to figure out how to actually use bindless textures :v:
[QUOTE=Icedshot;51818047]Well, none of the vector library supports any kind of quaternion operations, so I suspect they are using euler rotations out of convenience like I did initially[/QUOTE]
Right, I was just pointing it out for the special case.
[QUOTE]Its actually faster to turn quaternions into a rotation matrix than it is to turn euler angles into a rotation matrix (as far as i can tell)
[url]https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles#Rotation_matrices[/url]
[url]https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix[/url]
No trig for quaternions, roughly equivalent in other respects[/QUOTE]
It's faster if you already have a single quaternion, yes.
If you start with split components (more on that in the next part), you'd still have to (partially) multiply them together so the work would likely be equivalent or larger if you convert them immediately.
[QUOTE]As for drift... If you accumulate into euler angles, I guess thats probably more accurate than accumulating quaternion rotations, but I can't see it being noticably different? I guess it might be an issue over the long term[/QUOTE]
There are a few degrees of freedom that can drift with quaternions:
- scale
- (in the case of an FPS camera) roll
- 3 times 'skew' (in which the world twists and scales around one of the axes)
Quaternion normalisation can be approximated as described [URL="http://stackoverflow.com/a/12934750/410020"]here[/URL], but you additionally have to clamp the camera from looking too far up or down which I'm almost certain requires proper normalisation.
That said, what might make sense is using imaginary numbers for (some of) the individual axes.
If you represent the yaw axis like that, you'll have to normalise it, but you don't have to clamp it. (The trig functions stay but are moved into input processing.)
[editline]edit[/editline] I have a suspicion that two subtractions and two well-predicted clamp-branches are going to be faster than approximate normalisation (two multiplications, and addition, two divisions (or one inverse and two multiplications)), though.
You [I]could[/I] do this with pitch too, but it only makes clamping more complicated (and adds normalisation for frames that don't get clamped) and you still need trig to apply input.
[QUOTE]Also euler angles only represent the control scheme perfectly in some cases. If you want to step out of the traditional you might run into issues, or if you want to slerp your camera between two predefined points you're fucked. It also allows you to rotate your camera around arbitrary axis (super useful) as axis angle converts super duper easily to quaternions[/QUOTE]
For rotating the camera independently of the FPS controls, I'd parent them to that rotation so they still work as expected.
If you want to slerp it (you [I]really[/I] shouldn't with an FPS camera, since that usually represents [URL="https://youtu.be/RE4ixlVNGF8?t=3m19s"]unnatural head movement[/URL]), you can always transition it into a different state for a scene too.
All this is only for handling the values internally, of course.
As soon as you need them otherwise, you should process them into quaternions and/or a matrix only once that frame (but it's of course more efficient to wait with that last part until after you've multiplied any consecutive quaternions).
Any news on what "steam direct" will be like for VR devs? Still free or not?
I started this project just over 24 hours ago,
I finally got a loading 'nearby' client list on a web browser
[t]https://jii.moe/H1gUdXlKe.png[/t]
--edit
it lives
[vid]https://jii.moe/SJbdaXlFl.webm[/vid]
I didn't expect AABB collision detection to be so easy to implement in a 3D world.
[edit] left two words out
[QUOTE=cartman300;51818622]This won't keep the trash off of steam at all in my opinion. If you're willing to pay $100 currently to get your trash game on steam just to "troll" people, you think a $500 will make it any different? All it does is it stops people without money to publish games.
Money is not a replacement for quality control.
And in my opinion, the current 30% cut from steam is ridiculous. But that's another story.[/QUOTE]
Greenlight was a one time $100 fee letting you submit as many games as you want, Direct will have a fee per submission
Sorry, you need to Log In to post a reply to this thread.