[QUOTE=daigennki;52158444]Looks like one of my header files still had "using namespace std;". Removed it and now using "std::" instead, but the memory leaks have still not been fixed at all. No exceptions thrown either. This is a weird one, I am entirely unsure how memory leaks are happening here either...
[del]Should I be concerned about the performance too? I have not even gotten to 3D rendering yet and it has >15% CPU usage according to task manager, and the framerate is not even 60 fps, flying all over the place but averaging around 45 fps. Framerate seems to drop and CPU usage seems to increase whenever more 2D polygons are drawn with OpenGL, maybe my drawing functions are inefficient?[/del] Looks like I was right, drawing functions were inefficient, I was converting SDL surfaces to OpenGL textures every frame rather than just once. Made it load images as OpenGL textures from the start, now works very smoothly.[/QUOTE]
Quick follow up to this. I tried calling clear() on any vectors, maps, and property trees on exit, like this:
[code]lcRoot.clear()[/code]
I seem to be getting significantly less leaks now, but I really should not have to do that, do I? Am I exiting the program incorrectly? And no, I am not using exit(0).
[QUOTE=daigennki;52164198]Quick follow up to this. I tried calling clear() on any vectors, maps, and property trees on exit, like this:
[code]lcRoot.clear()[/code]
I seem to be getting significantly less leaks now, but I really should not have to do that, do I? Am I exiting the program incorrectly? And no, I am not using exit(0).[/QUOTE]
Any resources that are not cleaned when closing an application counts as a 'leak' according to most leak detectors, since that's the only point where they can detect not cleaned memory. Most programs don't bother cleaning allocations that are present for the entire application lifetime, since the OS takes care of it.
[QUOTE=FalconKrunch;52164264]Any resources that are not cleaned when closing an application counts as a 'leak' according to most leak detectors, since that's the only point where they can detect not cleaned memory. Most programs don't bother cleaning allocations that are present for the entire application lifetime, since the OS takes care of it.[/QUOTE]
So since it is not causing any problems like memory usage increasing over time, should I not even bother?
[QUOTE=daigennki;52164551]So since it is not causing any problems like memory usage increasing over time, should I not even bother?[/QUOTE]
I wouldn't. I don't buy boost releasing a library with a huge honking memory leak in it. Probably just your leak detector being a bit antsy, is all.
[editline]29th April 2017[/editline]
also, as mentioned a few posts ago, if that clear() call is on a std::vector throw a shrink_to_fit() call in after clear() to actually free some memory up (if you're done with it completely)
[QUOTE=paindoc;52164722]I wouldn't. I don't buy boost releasing a library with a huge honking memory leak in it. Probably just your leak detector being a bit antsy, is all.
[editline]29th April 2017[/editline]
also, as mentioned a few posts ago, if that clear() call is on a std::vector throw a shrink_to_fit() call in after clear() to actually free some memory up (if you're done with it completely)[/QUOTE]
Okay, thought so, and thanks for the tip on shrink_to_fit(). You people are so helpful, thank you!
[QUOTE=helifreak;52147008]Ok now I'm really fucking confused.
I have a winforms application, it has a control that can't be placed from the designer so I manually add it in the constructor - this is fine - on resize of the form it adjusts the sizes of the controls including the manually added one - this is fine too. Now on my computer (Windows 10), the ResumeLayout() function inside InitializeControls() doesn't resize the form and everything is fine, but for some reason unbeknownst to me running it on Windows 7 [I]does[/I] resize the form in that method causing a null reference exception.
I dunno if a stacktrace would be any help but here's one any way:
[code]Application: What JSON.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
Stack:
at What_JSON.MainForm.ScaleControls()
at What_JSON.MainForm.MainForm_Resize(System.Object, System.EventArgs)
at System.Windows.Forms.Form.OnResize(System.EventArgs)
at System.Windows.Forms.Control.OnSizeChanged(System.EventArgs)
at System.Windows.Forms.Control.UpdateBounds(Int32, Int32, Int32, Int32, Int32, Int32)
at System.Windows.Forms.Control.UpdateBounds(Int32, Int32, Int32, Int32)
at System.Windows.Forms.Control.SetBoundsCore(Int32, Int32, Int32, Int32, System.Windows.Forms.BoundsSpecified)
at System.Windows.Forms.Form.SetBoundsCore(Int32, Int32, Int32, Int32, System.Windows.Forms.BoundsSpecified)
at System.Windows.Forms.Control.ScaleControl(System.Drawing.SizeF, System.Windows.Forms.BoundsSpecified)
at System.Windows.Forms.ScrollableControl.ScaleControl(System.Drawing.SizeF, System.Windows.Forms.BoundsSpecified)
at System.Windows.Forms.Form.ScaleControl(System.Drawing.SizeF, System.Windows.Forms.BoundsSpecified)
at System.Windows.Forms.Control.ScaleControl(System.Drawing.SizeF, System.Drawing.SizeF, System.Windows.Forms.Control)
at System.Windows.Forms.ContainerControl.Scale(System.Drawing.SizeF, System.Drawing.SizeF, System.Windows.Forms.Control)
at System.Windows.Forms.ContainerControl.PerformAutoScale(Boolean, Boolean)
at System.Windows.Forms.ContainerControl.OnLayoutResuming(Boolean)
at System.Windows.Forms.Control.ResumeLayout(Boolean)
at What_JSON.MainForm.InitializeComponent()
at What_JSON.MainForm..ctor()
at What_JSON.Program.Main()[/code]
[URL="https://helifreak.club/files/what.src.7z"]Source[/URL].
The easy solution is to just check in ScaleControls for null and this works but I just want to know why the fuck it's running functionally code different on each OS.
[/QUOTE]
Is your text scaling different across Win7 and Win10?
[thumb]http://i.imgur.com/odjPpyb.png[/thumb]
I made a perceptron object in Java:
[code] public Perceptron1(double[] inputData, double[] weightData, double target, double bias) {
this.inputData = inputData;
this.weightData = weightData;
this.target = target;
this.bias = bias;
output = 0;
}
public void fire() {
for (int i = 0; i < inputData.length; i++) {
output += inputData[i] * weightData[i];
}
output += bias;
output = Math.signum(output);
error = target - output;
for (int i = 0; i < inputData.length; i++) {
weightData[i] += error * inputData[i] * .02;
}
} // accessor/mutators not displayed[/code]
After 15 training phases with 2000 training sets (all of them are regenerated after each phase, so it sums up to 30000), classification accuracy floats at around ~99.6 percent. This generates the line that separates the points and provides a target: [code]public class TrainArray {
protected double[] input;
protected double answer;
TrainArray(double[] input) {
this.input = input;
answer = 0;
}
double f(double x) {
return 2*x+1;
}
double train() {
double yline = f(input[0]);
double y = input[1];
if (y < yline) {
answer = -1;
}
else {
answer = 1;
}
return answer;
}
}[/code]
Is there something wrong with how I handle bias, or is 100% accuracy not achievable?
I've been making some progress with OpenGL retained mode but I've got some questions.
[IMG]http://www.teamsandpit.com/images/gssmt/1-5-17/gssmt-frenzy-preview2.png[/IMG]
[IMG]http://www.teamsandpit.com/images/gssmt/1-5-17/gssmt-frenzy-preview1.png[/IMG]
The above screenshots (of frenzy from Half-Life) show the lines I'm drawing as being cut off on the left, but if I rotate the view (as I've done in the second image) more of the lines become visible. Can someone help me diagnose what's going on? I understand there are multiple reasons why this could be happening but I'm not too sure. I've disabled culling but that had no effect (I guess because it's off by default?).
Also, I'm trying to make the view properly movable - currently I've got a transform that I apply to each vertex - projection matrix * view matrix * model matrix- the projection matrix seems to be the field of view, the view matrix I guess is the orientation of the camera but I'm not sure what the model matrix is - I think it's meant to be some sort of origin but I'm not sure what.
[QUOTE=tschumann;52172145]I've been making some progress with OpenGL retained mode but I've got some questions.
[IMG]http://www.teamsandpit.com/images/gssmt/1-5-17/gssmt-frenzy-preview2.png[/IMG]
[IMG]http://www.teamsandpit.com/images/gssmt/1-5-17/gssmt-frenzy-preview1.png[/IMG]
The above screenshots (of frenzy from Half-Life) show the lines I'm drawing as being cut off on the left, but if I rotate the view (as I've done in the second image) more of the lines become visible. Can someone help me diagnose what's going on? I understand there are multiple reasons why this could be happening but I'm not too sure. I've disabled culling but that had no effect (I guess because it's off by default?).
Also, I'm trying to make the view properly movable - currently I've got a transform that I apply to each vertex - projection matrix * view matrix * model matrix- the projection matrix seems to be the field of view, the view matrix I guess is the orientation of the camera but I'm not sure what the model matrix is - I think it's meant to be some sort of origin but I'm not sure what.[/QUOTE]
Not sure what to do about the rest of your issue, but the model matrix is used to specify an individual objects transformation from model space to world space.
Lets say you have a model of a box - the vertices of the box are going to be at positions like:
[code]
{ 0.0f, 0.0f, 0.0f }
{ 0.0f, 1.0f, 0.0f }
{ 1.0f, 1.0f, 1.0f }
[/code]
And so on. These positions aren't in world-space though - they're relative to the center of the box (or a certain corner, or whatever you've chosen for your system). A model transformation matrix will take these vertices and place them at the proper position in the world, and will also scale + rotate the model. Its like taking the box from its own little local frame of reference and moving it ot be in the frame of reference shared by the rest of your objects. The order in which you perform these operations is important, btw, so here's a quick example from a project of mine:
[cpp]
glm::mat4 SOA_Mesh::get_model_matrix() const{
glm::mat4 scaleMatrix = glm::scale(glm::mat4(1.0f), scale);
glm::mat4 translationMatrix = glm::translate(glm::mat4(1.0f), position);
glm::mat4 rotX = glm::rotate(glm::mat4(1.0f), angle.x, glm::vec3(1.0f, 0.0f, 0.0f));
glm::mat4 rotY = glm::rotate(glm::mat4(1.0f), angle.y, glm::vec3(0.0f, 1.0f, 0.0f));
glm::mat4 rotZ = glm::rotate(glm::mat4(1.0f), angle.z, glm::vec3(0.0f, 0.0f, 1.0f));
glm::mat4 result = scaleMatrix * rotX * rotY * rotZ * translationMatrix;
return result;
}
[/cpp]
Here's an excellent post that will do better than I can: [url]https://learnopengl.com/#!Getting-started/Coordinate-Systems[/url]
[QUOTE=paindoc;52172863]Not sure what to do about the rest of your issue, but the model matrix is used to specify an individual objects transformation from model space to world space.
Lets say you have a model of a box - the vertices of the box are going to be at positions like:
[code]
{ 0.0f, 0.0f, 0.0f }
{ 0.0f, 1.0f, 0.0f }
{ 1.0f, 1.0f, 1.0f }
[/code]
And so on. These positions aren't in world-space though - they're relative to the center of the box (or a certain corner, or whatever you've chosen for your system). A model transformation matrix will take these vertices and place them at the proper position in the world, and will also scale + rotate the model. Its like taking the box from its own little local frame of reference and moving it ot be in the frame of reference shared by the rest of your objects. The order in which you perform these operations is important, btw, so here's a quick example from a project of mine:
[cpp]
glm::mat4 SOA_Mesh::get_model_matrix() const{
glm::mat4 scaleMatrix = glm::scale(glm::mat4(1.0f), scale);
glm::mat4 translationMatrix = glm::translate(glm::mat4(1.0f), position);
glm::mat4 rotX = glm::rotate(glm::mat4(1.0f), angle.x, glm::vec3(1.0f, 0.0f, 0.0f));
glm::mat4 rotY = glm::rotate(glm::mat4(1.0f), angle.y, glm::vec3(0.0f, 1.0f, 0.0f));
glm::mat4 rotZ = glm::rotate(glm::mat4(1.0f), angle.z, glm::vec3(0.0f, 0.0f, 1.0f));
glm::mat4 result = scaleMatrix * rotX * rotY * rotZ * translationMatrix;
return result;
}
[/cpp]
Here's an excellent post that will do better than I can: [url]https://learnopengl.com/#!Getting-started/Coordinate-Systems[/url][/QUOTE]
Yeah okay - so the world's model matrix would be the identity matrix and then each entity for example would have its own model matrix that translates/rotates it relative to the world?
I'd already skimmed that link you posted but it seemed like a pretty verbose explanation of things.
That's pretty much it.
To try to make it easier to understand, these matrices are just an easy tool to transform a point from one space into another.
The points of a mesh are defined in local object space, ie all around point (0, 0, 0).
If we want to move, rotate, and or scale their positions, we can multiply them by 4x4 matrix.
World space is like the "Level space", where your model transformations finish and you're happy with where it sits in the world -> typically done with a single model matrix.
Afterwards similar transformations can be done to the same set of points to move it into camera/view space, translating,rotating,scaling by the camera's position.
[QUOTE=tschumann;52175565]Yeah okay - so the world's model matrix would be the identity matrix and then each entity for example would have its own model matrix that translates/rotates it relative to the world?
I'd already skimmed that link you posted but it seemed like a pretty verbose explanation of things.[/QUOTE]
As Karmah pointed out, yeah pretty much.
Also Matrix math and linear algebra is pretty damn verbose, especially solving matrices and such, but it can't hurt to dive into it a bit. Its helpful when you start doing fancier things with your matrices, using quaternions, or play with things like rendering relative to eye/center.
Okay thanks all - it's starting to make a bit more sense now after a few days of playing with it. Hopefully it's like riding a bike and I won't forget it all.
Hey everyone. I am taking a beginner c++ class in college. And on my final project I am trying to do somethings I am not really clear on what to do and people in my programming class don't seem to be much help.
I have separate functions away from my main(). And the ways I think of calling them never seem to work out. I am making a text adventure game where to progress through the game you need to solve riddles. I got the riddle function coded here:
[url]https://pastebin.com/2Cx2nsiB[/url] (thought it was to big to post here. Lines omitted with // wouldn't allow you to answer them for some reason before so i took them out.) If I have this function in a separate file and fun it. It works fine and the program ends. But when I try to call it in somewhere in the main function:
[CODE]floorlevel == 1;
while(floorlevel <= 5)
{
int PlayerHealth = 12;
char door;
cout << "Choose your room:/n";
cout << "1 - Room 1\n";
cout << "2 - Room 2\n";
cout << "3 - Room 3\n";
cout << "4 - Room 4\n";
cout << "Choice: ";
cin >> door;
switch(door)
{
case '1':
{
int riddlecorrect = riddlefunction(); //Trying to call the riddle function here. But the riddle function never ends
if(riddlecorrect == 1);
{
cout << "*The Door opens slowly to a dark room.......*\n\n ";
int treasure = event(); //I guess what I am asking for help for also applies to calling these functions
if(treasure == 1)
{
PlayerFight(); //I guess what I am asking for help for also applies to calling these functions
break;
}
else if(treasure == 2)
{
WeaponFind(); //I guess what I am asking for help for also applies to calling these functions
break;
}
else if(treasure == 3)
{
cout << "As you walk into the darkroom, torches light up all around the room. The room now becomes bright enough to see that there is a chest sitting in the middle of it. You walk up and open it.";
cout << "Inside is a giant key. You may now make your way up to the next floor";
floorlevel + 1;
break;
}
else if(treasure == 4)
{
cout << "You make your way into the darkroom. Lights turn on around you to reveal....the room is empty. Searching the room brings up nothing. You make your way back to the main room. ";
break;
}
}
}
}
}
}[/CODE]
the function never seems to end. I have tried many things to try and get it working but it seems like no matter what I do the outcome always ends the same. I can post the whole code if anyone wants it but my writing in it isn't really good and I don't want anyone to be exposed to it :v:
I know I must be sounding pretty dumb right now so I really do appreciate any help.
[QUOTE=MissingGlitch;52181658]Hey everyone. I am taking a beginner c++ class in college. And on my final project I am trying to do somethings I am not really clear on what to do and people in my programming class don't seem to be much help.
I have separate functions away from my main(). And the ways I think of calling them never seem to work out. I am making a text adventure game where to progress through the game you need to solve riddles. I got the riddle function coded here:
[url]https://pastebin.com/2Cx2nsiB[/url] (thought it was to big to post here. Lines omitted with // wouldn't allow you to answer them for some reason before so i took them out.) If I have this function in a separate file and fun it. It works fine and the program ends. But when I try to call it in somewhere in the main function:
[CODE]floorlevel == 1;
while(floorlevel <= 5)
{
int PlayerHealth = 12;
char door;
cout << "Choose your room:/n";
cout << "1 - Room 1\n";
cout << "2 - Room 2\n";
cout << "3 - Room 3\n";
cout << "4 - Room 4\n";
cout << "Choice: ";
cin >> door;
switch(door)
{
case '1':
{
int riddlecorrect = riddlefunction(); //Trying to call the riddle function here. But the riddle function never ends
if(riddlecorrect == 1);
{
cout << "*The Door opens slowly to a dark room.......*\n\n ";
int treasure = event(); //I guess what I am asking for help for also applies to calling these functions
if(treasure == 1)
{
PlayerFight(); //I guess what I am asking for help for also applies to calling these functions
break;
}
else if(treasure == 2)
{
WeaponFind(); //I guess what I am asking for help for also applies to calling these functions
break;
}
else if(treasure == 3)
{
cout << "As you walk into the darkroom, torches light up all around the room. The room now becomes bright enough to see that there is a chest sitting in the middle of it. You walk up and open it.";
cout << "Inside is a giant key. You may now make your way up to the next floor";
floorlevel + 1;
break;
}
else if(treasure == 4)
{
cout << "You make your way into the darkroom. Lights turn on around you to reveal....the room is empty. Searching the room brings up nothing. You make your way back to the main room. ";
break;
}
}
}
}
}
}[/CODE]
the function never seems to end. I have tried many things to try and get it working but it seems like no matter what I do the outcome always ends the same. I can post the whole code if anyone wants it but my writing in it isn't really good and I don't want anyone to be exposed to it :v:
I know I must be sounding pretty dumb right now so I really do appreciate any help.[/QUOTE]
How are you sure that the riddleFunction never ends? I notice that floorlevel only gets incremented when treature == 3.
The reason for that is because you need to find the key to make it to the next floor. So only when treasure allows you to find the key is when you can move on to the next floor.
Well before when I posted that. It never really ended because it would give me the riddle. I would answer it correctly. it would go through the switch. And then gave me a riddle to solve again when I didn't choose a door yet. But trying to now. It doesn't seem to be doing it anymore even though I didn't change anything. Now it seems to be going through even though my PlayerFight isn't working right. I wonder what happened to make it suddenly work. I know why PlayerFight isn't working. I took a relook and I did my while loop in there wrong. But there are still some things in it that are not working as I would like.
[t]http://i.imgur.com/IEKWgIG.png[/t]
like I have these to determine how much a attack will do from the player and an enemy
[CODE]int PlayerDamage()
{
int roll = 0;
srand(time(NULL));
roll = rand() % 6 + 1;
return roll;
}
int EnemyDamage()
{
int roll = 0;
srand(time(NULL));
roll = rand() % 6 + 1;
return roll;
}
[/CODE]
but when printed both will always result in the same number.
For one, having two functions with the same exact parameters AND implementation kind of defeats the purpose of OOP. Second, I don't know how random numbers work in C++, but in Java, the course of action would be to cast the output of the random number times the dice sides into an int and return it, like this:
[code]
int roll = (int)((Math.random() * 6) + 1);
return roll;
[/code]
[editline]4th May 2017[/editline]
It looks like you're doing "roll equals randomfloat modulo 6 + 1", which seems really weirrrr— nevermind. rand() doesn't work like Math.random(), does it?
[editline]4th May 2017[/editline]
[code]#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int playerDamage()
{
int roll = 0;
roll = ((rand() % 6) + 1);
return roll;
}
int main()
{
srand(time(NULL));
int roll = playerDamage();
int roll1 = playerDamage();
std::cout << roll;
std::cout << roll1;
}[/code]
Five minutes of learning. You only run srand once in the main method. Also, I'm not sure about naming conventions in C++ either, but I don't believe method (function?) names (like playerDamage) should start with capitals.
The first advice I can give while im only on my phone here is don't use the random in math. Use mt19937 or mt19937_64 from <random>
Having a global generator will ensure that you don't have that issue with your damage rolls doing the same thing. Also you don't need two functions for damage, just rename one to something like determineDamage() and delete the other, they're the same thing.
I'll help more when I have access to my desktop so it's not a world of headache to help.
[editline]4th May 2017[/editline]
[QUOTE=U.S.S.R;52183429]
Also, I'm not sure about naming conventions in C++ either, but I don't believe method (function?) names (like playerDamage) should start with capitals.[/QUOTE]
Nah that's not a big deal really. You can name them just about however so long as you're not using reserved characters or the names of other established functions ( this is really only an issue because he's using namespace std though, since otherwise you probably won't accidentally run into that problem). C++ formatting is mainly personal style imo, just a few restrictions and some general practices that are advised.
I really hope this is the relevant place to post. Please excuse me if it isn't. Anyhow, I was hoping I could get some advisement from some of you experienced programmers. I am looking to start learning a programming language, my main goal being for game development. My friend recommended to me to start learning C#, he says it's a very versatile and easy to learn language and that it's generally a good place to start. I was wondering if anyone could shed light on this for me, maybe tell me what language is a good place to start. Now I did research some languages, I know it really depends what engine you want to work with but, I don't know really, I'm just kind of looking for something that's easy to get into and will teach me how to "think" like a programmer.
If you want a language capable of teaching you the basic idea of programming, learn some basic c++. If you want to go into game development you're going to need to pick an engine really. Programming knowledge semi translates across languages but it's easier to just learn the language you're going to be using from the start.
[QUOTE=h00dRat;52186998]I really hope this is the relevant place to post. Please excuse me if it isn't. Anyhow, I was hoping I could get some advisement from some of you experienced programmers. I am looking to start learning a programming language, my main goal being for game development. My friend recommended to me to start learning C#, he says it's a very versatile and easy to learn language and that it's generally a good place to start. I was wondering if anyone could shed light on this for me, maybe tell me what language is a good place to start. Now I did research some languages, I know it really depends what engine you want to work with but, I don't know really, I'm just kind of looking for something that's easy to get into and will teach me how to "think" like a programmer.[/QUOTE]
I disagree with F.X Clampazzo, starting with C++ can be really fuckin hard because its a difficult language, there's a wealth of utterly shit resources out there, and it's a really complex + feature rich language.
C# seems like the middleground between C++ and scripting languages like Lua, so it might work well for you.
For easy learning of simple programming concepts, Python is great. Download something like the Miniconda distro and use [URL="https://code.visualstudio.com/docs/languages/python"]Visual Studio Code[/URL] or Sublime Text to write some simple programs to get started down the path of learning programming concepts. A book you might find useful is "Inventing Your Own Computer Games with Python". [sp]Use libgen.io to find it, yohoho and a bottle of rum matey[/sp]. I had gone through it a bit when I was first getting started and it the author isn't a complete prick like Mr. "Learn Python the Hard Way". It mostly focuses on simple programs and getting you to understand programmatic concepts, which is nice.
If you're really willing to go down the rabbit hole, [URL="https://github.com/miloyip/game-programmer"]here's a fuckhuge wall of books you can consider reading[/URL] to start picking up gamedev. I'd say get some basic programming experience under your belt first, then tackle this list. I like that that list covers pretty much the whole spectrum from "what is algorithm" to "yay game physics" and so on.
[editline]4th May 2017[/editline]
Also that link to the wall of books recommends the better C++ textbooks too, if you see raw C-style arrays and lots of calls to "new" in C++ reference material you're in the wrong place (nothing wrong with understanding it, but there's so many better options out there).
When it comes to game engines, UE4 uses C++. Unity is C# iirc, but if you can grok C++ you can make the bridge to C# with a light amount of work/reading.
[QUOTE=paindoc;52187179]I disagree with F.X Clampazzo, starting with C++ can be really fuckin hard because its a difficult language, there's a wealth of utterly shit resources out there, and it's a really complex + feature rich language.
C# seems like the middleground between C++ and scripting languages like Lua, so it might work well for you.
For easy learning of simple programming concepts, Python is great. Download something like the Miniconda distro and use [URL="https://code.visualstudio.com/docs/languages/python"]Visual Studio Code[/URL] or Sublime Text to write some simple programs to get started down the path of learning programming concepts. A book you might find useful is "Inventing Your Own Computer Games with Python". [sp]Use libgen.io to find it, yohoho and a bottle of rum matey[/sp]. I had gone through it a bit when I was first getting started and it the author isn't a complete prick like Mr. "Learn Python the Hard Way". It mostly focuses on simple programs and getting you to understand programmatic concepts, which is nice.
If you're really willing to go down the rabbit hole, [URL="https://github.com/miloyip/game-programmer"]here's a fuckhuge wall of books you can consider reading[/URL] to start picking up gamedev. I'd say get some basic programming experience under your belt first, then tackle this list. I like that that list covers pretty much the whole spectrum from "what is algorithm" to "yay game physics" and so on.
[editline]4th May 2017[/editline]
Also that link to the wall of books recommends the better C++ textbooks too, if you see raw C-style arrays and lots of calls to "new" in C++ reference material you're in the wrong place (nothing wrong with understanding it, but there's so many better options out there).
When it comes to game engines, UE4 uses C++. Unity is C# iirc, but if you can grok C++ you can make the bridge to C# with a light amount of work/reading.[/QUOTE]
Wow, I just wanna say thank you for spending the time to actually format your reply. I really do appreciate the resources you've provided and I've got them bookmarked. I'm going to take a closer look at python, right now I am weighing the options, I'm floating towards lua, but C# is sort of still in the back of my mind, now I should also look into python.
[QUOTE=h00dRat;52187218]Wow, I just wanna say thank you for spending the time to actually format your reply. I really do appreciate the resources you've provided and I've got them bookmarked. I'm going to take a closer look at python, right now I am weighing the options, I'm floating towards lua, but C# is sort of still in the back of my mind, now I should also look into python.[/QUOTE]
If you want to use Lua, then use Lua tbh. I've never used it so I don't have any resources for it, so I didn't have anything to contribute in that respect. I know its pretty popular on this forum (well, duh), and its still a scripting language that is easier to pick up than something like C++.
ultimately, its down to you and what you want to do. If you try using C++ a bit and actually really dig it, go right ahead and use C++. But if you find Lua/Python easier to pick up and get started with, use those.
Also, this could kinda depend on whether you want to do gamedev, like work on making games in particular, or you just like things like systems programming and programming in lower-level languages like C++.
I'd feel better if someone else had some input, I'd hate to give bad advice :v
[QUOTE=paindoc;52187261]If you want to use Lua, then use Lua tbh. I've never used it so I don't have any resources for it, so I didn't have anything to contribute in that respect. I know its pretty popular on this forum (well, duh), and its still a scripting language that is easier to pick up than something like C++.
ultimately, its down to you and what you want to do. If you try using C++ a bit and actually really dig it, go right ahead and use C++. But if you find Lua/Python easier to pick up and get started with, use those.
Also, this could kinda depend on whether you want to do gamedev, like work on making games in particular, or you just like things like systems programming and programming in lower-level languages like C++.
I'd feel better if someone else had some input, I'd hate to give bad advice :v[/QUOTE]
No you gave your input, that's all I'm looking for. Right now I'm just doing my research and gathering all the information I can from every source to make a decision. And you did just that, thank you.
Tbh, the only reason I recommend learning some c++, like just learning the basics, functions, if/else, for/while/do, etc. is largely because if you can stomach that lower level language then you'll find the transfer to other languages to be pretty easy imo. I started out learning c++ as my first language and I found it to be super easy because of how low-level it is at its most basic. Python is probably a good starting place too, or lua yeah, depending on if you're comfortable with the low-level language thing. But my 2-cents are that I personally found that c++ was a very easy language to pick up the very basics of because of how low level it was, miles may vary of course.
[editline]5th May 2017[/editline]
To address a few issues in the code MissingGlitch posted:
[QUOTE=MissingGlitch;52181658]
[CODE]
floorlevel == 1; // This is wrong, you want floorlevel = 1; = sets a variable, == is for comparisons.
while(floorlevel <= 5)
{
int PlayerHealth = 12; /* this is going to set player health to 12 every time you start a level, I assume you want the player's health to carry between */levels?
char door;
cout << "Choose your room:/n";
cout << "1 - Room 1\n";
cout << "2 - Room 2\n";
cout << "3 - Room 3\n";
cout << "4 - Room 4\n";
cout << "Choice: ";
cin >> door;
switch(door)
{
case '1':
{
int riddlecorrect = riddlefunction();
if(riddlecorrect == 1);
{
cout << "*The Door opens slowly to a dark room.......*\n\n ";
int treasure = event();
if(treasure == 1)
{
PlayerFight();
break; // you don't need to break on every if/else if/else statement, just do one at the end
}
else if(treasure == 2)
{
WeaponFind();
break; // if treasure = 1 you'll never get here anyway, nor will you see the result of treasure = 3
}
else if(treasure == 3)
{
cout << "As you walk into the darkroom, torches light up all around the room. The room now becomes bright enough to see that there is a chest sitting in the middle of it. You walk up and open it.";
cout << "Inside is a giant key. You may now make your way up to the next floor";
floorlevel + 1;
break;
}
else if(treasure == 4)
{
cout << "You make your way into the darkroom. Lights turn on around you to reveal....the room is empty. Searching the room brings up nothing. You make your way back to the main room. ";
break;
}
break; // this is where your break should be.
}
}
}
}
}[/CODE]
[/QUOTE]
also the reason your riddle code isn't working is because you have no way to leave the function if you're not correct. You have a return if the answer is correct, but you have no return otherwise. break; doesn't work to leave a function, you just have to return 0; or some other non-used integer value. If you want to be able to exit the function without a return then you need to make it a void and pass your variable to be set by reference to it.
I'm looking to modify my light shaders to get anisotropic specular reflections, but I really can't find anything online that helps, as well as the things that I've tried really haven't worked.
From what I understand, the NDF (D) term of my BRDF can be calculated differently like this:
[URL="http://graphicrants.blogspot.ca/2013/08/specular-brdf-reference.html"][img]http://i.imgur.com/lBUg96e.png[/img][/URL]
However some of the changes in terms is a bit confusing compared to the other functions I've used before.
From what I recall, anisotropy like this can be authored by using 2 channels for roughness as opposed to 1. With that in mind, I figure 'x' and 'y' in this equation would refer to roughness in those axes.
I've attempted to solve the equation in GLSL like this:
[code]
float NDF_GGX_Anisotropic(in float NdotH_2, in vec2 Roughness, in vec3 HalfVector)
{
vec3 X = vec3(Roughness.x, 0, 0);
vec3 Y = vec3(0, Roughness.y, 0);
float XdotH = dot(X, HalfVector);
float YdotH = dot(Y, HalfVector);
float XdotH_2 = XdotH * XdotH;
float YdotH_2 = YdotH * YdotH;
float RoughnessX_2 = Roughness.x * Roughness.x;
float RoughnessY_2 = Roughness.y * Roughness.y;
float First = 1.0f / M_PI;
float Second = 1.0f / (Roughness.x * Roughness.y);
float Third_Denom = (XdotH_2 / RoughnessX_2) + (YdotH_2 / RoughnessY_2) + NdotH_2;
float Third = 1.0f / (Third_Denom * Third_Denom);
return First * Second * Third;
}
[/code]
Shouldn't I get like a ring or a band of light as the reflection when the roughness is full in one direction and zero in the other? I can't seem to get these results.
Are you getting the ring or band on any other inputs? Say, half way between full and 0? That said, honestly I have no clue where to go from that question, I'm not a shader programmer in the slightest.
Overall the specular reflection just looks huge and shifts a bit still when moving around, but overall still circular and blob like. I can't get any changes in shape.
hmm. Idk. I always make a point of double checking my math by running it through wolfram alpha as best as possible with known example values to prove my implementation is right. If you know some numerical examples, that'd be where I'd go next.
Okay, so I'm using Java to create my own little rendering thingy with LWJGL as a foundation. I followed some tutorials and then kinda went off about it by myself...
The only problem is that I seem to have broken something relating to sending variables to the shaders (or it's simply just a fuck up that I've not found a fix for somewhere else in the code) and now either meshes don't render, or they render as white with no matrix transforms and the shader code seemingly does nothing. A lot of my code is unfinished but it *should* work because I didn't really do anything to break it.
Anyone good with GL and Java fancy helping me? Code is available here: [url]https://github.com/Legend286/DeferredRenderer[/url]
Sorry, you need to Log In to post a reply to this thread.