Jump to content
  • Advertisement

FFA702

Member
  • Content Count

    26
  • Joined

  • Last visited

Community Reputation

158 Neutral

About FFA702

  • Rank
    Member

Personal Information

  • Role
    Business Development
  • Interests
    Business
    Programming
  1. I have 2 questions about quad trees. I'm planning to use quad trees for sphere-sphere, sphere-point, sphere-line and sphere-point collision detection. 1: How often do you typically update the tree ? Every frames ? Every time something changes in the scene (I have no trigger for that, but it shouldn't be hard to implement, however in my games stuff moves about every update tick) 2: How do you detect the number of object in each nodes ? Simple square test for each objects ? Isn't that inefficient if the purpose is to reduce calculations ?
  2. FFA702

    Unity, how to deal with large amount of projectiles.

    I'm not familiar with unity but surely there is some quadtree tool? Usually the trick is to subdivide your collision detection into many smaller area. I'm not super knowledgeable in the subject but this is usually pretty straightforward to implement.
  3. Well thanks for the answers, I had a look at blender export formats. How hard would it be to write a plugin to export from blender in my own format? Would that be a good compromise? My 3D engine right now is more a learning platform than anything serious and the main focus point is my custom game IDE, I don't mind doing stuff in "hacky" ways for now. Chances are I'll end up redoing all these components later if I want to do something serious with it.
  4. Let me preface this by saying that I am not familiar with 3d modeling at all. In fact I know almost nothing about it. This is perhaps why I've decided to write my own 3D model format and my own 3D modeling software from scratch (I didn't want to deal with existing formats, which seemed quite complex for what I wanted to do) . Now my 3D modeling software is quite adequate for small things, but it's really slow to use and unfit for organic shapes. My 3D model format is very simple; -25,4.48,-25:251,252,250 -24,4.58,-25:250,253,250 -25,4.62,-24:250,252,251 -24,4.58,-25:250,253,250 -24,4.62,-24:250,253,251 -25,4.62,-24:250,252,251 -25,4.62,-24:250,252,251 -24,4.62,-24:250,253,251 ... It's broken in 2 part, the first 3 numbers (separated by ',') are floating point values representing the location of a vertex and the last 3 numbers represents the RGB value of the color of that vertex. Triangles are simply drawn by taking the first 3 vertex, then the next 3, etc till the whole list is drawn. Of course once loaded this data takes the form of a model class, which is a list of instances of a small vertex class. As you can imagine, this is probably the simplest way to store a model that contains "textures" (which I use loosely), but is good enough for my game. I've looked at several model format but mine seems quite unique at what it does. Is there anything like it out there? I would like to write a small converter to take models made with more competent 3D software and use them in my engine. Another option would be to write a plugin for an existing 3D modeling software, but I am unsure on how I would go about that since I have almost no experience with them. Could anyone point me in the right direction? At first it seemed like a reasonably simple thing to do but the more I investigate the question the more I think I'll just have to spend a few days fleshing out my own 3D modeling software.
  5. I got the performance down to an acceptable level (it now takes less than a second to load my stress test game, which is 13 mb large). Thank you all for your input. I did two things to get it there; first I used a stream writer and wrote the file bit by bit instead of constructing a huge string and secondly I stopped doing my conversions bit by bit and instead did array wise converting (which I didn't know you could do). I certainly learned alot, which was purpose of writing this engine. @Nypyren thank you for your lengthily explanation. A small comment though is that the behavior you get by converting an int32 to a char is exactly the behavior I want to get. Maybe I was not clear on this but all my data first passes an intermediary string stage before getting converted to unicode code, and then it get serialized by the processing of putting char delimiter infront of each strings. If you look at the attached file in my first post you will understand the method, which is perhaps not the best one, but one that works really well for my purpose. I find all of this very encouraging as it's kind of a lifelong dream to write my own 3d engine and make an adventure game with it. In the span of 1.5 months I now have a game editor (complete with a scene view and pretty much every feature I need) and a 3d engine that supports pretty much almost everything I need to make that adventure game. I will probably close the project in a short while when I'm done making the game itself and write an article on it. (I think that people, even newbe, don't realize how quite accessible it is to make a game from scratch if you are willing to do things the simple way instead of the proper way) Next project I do will probably be on a proper fully featured game engine, like Unity3D.
  6. Now that's interesting. The only reason I do it that way is because like many, I'm a self thought programmer and I've always done it this way in the past. The reason I have this byte[] system is because I use String.Split() to unwrap the content of the file and fill my game state, and the file itself contains script that might contain the characters I use as delimiter. So if I wanted to minimally alter my code could I write the byte[] directly to the file but still put my delimiter characters between each items I pass to my function ? The save file string itself is just a bunch of encoded characters with several delimiters throughout. This is what it looks like : https://pastebin.com/ENUgGHrG (it's also attached in the post if the link stops working) What I like about this single "game state dump" solution is that my game is essentially a single file. I can open this file in my editor and modify everything from there and even handle casual end user save/load by dumping the whole game state into a file and essentially create a new game. It's really elegant and since I don't expect my game to be more than a few mb (i have my own ultra low poly model format, and use most of what is provided by the c# form classes for the interface) , I can't really see why it wouldn't work. I'd really like to keep it that way. TestCopy2.txt EDIT: I've tried your suggestion (I think) using BinaryWriter but it's pretty useless in my use case because using ".Write(Encoding.ASCII.GetBytes(string i want to encode and write))" it just writes the string verbose which defeat the whole purpose of encoding it first. EDIT2: I've got it working by using mellinoe method. Now the loading system has the same problems. This is trickier because it's not reading the file that pause problem, it's the actual operation to reverse the serialization. Here is the code. I'm having some serious issues with this. static string Unserializebyte(string bytes) { string UnserializedBytes = ""; string[] EncodedBytes = bytes.Split(' '); foreach (string charx in EncodedBytes.Take(EncodedBytes.Length-1)) { try { int chary = Convert.ToInt32(charx); UnserializedBytes += (char)chary; } catch (Exception) { //throw; } } return (UnserializedBytes);
  7. FFA702

    License for a game maker

    It's definitely more involved than I thought. Thanks for the answer frob.
  8. I have a save/load function in my 3D engine which was working quite well in the past. I've just added terrains (which are very small, no more than 100 triangles big) but I can't get them trough my save/load pipeline. They're quite a bit larger than any single model I've had to deal with in the past. I have no problem loading the model in my engine, it takes less than a second, but I have a problem serializing it for my game save/load function which uses a different format than my model format. The whole terrain model file looks like this: -25,4.48,-25:251,252,250 -24,4.58,-25:250,253,250 -25,4.62,-24:250,252,251 -24,4.58,-25:250,253,250 -24,4.62,-24:250,253,251 -25,4.62,-24:250,252,251 -25,4.62,-24:250,252,251 -24,4.62,-24:250,253,251 ... but this is nearly irrelevant as my save function only serializes the string using : data += Serializebytes(Encoding.ASCII.GetBytes(entity.model.StringContent)); where Serializebytes() is : static string Serializebytes(byte[] bytes) { char byteSep = ' '; string byteString = ""; foreach (byte byten in bytes) { byteString += byten.ToString(); byteString += byteSep; } return (byteString); } The problem really is with my serialize bytes method, the program hangs there as it takes forever to process. This worked fine for the very small model that composed my previous scenes but does not for the terrain. The function is simply supposed to take the bytes given by Encoding.ASCII.GetByte() and put a space between them. I figure this is something that should be relatively fast, even with very large amount of data. The perfect solution would be a simple function that would replace Serializebytes(). Thanks in advance guys.
  9. I've been working on a small 3D game maker app for a while, but it's now shaping up to be a full fledged (albeit simple) all integrated 3d engine. I think it's promising in the sense that I've built the App I would want to use, and I can see people (mainly beginners) using it for a lot of applications. It has no name yet. I don't plan on making it open source or selling it. I'm just considering setting up a small website with some documentation and a download link. What kind of license would I join with the tool given that: I want people to be able to use it freely I want to be completely free of responsibility I want to prevent people from removing, let's say (hypothetically, not sure how I'd go about this yet), a small banner advertising my software at startup from the application the software would produce The tool was developed in visual studio community 2017, using C# and a single external library, openTK Is there anything else I should think about ? Perhaps when naming it ? EDIT: Also, what about, let's say, a logo, or a design pattern (Artistically speaking) I would use throughout the program and the documentation to make it easily recognizable. How would I go about protecting that ? Thanks guys
  10. Hi. It's been a while since I posted here, and my last posts are almost about this exact same subject. Just saying to demonstrate how annoying this is to me. Here is the problem : I'm trying to make a decent raycaster in C#. The main issue is that for this to happen, I need pixel by pixel drawing. My previous raycaster used VS GDI+, and trough several tricks involving pointers and filling a bitmap byte by byte, I was able to obtain half decent results, and make an online server-client style 3d engine complete with a map builder and several really cool features. I unfortunately wasn't able to expand the project further due to poorly written code (I am an hobbyist, I study Business Administration at Uni) and the fact that my quick hack for performance was barely able to carry the bare minimum of what I needed to make a very bare bone raycaster possible. This came with very real sadness, the realization that the project I spent almost 2 years on was essentially useless, bloated and impossible to expand on. Enough background. Now, starting anew, my main concern is to find a way to gain fast pixel by pixel control over the screen. I'm using SFML and C#. My current testbench is pretty simple, I'm using a method I found on the internet written for C++. I Adapted it for C#. I'm filling a Color[,] array (each color is a pixel) and then I copy the RGB values inside a byte[] array before moving them inside the texture buffer. I then display the texture on the screen. I'm not sure what the bottleneck is, the application is faster than my previous one, but it's still too slow for my liking. Raycasters work by redrawing stuff ontop of other stuff, and I fear that adding more stuff would creep it to an halt. I'm posting what I have as a testbench right now, any help would be greatly appreciated. Keep in mind I am not a professional programmer by any mean, I am pretty uncomfortable with pointers and true 3d stuff, but I will use them if I must. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using SFML.Audio; using SFML.Graphics; using SFML.System; using SFML.Window; namespace RayCastFF { class Program { public static int TestCounter = 0; public static Color[,] ScreenBuffer = new Color[640, 360]; //an array containing the color of all the pixel, this is intended to be the main target of all manipulation and draw call public static Texture MainViewPort = new Texture(640, 360);//main screen texture unsafe static void Main(string[] args) { //MAINWINDOW SETUP RenderWindow window = new RenderWindow(new VideoMode(640, 360), "RayCaster"); while (window.IsOpen)//MAIN GAME LOOP { //CALL FOR UPDATE Update(); //DRAW window.Clear(); window.DispatchEvents(); Sprite mainviewport = new Sprite(MainViewPort); window.Draw(mainviewport);//draw the texture over the screen window.Display(); //TAKE INPUT } } static void Update() { TestCounter++; if (TestCounter > 639) { TestCounter = 0; } //RESET THE BUFFER (COULD BE REMOVED LATER I GUESS) for (int x = 0; x < 640; x++) { for (int y = 0; y < 360; y++) { ScreenBuffer[x, y] = Color.Black; } } //DO STUFF DrawLine(Color.Red, TestCounter, 200, 100); //(for this test, i simply draw a moving line) //WRITING THE BUFFER INTO THE IMAGE //THIS SHOULD ALWAYS BE THE LAST STEP OF THE UPDATE METHOD byte[] pixels = new byte[640 * 360 * 4]; //640 x 360 pixels x 4 bytes per pixel Color[] cpixels = new Color[640 * 360];//intermediary step to keep everything clear for (int x = 0; x < 640; x++) { for (int y = 0; y < 360; y++) { cpixels[x+(640*y)] = ScreenBuffer[x, y];//make an intermediary array the correct dimention and arrange the pixels in the correct position to be drawn (separate step to keep everything clean, I find this operation incredibly confusing mainly because I had no idea how the pixels are supposed to be arrenged in the first place(still kind of dont)) } } for (int i = 0; i < 640 * 360 * 4; i += 4)//fill the byte array { pixels[i + 0] = cpixels[i / 4].R; pixels[i + 1] = cpixels[i / 4].G; pixels[i + 2] = cpixels[i / 4].B; pixels[i + 3] = cpixels[i / 4].A; } MainViewPort.Update(pixels);//update the texture with the array } //[X , Y] static void DrawLine(Color color, int Wpos, int Ytop, int Ybottom)//simple draw method making a vertical line { for (int y = Ybottom; y < Ytop; y++) { ScreenBuffer[Wpos, y] = color; } } } } What I'd like to end up with is a very fast way to draw the pixels on the window by the abstraction of a single 2d array of 640x360 unit that I could easily and simply manipulate. However, while being simple, it's also somewhat slow. It's also using 30% GPU load for some reason on a 1070GTX 8GB. Again, any help would be greatly appreciated. Thanks in advance.
  11. You could always try raycasting, it's fun and easy to understand. Took me about 3 days to implement the framework in C# for a multiplayer RPG i'm still working on. Gives that cool retro look and you only need high school math to understand the inner working, so it's very flexible and workable.
  12. Hi, i'm making a real time multiplayer app in C#. So far it's been going well, pretty much everything is working but I need a solution to draw my pixels faster. So far I'm drawing individual pixels on a bitmap using lockbits. It's faster than set pixel and it seems to be the fastest way to do it without a competent graphic library. So I'm asking if anyone here knows a very fast graphic library where one can set individual pixels on a bitmap andthen draw it; or something similar.   Thanks you.
  13. I'm writing a very simple Voxel Raytracer for fun. The voxels are stored in a 3d array and here is the code that stores them to create a sphere. if ((Math.Pow((cx - 200), 2) + (Math.Pow((cy - 140), 2)) + (Math.Pow((i - 10), 2)) == Math.Pow(50, 2))) { Map[cx+d, cy+d, i+d] = 2; } [attachment=30289:sphere.png]   However, the sphere seems to be composed of an extremely tin pixel density. I suppose this has something to do with the pixels being integers. It still gives a nice effect but i was wondering if anyone here had any idea to improve the pixel density on the surface of the sphere.   PS: also do you know any resources on how to fill the surface of certain prism via general equations ? I can't seem to find any.
  14. Yes, i am sure it's the bottleneck because when i comment out the whole block of code it runs very fast, but i see no apparent improvement when i comment out my setpixel method. May i have some guidance about these profiler or optimization feature ? I never used them.   EDIT: My resolution is very small, no more than 700x350 pixels
  15. Done, thanks alot for the help. Now the optimization problem persist and the only solution that intuitively comes to my mind is rendering at a lower resolution.
  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!