Jump to content
  • Advertisement
    1. Past hour
    2. DividedByZero

      Blending textures question

      I should have tried with a coloured texture earlier, as it is much more apparent with this.
    3. Disclaimer: Although I've read the entire thread, I didn't entirely understand everything in it. So, this may or may not be relevant. There are grid-traversal algorithms that can split a linear component into subcomponents, each of which is fully contained by a grid cell (in other words, the parent linear component is split at cell boundaries). I found this: https://theshoemaker.de/2016/02/ray-casting-in-2d-grids/ I didn't read all of it, but the second diagram in the section titled 'Exact Ray Casting' shows what I'm talking about. For what you're doing it might be more complicated, since you might need to split the linear component at interior triangle edges as well. Also, be aware that these algorithms can be vulnerable to numerical error, so appropriate care should be taken. It seems possible you could use a similar approach. For example, you'd start by finding the starting and ending positions for the current update based on the current velocity. If both the start and end positions are in the same triangle, no special handling is needed. Otherwise, compute the position at which the segment exits the starting triangle, and start the process over at that point. Repeat until the time delta is used up. In theory, this approach could allow you to deal with height continuously, which is what I suspect you mean by 'every height'.
    4. Today
    5. I didn't make it very far, it crashed a few times on me. The jumping was fun, but I also killed myself that way a few times. I think the music and sound effects matched the mood of the environment very well. I like it a lot.
    6. DividedByZero

      Blending textures question

      This is what I have now, but it isn't quite there. The colours are now correct, with the exception of the darker green areas. textureColor = TextureStandard.Sample(SamplerWrap, input.textureCoord); float4 texOverlay = (projectionColor * projectionColor.a + textureColor * (1.0f - projectionColor.a)); color *= textureColor; color += (diffuseColor * diffuseIntensity); color *= saturate(textureColor * texOverlay); return color;
    7. DavinCreed

      Psy - Dungeon Challenge

      I really liked the art style in this game. I got lost a few times, but my rusty Wizardry skills came back a bit.
    8. It certainly should be smooth because you weren't connected to any server! In other words, there was no networking occurring. Furthermore, client-side prediction means that even when connected, your own movement should seem totally smooth unless there are significant hiccups in the connection prompting the sever to force a re-sync of the player's position. The real test, then, is whether other players' movements seems smooth (especially because although they are interpolated on the server, they are extrapolated on the client). Unfortunately, until I add bots, there will be no way to see that without other players connected. My intent behind including the link was (besides the shameless plug) to show you a kind of movement mechanics that can work OK via less-than-ideal WebSockets (albeit five per player), at least according to my limited, small-scale testing. Inertia and acceleration help mitigate latency; that's how SubSpace was able support servers of 50 players on dial-up connections with RTTs of 200-400ms twenty years ago. But if you want players to instantaneously change their velocity (i.e. your gameplay centers on reflexes), then you probably need optimal networking conditions. I'm breaking a lot of rules (e.g. using TCP and using a virtual private server), so it'll be interesting to see just how well this game does or doesn't function on a larger scale. Certainly, I'm assuming that players will have reasonably stable connections to a sever in their general region (so no mobile players?). I'm not quite sure how much, if at all, round-trip-time will be affected. The development of the UDP client is behind the development of the WebSocket client, so currently it's very hard to test them together. I fully expect UDP players to have less issues with lag between them and the server (because of no head-of-line blocking and because of faster re-transmission of lost packets), but it remains to be seen whether this will translate to any real advantage in-game because they are also, to some extent, at the mercy of the other players' connections. As I mentioned in the other thread, the game does support UDP-only servers because if it became popular, I can envisage a demand for them. Whoever runs a sever can select what types of connections to allow. The obvious advantage will be had by a player hosting a non-dedicated server, who will be the only one seeing the true positions of other players. I'm not too worried about this as it could be an incentive for players to go to the trouble of hosting their own games. Of course, for a true UDP experience in the browser, there's always WebRTC. I experimented with it before beginning with WebSockets, but I thought there were some obstacles that are relatively insurmountable for a lowly hobbyist, namely NAT-traversal and the need to run your own TURN servers, the difficulty of integrating WebRTC with C++, and the general lack of support, documentation, and communal experience. WebRTC seems like completely uncharted territory - I'm not aware of any game currently supporting it, but I'm sure other people know more than I do.
    9. That looks awesome! I'd love to play it.
    10. Alright, there seems to be some problems with using suggestion number 2. I have enclosed three diagrams to help explain. The assumption is that I advance on the mesh with a small amount using the glm::translate command. And by using the formula above (number 2), I can calculate the height with the triangle's angle to make a simple inertia effect. The first problem is that as diagram number 1 shows, the glm::translate command can skip over the partial sections at both the end of cell 1 and the beginning of cell 2 and these section would be overlooked. The second problem (see diagram number 2) is that there could be a position change that has only one point in the triangle. The third problem is that the repositioning could completely disregard a triangles height all together (diagram 3). If some areas are not used in the computations, the slowing / speeding up of the ball will be too un-exact. Thank you, - Josheir -
    11. hplus0603

      Multiplayer networking for modded open source game?

      RTS-es almost always use one of the players as server. Typically, this is the "hosting" player for a game. I don't see why this would be a problem? Any server is a computer that runs a program that uses Steamworks, and announces itself to the Steam matchmaking service as accepting game connections. Thus, a hosting player could just announce themselves through matchmaking. Picking a game that already supports networking would be best, though, because converting a single-player game to a networked game often ends up being "re-implementing all of the simulation and physics logic and main screen modes."
    12. Asking questions about what they did is unlikely to be a problem. It shows interest in the company and shows you have done some homework. No problems there. Ask it. One game is not a business plan. Go do research on the people and the company itself. What little I see is not encouraging. In addition to your other questions, you should ask questions to ensure the company will still be around and the paychecks will clear. Startups are extremely high risk. Usually they are very demanding and there is no support, no backup system. Nearly all of them fail. In the statistically rare cases they don't fail, and if you are in early, there can be great career benefits. Before you go to the interview you should do some soul searching and figure out how much you can afford to handle them failing, and make sure you have a plan to not go down too in that situation. You should also have a plan to help them succeed, and a plan for your own success along with it.
    13. The big issue with TCP (and therefore also WebSocket) is retransmit time when there are network errors. When data is flowing and there are no network hiccups, which on most networks is the situation most of the time, the data will flow smoothly. When there are network hiccups, which can happen with network congestion, or with electrical noise, or with other issues, the problem is how data gets retransmitted. Since these are a stream-based socket they cannot advance until that data is transmitted. The data flow will stop until the missing data has arrived. The retransmission timeout (also called RTO) is initially 3 seconds, then 6 seconds, then 12 seconds. That is, if you don't hear an acknowledgement after 3 seconds the data is retransmitted, then again after 6 more seconds (about 9 seconds total), then again after 12 seconds (about 21 total) then wait about 12 more seconds (about 33 seconds total) before declaring the connection dead. Contrast with UDP, where you can continue with missing data, and you can incorporate techniques to automatically retransmit data with every message until acknowledged, or not retransmit non-critical data, or to do other behavior including implement your own RTO similar to what TCP does. Exactly how big the issue is depends on the details. Can your game design and implementation cope with a 3-second stall? Does it saturate the network, increasing the likelihood of stalls? Will your players be on networks that are more prone to communications issues?
    14. anisim

      Read XDB file

      ello, could you help me to read data from XDB game files:It contains needed info (some codes are available via raw Notepad++ view).Also files are presented in couple (xdb with xdb.rp).Attached some files for example Thanks.
    15. Hello, I want to make an RTS game that allows users to write their own AI for units. However, I have limited resources, and am thinking of modding an existing open-source RTS to add this functionality, rather than build my own game from scratch. Or at least at first. This would be a good way to gauge interest and get feedback. It looks like there are a lot of open-source RTS games that fit what I'm looking for, such as 0 AD, Warzone 2100, Glest/Megaglest, etc. And their licensing is very permitting (GNU GPL and CC BY SA), so it looks like I'm welcome to mod their games, and then release my mod wherever I want, as long as I include attribution, and release it also under GPL with the source code included. I was thinking of releasing the mod on either Steam, itcho.io, to gain visibility and to take advantage of their premade features for packaging, delivery, and matchmaking of the game. However, I was looking the matchmaking aspect, and am a little confused. Steam talks about servers here: https://partner.steamgames.com/doc/features/multiplayer/game_servers which says basically that you can use the Steamworks API, but need to provide your own servers, or have the player's computers act as the servers. I'm guessing the latter would probably be impractical given the genre (RTS), but don't have a lot of experience by which to judge. What I'm looking for is something that's not a lot of work to connect people in multiplayer games. I'm happy to pay for servers, even if I don't end up charging anything for the game. I'm not sure what goes into linking servers to steam to allow matchmaking, and how much of it is done for you. I also tried to look into how 0 AD does matchmaking. It looks like it works directly through the game (like the old "multiplayer" option in Age of Empires), but beyond that, I'm not sure. Anyone know more about this sort of thing? Thanks!
    16. It useful for projects on my computer where each library has only on copy. But I include libraries in some projects because I need to public VS projects and everyone can open it and run them immediately. I make the "Libs" folder inside each such solution, put all necessary libraries to the "Libs" folder and connect them to the project using "$(SolutionDir)Libs\..." paths.
    17. SkyVaultGames


      Viakin is a roguelike with a focus on level generation and intense gameplay.
    18. Next part: Set Up GMock for TDD. C++, VS
    19. If you need the example how to set up GTest without GMock you can see this example: Set Up GTest for TDD. C++, VS In this example: PersonService_GMockCpp.zip we will see how to use Google Mock for creating mock objects and how to write a unit test for testing exceptions. I translated this example from the TypeScript tutorial: Using Jasmine Spies to Create Mocks and Simplify the Scope of Your Tests You can download and run the example. Google Test library is included in the project as source folder and it is placed in "Libs" folder. Note. If you have another version of VS then before you will run unit tests you need to select VS 2017, like in this screenshot: You need to: open the solution. The solution is file with name: "PersonService.sln" select your version of VS, for example VS 2017 instead of VS 2015 as in the screenshot above make the "PersonService.UnitTests" project as "StartUp Project". For this: make right mouse button click on the "PersonService.UnitTests" project -> select "Set as StartUp Project" press Ctrl+F5 to run unit tests How to set up GTest and GMock from scratch I use version 1.8.1 of GTest and GMock. You can download these libraries here: gtest-1.8.1.zip gmock-1.8.1.zip You need to create a new solution. Write some name for you solution and for your project, for example: PersonService (for the solution and for the project). Pay attention, you need to check "Create directory for solution" when you create a new solution and project. Note. RMB - Right Mouse Button click. You can set up the project from scratch like this: Create a new solution with the name "PersonService". Check "Create directory for solution". Write name "PersonService" for project. Set a new project as: empty console project, without the "precompiled headers". The "PersonService" project will be a project under test Copy and add these files to the "PersonService": IDataContext.h #pragma once #include "Person.h" class IDataContext { public: virtual ~IDataContext() {}; virtual void SavePerson(const Person &person) = 0; }; IPersonValidator.h #pragma once #include "Person.h" class IPersonValidator { public: virtual ~IPersonValidator() {}; virtual bool IsValid(const Person &person) = 0; }; Person.h #pragma once #include <string> class Person { public: int number; std::string name; }; PersonService.h #pragma once #include "Person.h" #include "IPersonValidator.h" #include "IDataContext.h" class PersonService { public: PersonService(IPersonValidator *validator, IDataContext *dataContext); void Save(const Person &person); private: IPersonValidator *_validator; IDataContext *_dataContext; }; PersonService.cpp #include "PersonService.h" PersonService::PersonService(IPersonValidator *validator, IDataContext *dataContext) { _validator = validator; _dataContext = dataContext; } void PersonService::Save(const Person &person) { if (_validator->IsValid(person)) { _dataContext->SavePerson(person); } else { throw std::runtime_error("Person is not valid"); } } Add a new project in your solution. For this: RMB on the solution name -> "Add" -> "New Project..." -> Set a name: "PersonService.UnitTests". You project must be: console, empty and without the "precompiled headers". The "PersonService.UnitTests" project will have unit tests for the "PersonService" project Create the "Libs" folder in your solution folder (where your ".sln" file is placed) Copy the "gtest-1.8.1" and the "gmock-1.8.1" folders to the "Libs" folder from these archives: gtest-1.8.1.zip, gmock-1.8.1.zip Open the project properties of the project "PersonService.UnitTests" (RMB on the project name and select "Properties") and add these lines to "C/C++" -> "General" -> "Additional Include Directories": $(SolutionDir)Libs\gtest-1.8.1\include $(SolutionDir)Libs\gtest-1.8.1 $(SolutionDir)Libs\gmock-1.8.1\include $(SolutionDir)Libs\gmock-1.8.1 $(SolutionDir)PersonService Click "Apply" and "OK" buttons Make "PersonService.UnitTests" as "StartUp Project". For this: RMB on the "PersonService.UnitTests" project -> select "Set as StartUp Project" Add as "Existing Item" this file: "Libs\gtest-1.8.1\src\gtest-all.cc" and "Libs\gmock-1.8.1\src\gmock-all.cc". For this: RMB on the "PersonService.UnitTests" project -> select "Add" -> "Existing Item..." -> choose these files: "Libs\gtest-1.8.1\src\gtest-all.cc" and "Libs\gmock-1.8.1\src\gmock-all.cc" Add as "Existing Item" the files that you will test. For example, in this case: "PersonService.cpp" from the "PersonService" project Copy and add these files to the "PersonService.UnitTests": main.cpp #include <gmock/gmock.h> #include <gtest/gtest.h> int main(int argc, char **argv) { testing::InitGoogleMock(&argc, argv); return RUN_ALL_TESTS(); } PersonServiceTests.cpp #include <gmock/gmock.h> #include <gtest/gtest.h> using ::testing::_; using ::testing::Return; #include "IDataContext.h" #include "IPersonValidator.h" #include "Person.h" #include "PersonService.h" class MockDataContext : public IDataContext { public: MOCK_METHOD1(SavePerson, void(const Person &person)); }; class MockPersonValidator : public IPersonValidator { public: MOCK_METHOD1(IsValid, bool(const Person &person)); }; TEST(PersonService, IsValid_ValidPerson_CallSavePerson) { MockDataContext dataContext; MockPersonValidator validator; PersonService service = PersonService(&validator, &dataContext); Person validPerson; EXPECT_CALL(validator, IsValid(_)) .WillOnce(Return(true)); EXPECT_CALL(dataContext, SavePerson(_)).Times(1); service.Save(validPerson); } TEST(PersonService, IsValid_NotValidPerson_ThrowException) { MockDataContext dataContext; MockPersonValidator validator; PersonService service = PersonService(&validator, &dataContext); Person validPerson; EXPECT_CALL(validator, IsValid(_)) .WillOnce(Return(false)); EXPECT_CALL(dataContext, SavePerson(_)).Times(0); //EXPECT_THROW({ // service.Save(validPerson); //}, std::runtime_error); try { service.Save(validPerson); FAIL() << "Exptected std::runtime_error"; } catch (std::runtime_error const & err) { EXPECT_EQ(err.what(), std::string("Person is not valid")); } catch (...) { FAIL() << "Exptected std::runtime_error"; } } Run the "PersonService.UnitTests" project by pressing on "Ctrl+F5" buttons You will see that you tests passed:
    20. Thank you very much for sharing your experience Jack, this is exactly what I wanted to know. I actually did check out the link to the game and it's definitely playing very smoothly, no hick ups at all. I read in your post that you were planning on letting browser clients connect via websockets but native desktop via UDP. Would that mean desktop clients will always have an advantage in terms of latency over browser clients? I'd like to take your offer and observe the networking in action, I'll PM you right now and when is a good time. Thanks again Jack!
    21. Yesterday
    22. DividedByZero

      Blending textures question

      Hi _WeirdCat_ This is my blend state here. ID3D11BlendState* d3dBlendState = NULL; D3D11_BLEND_DESC omDesc; ZeroMemory(&omDesc, sizeof(D3D11_BLEND_DESC)); omDesc.RenderTarget[0].BlendEnable = true; omDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA; omDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; omDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; omDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA; omDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA; omDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; omDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
    23. _WeirdCat_

      Blending textures question

      So you still do not set proper blending operation https://www.google.com/m?q=dx11+set+blending+operation https://www.braynzarsoft.net/viewtutorial/q16390-13-blending
    24. I made an example of project in VS 2015: SortFunctions.zip This project will show you how set up Google Test in Visual Studio and run simple unit tests. Note. If you have another version of VS then before you will run unit tests you need to select VS 2017, like in this screenshot: Google Test library is included in the project as source folder and it is placed in "Libs" folder. You need to: open the solution. The solution is file with name: "SortFunctions.sln" select your version of VS, for example VS 2017 instead of VS 2015 as in screenshot above make the "SortFunction_UnitTests" project as "StartUp Project". For this: make right mouse button click on the "SortFunction_UnitTests" project -> select "Set as StartUp Project" press Ctrl+F5 to run unit tests You will see this settings in the "SortFunction_UnitTests" project properties: $(SolutionDir)Libs\gtest-1.8.1\include $(SolutionDir)Libs\gtest-1.8.1 $(SolutionDir)SortFunction This solution include two projects: SortFunctions - this project contains modules that we want to test. For example, bubbleSort() method SortFunctions_UnitTests - this project contains unit tests The "SortFunctions" project has two files: SortFunctions.h #pragma once extern void bubbleSort(int *array, unsigned int amount); extern void countingSort(int *array, unsigned int amount); SortFunctions.cpp #include "SortFunctions.h" void bubbleSort(int *array, unsigned int amount) { } void countingSort(int *array, unsigned int amount) { } The "SortFunctions_UnitTests" project has tests. For example, this is the "bubbleSortTests.cpp" with two tests. The first test is for positive numbers and the second test is for negative numbers: bubbleSortTests.cpp #include <gtest/gtest.h> #include "SortFunctions.h" TEST(bubbleSortTest, AllPositiveElements) { // Arrange const unsigned int amount = 5; int actualArray[amount] = { 5, 3, 10, 2, 7 }; int expectedArray[amount] = { 2, 3, 5, 7, 10 }; // Act bubbleSort(actualArray, amount); // Assert for (size_t i = 0; i < amount; i++) { ASSERT_EQ(expectedArray[i], actualArray[i]); } } TEST(bubbleSortTest, AllNegativeElements) { // Arrange const unsigned int amount = 5; int actualArray[amount] = { -5, -3, -10, -2, -7 }; int expectedArray[amount] = { -10, -7, -5, -3, -2 }; // Act bubbleSort(actualArray, amount); // Assert for (size_t i = 0; i < amount; i++) { ASSERT_EQ(expectedArray[i], actualArray[i]); } }
    25. DividedByZero

      Blending textures question

      Hi MJP, thanks for the reply. I just tried that snippet and it gave me the same result unfortunately. float3 texMixed = lerp(textureColor.xyz, projectionColor.xyz, projectionColor.a); float4 texOverlay = float4(texMixed, 1.0f); color *= texOverlay; Checked with the VS graphical debugger and the skull image has an alpha of 1.0 in the black areas and 0.0 in the transparent area. So the desired area is fully opaque. Thanks again for your help so far
    26. We could help you with useful ideas if we had an idea what communities. Homeless encampments in L.A.? Refugees in northern Mexico? Persecuted outcasts in Myanmar or India? Poor farmers in Kenya? Coal miners in Appalachia? I dread the answer "all of the above."
    27. MJP

      Blending textures question

      What you have there is the typical "over" blending operator, commonly used for transparent rendering or for combining layers in photoshop. It's essentially a linear interpolation of the two colors based on an alpha value, in fact you can re-write it as this: float3 texMixed = lerp(textureColor.xyz, projectionColor.xyz, projectionColor.a); This blend operation will result in only your projected texture color being visible when alpha is 1.0, so I'm guessing the alpha isn't actually 1 in your cases. I would double-check the value of the alpha channel in your texture (RenderDoc is great for this), and perhaps try hard-coding the alpha value to 1 in your shader to see what happens.
    28. Using SV_Depth can definitely reduce pixel shader performance. This is because most GPU's employ an optimization called "early Z", where the depth test is performed *before* the pixel shader is run rather than afterwards. This allows the GPU to completely skip shading pixels that fail the depth test, which can be a big win when there's a lot of overdraw. Using SV_Depth will cause the GPU ti disable early Z optimizations, since there's no way to know the final depth value until the shader is executed. However if you're only going to modify the depth in one direction relative to the triangle depth, you can use SV_DepthLess/SV_DepthLessEqual/SV_Greater/SV_GreaterEqual. This are basically a promise that your depth output will satisfy the described inequality relative to the triangle depth. So for instance, if you're only going to "pull in the depth" from your quad, you can use SV_DepthLessEqual. Using these version can allow the hardware to retain the early Z test (or at least parts of it), which can improve performance. In general the most optimal option is SV_Greater/SV_GreaterEqual, since this inequality lets the hardware safely assume that an occluded pixel will stay occluded after the pixel shader is run, since the depth will only increase relative to the triangle depth. BTW, if you don't want to output depth twice from your shader, you can remove the depth texture from your G-Buffer and just read the native hardware depth buffer in future shaders.
    29. yetiman123

      Any tips for Better Writing?

      Rule #1... Writers write everyday. Every single day. Even if it is only a sentence or two. Rule #2 You should always have an "open feeling" about your story line. What I mean, never be completely feel "happy about it", It should always be "could be better". By going back and back to it. over and over again, you will start to see things you missed, or what could be better. Rule #3. Don't through away those old ideas. Keep a folder, or file of the stuff you didn't use this time. Save for another time.. these are important.. Honest.
    30. RamblingBaba

      Explain to me Scene Node/Manager

      Apology, I don't use GameDev regularly so I forgot all about this post. From what I researched it seemed like it really isn't for every game genre in general. That is an excellent idea though, despite having zero interest in either looking into it a bit more might be beneficial. I just find it interesting, the example is always a space game. I was able to set up an example I came across where you add one character (main node so to speak) and you could toggle to any character added, and adding additional character would allow you to move any character added under the toggled (highlighted) character you choose like a big chain. The first character added could move the whole chain. Very interesting. Thanks for the suggestion.
    31. All this is just me trying to sharpen ideas, nothing is set in stone. That said... Goals: I think we're going for "living conditions", kind of a rags-to-riches deal, except aimed at improving the living conditions of communities (individuals and/or groups). Accomplishing: Get players to actively help others improve their living conditions. Methods are secondary to the reaching out to others, if that makes sense? Games for Change: Thanks, I'm totally on that now!!
    32. Hi Guys, I am playing with projective texturing which I now have working well. However, I am having troubles figuring out how to blend the original texture with the projective texture. I am trying to make it so the projective texture is painted on top of the original texture. I have come close with this textureColor = TextureStandard.Sample(SamplerWrap, input.textureCoord); float4 texMixed = (projectionColor * projectionColor.a + textureColor * (1 - projectionColor.a)); color *= texMixed; But this is giving me the following output; The skull should be a solid black, and the greens are a bit washed out outside of the projected area. Any advice on how to cleanly project the skull on to the body would be truly appreciated. Thanks in advance
    33. hplus0603

      Some questions about UDP in C++

      It might be educational for you to make one change at a time, and figure out which one it was 🙂 (Of course, it may be more than one.) My guess is that it's the client-side bind() and the size-value in recvfrom(). But only a controlled experiment will tell for sure. The reason recvfrom() needs the size value, is that otherwise it doesn't know how much it can write into the buffer you pass it (it can't assume it's a sockaddr_in, because sockets work with a bunch of different protocols, including IP6, which may have bigger address structs!) It thus reads the size of the buffer on input, and then updates the value on output to whatever the size of the address received actually was.
    34. mikethunder


      It is an RPG whose plot revolves around an apprentice magician named Lumiel who must develop his qualities while unraveling the dark plot that surrounds the island, which is the last vestige of an ancient and powerful kingdom called Grinbolt. Besides having to solve the main plot, Lumiel will also be able to carry out multiple secondary missions with which he will gain the gratitude of his countrymen and will grow as a magician and a person. There will be times when you will want to clear your mind of the multiple combats and investigations carried out; for this, you will have at your disposal various minigames scattered throughout the island that will help you in this task. Do you want to help Lumiel reach his goal and at the same time get involved in a small world full of magic and fantasy? ★ Available in Spanish and English. ★ Compatible with VR (Google Cardboard). ★ Compatible with multiple GamePads.
    35. jonri

      Islands and Land

      I found this and thought of your comment here! All you have to do is make a closed copy of your hull, apply this shader, and make sure your water is drawn afterwards on the transparent pass. It worked for me without the refraction part, and the only change I had to make to my water shader was setting ALPHA. This solution is great for me because I'll always need a closed copy of my hull for my buoyancy calculations anyways. The only downside that I can anticipate is that it might not look correct if you were already looking through another transparent surface such as a window.
    36. pindrought

      Some questions about UDP in C++

      Thanks again for all of the help. You're the best! I'm not sure what exactly the line of code was that was giving me the issue, but I made the changes you mentioned other than changing to blocking sockets, and when I went to test using Wireshark it was working properly! I am thinking maybe the issue was that I was not reinitializing the length value for the last argument into recvfrom. I had no idea that you were supposed to! Also to note, I changed the functionality so that the server will send back the negative value that the client sent just for testing purposes and changed it to send a signed integer instead of an unsigned integer. Edit: I still need to add error checking when calling sendto and recvfrom For anyone interested, here was the final code. #include <WinSock2.h> #include <WS2tcpip.h> #pragma comment(lib,"ws2_32.lib") #include <iostream> #define HOSTIP "" const int g_sleepDuration = 1 * 1000; //1 Packet per second enum RunType { Server, Client }; RunType runtype = RunType::Server; void DoServer() { SOCKET serverSocketHandle = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (serverSocketHandle == INVALID_SOCKET) { std::cerr << "Failed to create socket" << std::endl; return; } DWORD nonBlocking = 1; if (ioctlsocket(serverSocketHandle, FIONBIO, &nonBlocking) != 0) { std::cerr << "Failed to set socket non-blocking." << std::endl; return; } sockaddr_in listenAddress = {}; listenAddress.sin_family = AF_INET; listenAddress.sin_addr.s_addr = INADDR_ANY; listenAddress.sin_port = htons(8000); int listenAddressSize = sizeof(sockaddr_in); if (bind(serverSocketHandle,(const sockaddr*)&listenAddress,sizeof(sockaddr_in)) < 0) { std::cerr << "Failed to bind socket." << std::endl; return; } int32_t recvPacketCounter = 0; while (true) { if (GetAsyncKeyState(VK_ESCAPE)) return; listenAddressSize = sizeof(sockaddr_in); if (recvfrom(serverSocketHandle, (char*)(&recvPacketCounter), sizeof(uint32_t), NULL, (sockaddr*)&listenAddress, &listenAddressSize) > 0) //Server is receiving messages { recvPacketCounter = ntohl(recvPacketCounter); std::cout << "Server - [Sender Port: " << ntohs(listenAddress.sin_port) << "] Echoing packet: " << recvPacketCounter << std::endl; recvPacketCounter = -recvPacketCounter; recvPacketCounter = htonl(recvPacketCounter); sendto(serverSocketHandle, (char*)&recvPacketCounter, sizeof(uint32_t), NULL, (sockaddr*)&listenAddress, sizeof(sockaddr_in)); //This send is never being picked up by the client? } Sleep(1); } } void DoClient() { SOCKET clientSocketHandle = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (clientSocketHandle == INVALID_SOCKET) { std::cerr << "Failed to create socket" << std::endl; return; } DWORD nonBlocking = 1; if (ioctlsocket(clientSocketHandle, FIONBIO, &nonBlocking) != 0) { std::cerr << "Failed to set socket non-blocking." << std::endl; return; } uint32_t ip = INADDR_NONE; inet_pton(AF_INET, HOSTIP, &ip); if (ip == INADDR_NONE) { std::cerr << "Failed to resolve host." << std::endl; return; } uint32_t hostip = INADDR_NONE; inet_pton(AF_INET, HOSTIP, &hostip); if (hostip == INADDR_NONE) { std::cerr << "Failed to convert host ip from text to 32 bit binary." << std::endl; return; } sockaddr_in sendtoAddress = {}; sendtoAddress.sin_family = AF_INET; sendtoAddress.sin_addr.s_addr = hostip; sendtoAddress.sin_port = htons(8000); sockaddr_in recvAddress = {}; int recvAddressSize = sizeof(sockaddr_in); int32_t packetCounter = 0; int32_t recvPacketCounter = 0; while (true) { if (GetAsyncKeyState(VK_ESCAPE)) return; uint32_t tempval = packetCounter; tempval = htonl(tempval); sendto(clientSocketHandle, (char*)(&tempval), sizeof(uint32_t), NULL, (sockaddr*)&sendtoAddress, sizeof(sockaddr_in)); //<-This works recvAddressSize = sizeof(sockaddr_in); if (recvfrom(clientSocketHandle, (char*)(&recvPacketCounter), sizeof(uint32_t), NULL, (sockaddr*)&recvAddress, &recvAddressSize) > 0) //<-Never receiving a message { recvPacketCounter = ntohl(recvPacketCounter); std::cout << "Client - [Sender Port: " << ntohs(recvAddress.sin_port) << "] Received packet: " << recvPacketCounter << std::endl; } Sleep(g_sleepDuration); packetCounter += 1; } } int main() { char input = 0; while (input != 'c' && input != 's') { std::cout << "Enter 'c' for client or 's' for server:"; std::cin >> input; } if (input == 's') runtype = RunType::Server; else runtype = RunType::Client; WSADATA init; if (WSAStartup(MAKEWORD(2, 2), &init) != 0) { std::cerr << "WSA Startup failed with error code: " << WSAGetLastError() << std::endl; return -1; } if (runtype == RunType::Server) { DoServer(); } if (runtype == RunType::Client) { DoClient(); } WSACleanup(); std::cout << "Program end." << std::endl; return 0; }
    37. Don't mean to necro this or go off topic, but does anyone have any experience rendering colored emoji's? I can render emoji's just fine (using char32_t) The problem is actually when trying to load a colored font, which I expected this one to be. I've tried 3-4 different fonts that are labeled as colored but FT_HAS_COLOR() seems to always return false on the font.. I am supplying FT_LOAD_COLOR into FT_Load_Char flags, but it doesn't seem to do much. I am expecting pixel_mode to be set to FT_PIXEL_MODE_BGRA as it says in the documentation, but I always get FT_PIXEL_MODE_GRAY. Any help would be greatly appreciated! Thanks
    38. 8Observer8

      c# console snake game

      If you add DrawRactange() method then drawing food will be easier: struct Food { public int x; public int y; }; List<Food> foods = new List<Food>() { new Food() }; private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = this.CreateGraphics(); DrawRectangle(g, 340 + x, 280 + y, Color.Green); DrawRectangle(g, 330 + x, 280 + y, Color.Black); foreach (var f in foods) { DrawRectangle(g, f.x, f.y, Color.Red); } g.Dispose(); } How it looks now: using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; namespace SnakeByPhil_WinFormsGDI { public partial class Form1 : Form { public Form1() { InitializeComponent(); CenterToScreen(); timer1.Interval = 200; timer2.Interval = 500; timer2.Start(); } int x = 0, y = 0; Random rnd = new Random(); int move = 1; struct Food { public int x; public int y; }; List<Food> foods = new List<Food>() { new Food() }; private void timer2_Tick(object sender, EventArgs e) { move = rnd.Next(1, 5); int food_x = rnd.Next(0, 290); int food_y = rnd.Next(0, 290); foods.Add(new Food() { x = food_x, y = food_y }); } private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = this.CreateGraphics(); DrawRectangle(g, 340 + x, 280 + y, Color.Green); DrawRectangle(g, 330 + x, 280 + y, Color.Black); foreach (var f in foods) { DrawRectangle(g, f.x, f.y, Color.Red); } g.Dispose(); } private void DrawRectangle(Graphics g, int x, int y, Color color) { SolidBrush brush = new SolidBrush(color); Rectangle rect = new Rectangle(x, y, 10, 10); g.FillRectangle(brush, rect); brush.Dispose(); } private void timer1_Tick(object sender, EventArgs e) { switch (move) { case 1: for (int i = 0; i <= 20; i++) { x++; } break; case 2: for (int i = 0; i <= 20; i++) { x--; } break; case 3: for (int i = 0; i <= 20; i++) { y++; } break; case 4: for (int i = 0; i <= 20; i++) { y--; } break; } if (MouseButtons == MouseButtons.Left) { } Invalidate(); } } }
    39. So I finally did it: float p = -cinematicDOF.focusPosition.z; float f = (p + cinematicDOF.i) / (p * cinematicDOF.i); float d = -fragPos.z; //float d = sqrt(pow(cinematicDOF.focusPosition.x - fragPos.x, 2) + pow(cinematicDOF.focusPosition.y - fragPos.y, 2) + pow(fragPos.z, 2)); dofBuffer = abs((cinematicDOF.a * f * (p - d)) / (d * (p - f)));
    40. phantomus

      RTX path tracing demo

      An updated demo is now available. FIltering has been added, along with TAA and sharpening. Performance has greatly improved for pre-RTX hardware; a 1060 will get you ~25fps. Link: https://ompf2.com/viewtopic.php?f=8&amp;t=2158
    41. ok create another gameobject and test animation with it with the same script and check if the problem still exist
    42. On my first attempt, I managed to somehow get stuck on that desk in the top right corner, between the down-pointing wing and the NPC standing there. Could move left/right sporadically, but could not move down. Also, it seems like there are other invisible obstacles even when you haven't just killed something. Otherwise, I like it.
    43. 8Observer8

      c# console snake game

      @phil67rpg what do you think about this improving of your code? Let's to rewrite this method: private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = this.CreateGraphics(); SolidBrush greenBrush = new SolidBrush(Color.Green); SolidBrush blackBrush = new SolidBrush(Color.Black); SolidBrush redBrush = new SolidBrush(Color.Red); Rectangle rect_green = new Rectangle(340 + x, 280 + y, 10, 10); Rectangle rect_black = new Rectangle(330 + x, 280 + y, 10, 10); Rectangle rect_red = new Rectangle(food_x, food_y, 10, 10); g.FillRectangle(greenBrush, rect_green); g.FillRectangle(blackBrush, rect_black); g.FillRectangle(redBrush, rect_red); redBrush.Dispose(); blackBrush.Dispose(); greenBrush.Dispose(); g.Dispose(); } I think it looks better: private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = this.CreateGraphics(); DrawRectangle(g, 340 + x, 280 + y, Color.Green); DrawRectangle(g, 330 + x, 280 + y, Color.Black); DrawRectangle(g, food_x, food_y, Color.Red); g.Dispose(); } private void DrawRectangle(Graphics g, int x, int y, Color color) { SolidBrush brush = new SolidBrush(color); Rectangle rect = new Rectangle(x, y, 10, 10); g.FillRectangle(brush, rect); brush.Dispose(); }
    44. Omg... I just realized that the Unreal Engine exists. And they have a forum where you can find jobs... I guess I'll just learn how to make games with Unreal Engine and then apply for one of the jobs. I need to learn this anyway because I want to make games with UE4 in the future. So... Problem solved, I guess? Btw. why can't I edit my previous post?
    45. phil67rpg

      c# console snake game

      yeah!! observer I put the food in the form_load method and it works, thanks for all the input.
    46. 8Observer8

      c# console snake game

      I do not understand where and when the food must be drawn. Please, explain me. It is better to write it in Paint. For example, you can generate next food when the snake eat one. Or do you want to generate food periodically? For example, every 5 seconds?
    47. nsmadsen

      Game audio production milestones

      Again, it really depends on the team and project. I've had milestones like so: 1) Establish how many themes will be needed across the entire game. (Pre-production) 2) Get a working version (i.e concept) of X amount of these themes. 3) Get approval of these concepts. Get paid a percentage. 4) Create finalized versions of these themes. Depending on your role in the project this could also involve implementing the audio. 5) Get approval of the finalized versions. 6) Get paid rest of the balance. At any time scope and direction of the game may (and usually does!) change so then you have to reassign the scope. I've also had milestones where I literally created some sound effects, threw them over to the client and then got paid while they did everything else. Then I've had projects where I created all of the sound design, music and implemented and set up everything myself. It all depends. There's not set standard. It's literally a by-each-project process.
    48. phil67rpg

      c# console snake game

      observer your code still draws the food all over the screen
    49. BitsNPiecesMusic

      Bits & Pieces Music

      Hey everyone! Sorry it's been so long again. I've been pretty busy and am in the process of relocating across the country (crazy, I know!). Still, I've been working on music every single week, and am in the process of awaiting some digital stores to sell my next album, Infinite Continues. This track I'm sharing with you today isn't on any album, but is merely a work in progress I created over the weekend. It's a little back to my old roots, which is what I do in between trying new things. Anyway, here's "Return Fire" Enjoy!
    50. Hello everyone, I am a Games Tech and Design student in my second year and I have made a game on the side for mobile. I want to publish the game in the Play Store for Android and I do not want to make money out of it. I just want to have a free game on the play store because I want to experience publishing games on platforms accessible to majority of people and enjoy what I have done. The problem is i do not know anything about copyright laws and legal stuff and I have used some assets from the internet where they have said the asset can only be used for personal use. I want to know if I could get in trouble for using those stuff for a free game (no monetization). and if i have to refer the original creator, how would I do it? Sorry if it is a common and silly question but I have no idea whatsoever on the legal stuff. I looked it up on the internet and have found out that if the game does not make money i can publish it and some said that i could get into legal trouble if i am not careful about it. Thanks, muttsang
    51. mysteriousmonkey29

      Options/Advice for Selling Mod on Open-Source Game?

      Huh, that's cool. That is definitely more similar to my idea. The main differences are: -I want to do it with an existing RTS game so it can have better graphics and more complicated underlying game mechanics (hence the mod) -I want players to be able to control units concurrently with the AI they write. so you don't have to start out writing code, and you don't ever have to write it if you don't want. the idea is that it might attract people who have less of a coding background, then when they see that coding helps others win, and how they do it, they might give it a try. and it allows human-AI comboing, which I've always thought it is really cool -I want to include a tutorial series on how to program basic AI within the game so it appeals more to people trying to learn. Yeah so I just looked at the subscription plan, and it looks like there's a flat fee to buy the game, then a subscription fee for extra AI time. So I guess you can write more memory-intensive programs if you pay for the subscription? Is that the deal? Back to the business-model thing, I came up with a potential issue with making money hosting servers for competitive play; if it is successful, since the game and the source code would have to be released under GNU GPL, there's nothing to stop another company from taking exactly the same game mod and hosting competitive play on their servers. The only advantage I would have it momentum, because people like to play where others play, etc. But this could be easily beaten by price undercutting, especially by a more established company. However, if this happened, it would at least validate the popularity of the idea, and maybe justify the much larger investment in making my own RTS from the ground up with this programmability built in, after feedback on the mod version from users. Thoughts?
    52. Hi Hashbrown. Regarding FPSs: I’m the one who started the previous thread linked in Hodgman’s post. Since that thread, I’ve quietly done steady work on the game. It's not a FPS, but the mechanics and networking code are similar. We did a small WebSocket multiplayer test last week and it went really well. That was five players in Jordan connecting to a VPS in France. You can get an idea of just how “fast paced” the game is here. The server is off at the moment, but you can still see how responsive the movement is, the use of inertia, projectile speed, etc. - it's less twitched-based than some shooters. As mentioned in the thread, I’m round-robining over five WebSocket connections. It’s working well so far, but I plucked that number right out of a hat - I haven't tested other configurations to make any kind of comparison, and I haven't tested with a large number of players. (If you want to observe the networking in action, PM me and I'll figure out a time to have the server on.) In light of all that, my preliminary observation is that WebSockets could work OK for a FPS. But I think the networking code needs to be extra good (naturally), and there are definitely some allowances I have made because of the less-than-ideal TCP/browser environment. For example, my clients have more authority over their position than is typical in a multiplayer shooter. This mitigates the effect of interruptions in the flow of updates from the client to the server but makes it harder to prevent cheating (a particularly big problem because users can use the browser itself to easily access and change some parts of the game's code). You should also have a look at multiplayer shooters (2D or 3D) among the ".io" games. That should give you a good idea of what's already been done. In my opinion, most have a sluggish feel. Most don't seem to do any kind of client prediction, but I suspect that has more to do with the way these games are programmed than with limitations imposed by the WebSocket platform itself. Regarding RTSs and RPGs, these seem like ideal applications for WebSockets.
  • 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!