Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral


About antoniorv6

  • Rank

Personal Information


  • Twitter
  • Github
  • Steam

Recent Profile Visitors

1123 profile views
  1. antoniorv6

    Memory leak with OpenGL Textures

    Alright, I will check it out. stbi_load should give the data correctly, you pass the reference and it gives you the value i has retrieved. Also, if you put a 4 in the last parameter, should return alpha channel. It works correclty that way, but it freaks me out why only in this case valgrind detects a memory leak. Even though I will reply later knowing the size of m_imageData_cch
  2. antoniorv6

    Memory leak with OpenGL Textures

    Yeah, I free it at the last line of TResourceTexture::LoadResource(). Is it any way i can figure out it is doing so?
  3. antoniorv6

    Memory leak with OpenGL Textures

    Yeah, when I delete the texture, i do: TResourceTexture::~TResourceTexture() { glDeleteTextures(1, &m_textureID); m_textureID = 0; m_width_i = 0; m_height_i = 0; m_bDepth_i = 0; }
  4. Hi. I am developing a sort of graphic engine for a project at the University and I have stepped into a problem that I don't really know how to interpret. I'll explain. In our game engine, when you load a texture, you read it with the function that STB image library provides: stbi_load(), and then bind it. This is done by the following code: void TResourceTexture::LoadResource(const std::string& c_resourceDocument_str) { std::string l_assetRoute = "assets/" + c_resourceDocument_str; LoadFromSTBI(l_assetRoute); BindTexture(); stbi_image_free(m_imageData_cch); } void TResourceTexture::LoadFromSTBI(const std::string& c_resourceDocument_str) { m_imageData_cch = stbi_load(c_resourceDocument_str.c_str(), &m_width_i, &m_height_i, &m_bDepth_i, 3); if(!m_imageData_cch) { std::cout << "[ERROR] - Texture could not be found"<<std::endl; stbi_image_free(m_imageData_cch); return; } } void TResourceTexture::BindTexture() { glGenTextures(1, &m_textureID); glBindTexture(GL_TEXTURE_2D, m_textureID); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_width_i, m_height_i, 0, GL_RGB, GL_UNSIGNED_BYTE, m_imageData_cch); glGenerateMipmap(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, 0); } This works fine and does not give any problems. However, if I change the first line of LoadFromSTBI and the seventh of BindTexture() with these: m_imageData_cch = stbi_load(c_resourceDocument_str.c_str(), &m_width_i, &m_height_i, &m_bDepth_i, 4); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_width_i, m_height_i, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_imageData_cch); Valgrind triggers me the following memory leak: ==5745== ==5745== 6,840 bytes in 1 blocks are possibly lost in loss record 137 of 140 ==5745== at 0x483777F: malloc (vg_replace_malloc.c:299) ==5745== by 0x19A7A0AD: ??? (in /usr/lib/dri/i965_dri.so) ==5745== by 0x19A7A178: ??? (in /usr/lib/dri/i965_dri.so) ==5745== by 0x19A77FB6: ??? (in /usr/lib/dri/i965_dri.so) ==5745== by 0x19A781E2: ??? (in /usr/lib/dri/i965_dri.so) ==5745== by 0x19ACFC5B: ??? (in /usr/lib/dri/i965_dri.so) ==5745== by 0x6DD54FE: __pthread_once_slow (in /usr/lib/libpthread-2.28.so) ==5745== by 0x19AD0266: ??? (in /usr/lib/dri/i965_dri.so) ==5745== by 0x19ADE107: ??? (in /usr/lib/dri/i965_dri.so) ==5745== by 0x199C658E: ??? (in /usr/lib/dri/i965_dri.so) ==5745== by 0x19A05B9E: ??? (in /usr/lib/dri/i965_dri.so) ==5745== by 0x19A05EC0: ??? (in /usr/lib/dri/i965_dri.so) I thought it was a memory leak related to hardware and graphic drivers, but while testing in other different device, it triggered again. Does anyone know what's going wrong with this change or if it has to be done anything extra if you are using this function in order to avoid this leaks? Thank you in advance!
  5. antoniorv6

    Issues with RakNet and public IP

    Yeah, it was the result I was expecting. But either is the server active listening or not for new connections, it is shown the CLOSED status. That was what made me freak out.
  6. antoniorv6

    Issues with RakNet and public IP

    It finally was that the router didn't have the port opened. Changed it and worked fine. The server runs in a Manjaro device at home. Anyway, there is something that confuses me. When I checked the port, the service told me that it was CLOSED. However, the client connected perfectly (I've put my public IP in the connect() function and tried in two sepparated devices). The server is also listening and using the same port. Is it there anything that I'm skipping or doing wrong? Nope, I'm now on developing proccess. But I have intentions to upload it to one cloud service (I don't want it running in my home router). Any recommendation about coosing one of these or considerations that I must have? Thank you very much!
  7. Hi there. I'm currently developing the online multiplayer for my college project. We have to develop it using RakNet library. Now I am have successfully developed a server and client that can communicate from machines connected into the same network. The next step in the development that I want to make is to accomplish remote connections between clients and the server. I have read the docummentation of RakNet. As I have understood, there is no need to make IP forwarding, because NATPunchthrough plugin resolves the problem. I have followed the guidelines in the official webpage to make the basic connection. However, it doesn't work. I mean, the connection packet that de client sends to the public IP isn't recevied by the server, so I can't make any steps further (because i have to run the OpenNAT function after receiving the connection acceptance packet). I tried to bind the public IP to the server, as I have seen in the forums with strcpy(socket.host, public_ip), but it just triggers an error and sets it to it's default. I want to ask you if I am missing something or misunderstanding any concept. Here's my code for the server, the part that corresponds on binding: m_natPunch_ptr = RakNet::NatPunchthroughServer::GetInstance(); m_peerInterface_ptr = RakNet::RakPeerInterface::GetInstance(); m_peerInterface_ptr->AttachPlugin(m_natPunch_ptr); m_socketDescriptor_sock = RakNet::SocketDescriptor(m_SERVERPORT_i, 0); m_peerInterface_ptr->Startup(m_MAXCONNECTIONS_i,&m_socketDescriptor_sock,1); m_peerInterface_ptr->SetMaximumIncomingConnections(m_MAXCONNECTIONS_i); std::cout<<"[SUCCESS] - Server initialized correctly"<<std::endl; std::cout<<"The server GUID is ->"<<m_peerInterface_ptr->GetMyGUID().ToString()<<std::endl; std::cout<<"The server IP is ->"<<m_peerInterface_ptr->GetSystemAddressFromGuid(m_peerInterface_ptr->GetMyGUID()).ToString()<<std::endl; And here's the client corresponding one: m_punchClient_ptr = RakNet::NatPunchthroughClient::GetInstance(); m_peerInterface_ptr = RakNet::RakPeerInterface::GetInstance(); m_peerInterface_ptr->AttachPlugin(m_punchClient_ptr); m_peerInterface_ptr->Startup(1,&m_socketDescriptor_sock,1); ConnectToServer(); std::cout<<"I'm going to try to connect to the server"<<std::endl; m_peerInterface_ptr->Connect("My public IP",8000,0,0); //I retrieve my public IP with whatspmyip.com std::cout<<"Connecting..."<<std::endl; Thank you very much in advance.
  8. antoniorv6

    Turret aim

    Well, the project indeed is sort of tower-defense like game I have to do with my team for a University subject. We have thought about making a game with some mechanics of Dungeon of the Endless (where the defense goes by turrets and heroes), so I think it won't be a problem if the turrets auto-aim at high speed, indeed, I had the same worry of rotating animation being a disadvantage. Just as you said, we have planned to make different kinds of turrets, and other weapons, to make a better strategy experience balanced with the heroes control. So I will do as you recommend, I think for this time (I'm still learning) I will get back and make the basic of the basics just aiming and shooting, not worrying about animations yet. Once it is implemented and, if we have time to do it, we will spend some in figuring out this animations. Welp, thank you very much guys! You solved me a lot of doubts I had on how to implement all of this.
  9. antoniorv6

    Starting in Videogame Music

    Hi there! Well, as the subject describes itself. I would like to start in videogame music and composition. I do know some Music Theory and have some notions on how to play the piano, and also in my Degree we have some subjects refered to Sound and Music, but I would like to go a little bit deeper. Anyway, I'd like to know if it there is any site, course, or bibliography refered to all of this, even if it starts from the basic of the basics. Also would be interesting if it is there any good reference to study all the software related to the theme. It would be great if anyone could give me some advice, because now I am a little bit lost. Thank you!
  10. antoniorv6

    Turret aim

    I see your point. and the logic of FindTarget() and Attack() fits the bill with my first thoughts on how to make it. I was asking more about the mathematics of rotating the turret towards the enemy. But this advice also results very handy!! Speaking of which, you are telling me to use manhattan distance to determine de closest target? Finally, I see that you are calling this functions while the Enemy is executing his movement but, could it be better to manage it in the State of the game and distributing the functions with the Turret class? For example, constructing the vector in the State class and then store the enemy location or sth in the Turret class to keep aiming at him? I'm getting a little bit fuzzy thinking about updating the position of THAT particular enemy to THAT turret. Thank you very much!
  11. antoniorv6

    Turret aim

    I thought the same for calculating the distance between the turret and the enemy (thinking it as retrieving the module of a vector which is determined by substracting both points). I see also that you are getting the angle of the enemy by using the arc tangent, so, just to clear myself, if you calculate the arc tangent of the offset (which is a vector which goes from my turret to the enemy) i will retrieve the angle that is needed? Didn't thought about it!. So then, when I retrieve that angle I just use setRotation() in the sprite and we're done right? Thank you very much!
  12. Hi there! I'm currently developing a Turret Defense videogame with C++ and SFML and I'm having some trouble thinking about a feature. In this kind of games, it's commonly seen that turrets keep aiming and attacking to enemies that are into a certain range. I'm struggling to figure out how to program it. Firstly, I came across to use some basic Trigonometry figuring out (thanks to the coordinates of the enemy sprite and our turret), the angle that is needed to be aiming to the bad guy (using the sine arc). Then, I'l substract this result to the initial angle that the turret's sprite has and I think I would obtain a displacement, which I will apply to the rotate() function that SFML provides to their sprites. Anyway, I don't really know if I am right with this hypothesis or if it exists any better option to make this calculus. I tried to look up at some other videogames and I didn't find anything clear. So, I would appreciate a lot if anyone knows any better option or how to refine this first hypothesis. Thank you in advanced!
  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!