Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411488 Posts in 69371 Topics- by 58427 Members - Latest Member: shelton786

April 24, 2024, 12:50:23 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsOpinions needed please see latest post
Pages: 1 [2] 3 4
Print
Author Topic: Opinions needed please see latest post  (Read 6663 times)
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #20 on: January 31, 2015, 01:06:24 AM »

You dont give yourself enough credit. SDL is a fine way to go. It's merely a way to get rid of the busy work so you can work on your game and engine.

The project is looking great Smiley
Logged

martian_automaton
Level 0
**



View Profile
« Reply #21 on: January 31, 2015, 01:35:31 AM »

You dont give yourself enough credit. SDL is a fine way to go. It's merely a way to get rid of the busy work so you can work on your game and engine.

The project is looking great Smiley

Thank you for the support. Hopefully I can contribute something useful soon.
Logged

martian_automaton
Level 0
**



View Profile
« Reply #22 on: January 31, 2015, 11:42:57 PM »

Finally got anti-aliasing working! It looks so much better now. Here's a before/after:



Enhance!
Logged

bsp
Level 1
*



View Profile
« Reply #23 on: January 31, 2015, 11:47:41 PM »

it's really cool to see people work this low level

Logged

martian_automaton
Level 0
**



View Profile
« Reply #24 on: February 01, 2015, 12:03:01 AM »

it's really cool to see people work this low level

I think I must be a masochist! Tongue BTW your game looks awesome!! System Shock 2 with silliness? I'm so buying it when it's done!!   AddictedHand Money Right
Logged

Sunsiro
Level 0
**


View Profile
« Reply #25 on: February 01, 2015, 05:39:45 AM »

Wow, this looks really nice! It kind of feels like The Simpsons, which is really great!
Logged
martian_automaton
Level 0
**



View Profile
« Reply #26 on: February 02, 2015, 02:35:01 AM »

Wow, this looks really nice! It kind of feels like The Simpsons, which is really great!

Thanks! I was definitely inspired by The Simpsons and similar western cartoons. I still have a long way to go, though.
Logged

Schrompf
Level 9
****

C++ professional, game dev sparetime


View Profile WWW
« Reply #27 on: February 02, 2015, 05:01:15 AM »

How did you do the antialiasing? It certainly looks good!
Logged

Snake World, multiplayer worm eats stuff and grows DevLog
martian_automaton
Level 0
**



View Profile
« Reply #28 on: February 03, 2015, 12:29:41 AM »

How did you do the antialiasing? It certainly looks good!

Thanks! It's just simple supersampling (SSAA). Apparently it's not as efficient as the multisampling technique (MSAA) but it's easy to implement and looks slightly better. Considering the simplicity of this games' graphics I don't think (don't hope!) performance will be a big issue.
Logged

roboy
Level 0
**



View Profile WWW
« Reply #29 on: February 03, 2015, 06:17:58 AM »

This looks badass man! I always get awestruck when seeing people make their own engines, you sir, are awesome Gentleman
Logged

3D artist - www.roboy.me
Schrompf
Level 9
****

C++ professional, game dev sparetime


View Profile WWW
« Reply #30 on: February 03, 2015, 03:10:57 PM »

Ah ok, thanks for the explanation. And I agree: you have super-simple shaders there, so you should be able to render with massive Super Sampling easily. It's just... one of many pet ideas I want to try out some day is to solve the "triangle covers rectangular area" equation and somehow output the result to use in standard blending. Perfect antialiasing, if you will, but only for polygon edges. I saw your upscaled examples and thought: hey, someone beat me to it.
Logged

Snake World, multiplayer worm eats stuff and grows DevLog
martian_automaton
Level 0
**



View Profile
« Reply #31 on: February 04, 2015, 02:17:18 AM »

This looks badass man! I always get awestruck when seeing people make their own engines, you sir, are awesome Gentleman

Thanks for the compliments; they really help with motivation. Everyone on these forums have been really nice! Don't hold back with criticism, though. If you notice problems or think something is a bad idea, please let me know. Grin It hurts my delicate ego but in the end I appreciate it. BTW sorry I stalked you but your 3D models are awesome. I especially like the look of Finn from adventure-time and the game arcade machine.

Quote from: Schrompf
Ah ok, thanks for the explanation. And I agree: you have super-simple shaders there, so you should be able to render with massive Super Sampling easily. It's just... one of many pet ideas I want to try out some day is to solve the "triangle covers rectangular area" equation and somehow output the result to use in standard blending. Perfect antialiasing, if you will, but only for polygon edges. I saw your upscaled examples and thought: hey, someone beat me to it.

Ha! Then you've mistaken me for someone much cleverer than I! Tongue Don't worry; you're idea is still safe. I'm not nearly smart enough to do something like that. If you ever figure out how to do it you should publish your findings - I think a lot of people (including me!) would be interested. Also, considering you have a game on steam (my dream!), can I ask you a bunch of questions: How hard is it to get a game on steam? Does it cost money? What do you need to do programming wise to make it compatible with steam? Do you think it will be easier to get my game on there if it's free? I hope I'm not asking too much; basic answers are OK don't go to too much trouble. Thanks!
Logged

Schrompf
Level 9
****

C++ professional, game dev sparetime


View Profile WWW
« Reply #32 on: February 04, 2015, 06:24:14 AM »

No problem.

a) You get on Steam via Greenlight xor Publisher. Greenlight is a voting platform, so it depends alot on how sexy/silly your game is perceived by the players, and how much press coverage linking to your Greenlight page you can drum up. Publishers, on the other hand, are only with you if they smell revenue. And for that you need to have way more content and some really cool ideas.

We first started Greenlight, then were stuck with it when we found a publisher a few months later. Then we got greenlit another few months later, with some press coverage and one large Desura bundle to send people over to our Greenlight page. We had a full game to work with, we only revamped it at large for Steam.

b) Costs: 100US$ once, to be allowed to set up a Greenlight page. It filters out the spam, I think. At least most of it, Stone Simulator or some quick buck Unity screen saver scenes still got through :-(

c) Once you're on Steam, you get access to a library that you simply link into your executable and you're done. Call a setup function once, call one every frame to allow callbacks from Steam, call some other functions like Achievements and such when you feel like it.

d) I can't tell if "free" is easier or harder. On the Greenlight page nobody cares, I think. And in the store afterwards - I don't know. My personal experience is that I stay away from FreeToPlay games. I have a family, friends, other hobbies - I lack the time to play, not the money, so I avoid F2P grind fests.

Don't go down that route, please. Do not turn Steam into another app store, it's already bad enough.
Logged

Snake World, multiplayer worm eats stuff and grows DevLog
oahda
Level 10
*****



View Profile
« Reply #33 on: February 04, 2015, 08:15:46 AM »

Really cool engine. Can't say much. I had some questions but I read through the thread and they'd already been answered. c;

I suppose I might ask how the lighting works, in the engine and the shaders.
Logged

martian_automaton
Level 0
**



View Profile
« Reply #34 on: February 05, 2015, 12:43:46 AM »

No problem.

a) You get on Steam via Greenlight xor Publisher. Greenlight is a voting platform, so it depends alot on how sexy/silly your game is perceived by the players, and how much press coverage linking to your Greenlight page you can drum up. Publishers, on the other hand, are only with you if they smell revenue. And for that you need to have way more content and some really cool ideas.

We first started Greenlight, then were stuck with it when we found a publisher a few months later. Then we got greenlit another few months later, with some press coverage and one large Desura bundle to send people over to our Greenlight page. We had a full game to work with, we only revamped it at large for Steam.

b) Costs: 100US$ once, to be allowed to set up a Greenlight page. It filters out the spam, I think. At least most of it, Stone Simulator or some quick buck Unity screen saver scenes still got through :-(

c) Once you're on Steam, you get access to a library that you simply link into your executable and you're done. Call a setup function once, call one every frame to allow callbacks from Steam, call some other functions like Achievements and such when you feel like it.

d) I can't tell if "free" is easier or harder. On the Greenlight page nobody cares, I think. And in the store afterwards - I don't know. My personal experience is that I stay away from FreeToPlay games. I have a family, friends, other hobbies - I lack the time to play, not the money, so I avoid F2P grind fests.

Don't go down that route, please. Do not turn Steam into another app store, it's already bad enough.


Oh no that's not what I ment! By 'free' I didn't mean the 'free-to-play' model; I meant a straight up free game with no DLCs or micro-transactions or anything. It's a give-away! I figure if I can't make a popular game that costs nothing then I'll never be able to make one that DOES cost money. Grin

Anyway, Wow! Thanks for all the helpful info and advice!! That library integration sounds super simple. I'm glad; I thought it might be a major hassle - that's if I ever make anything that could get approved. Tongue Maybe one day ...

Quote from: Schrompf
Really cool engine. Can't say much. I had some questions but I read through the thread and they'd already been answered. c;

I suppose I might ask how the lighting works, in the engine and the shaders.


Hi! The lighting is very simple, even simpler than default OpenGL lighting. The shader that makes the black lines is just a simple post-processor effect that compares neighbouring pixels. I made a simple rendering pipeline system that takes in human-readable XML files at runtime and renders the scene according to those instructions. All the guts of the engine and game assets are left open for anyone to mod - a good modder could make my crappy programmer art 1000x better.
Logged

martian_automaton
Level 0
**



View Profile
« Reply #35 on: February 07, 2015, 05:12:30 AM »

Please help somebody!!  Beg

I've got a bug I can't figure out - I've been working on it all day and I'm going in circles. If anyway knows about OpenGL please take a look at my problem.

Triangles randomly disappear on some frames, sometimes. It's not reproducible so occasionally it's really bad but most of the time it doesn't show up so it's hard to test.



Here is the diff that introduces the error:
Code:
diff --git a/rendering_pipeline/advanced_shader.xml b/rendering_pipeline/advanced_shader.xml
index bc0420e..6f860d0 100644
--- a/rendering_pipeline/advanced_shader.xml
+++ b/rendering_pipeline/advanced_shader.xml
@@ -7,12 +7,14 @@
     <num_color_layers> 2 </num_color_layers>
     <color_layer0> color_buffer </color_layer1>
     <color_layer1> normal_buffer </color_layer0>
+    <resolution_multiplier> 4 </resolution_multiplier>
     <!-- color_layer2, "depth_buffer", is implicit if using_depth == true -->
   </world_scene_image>
   <pixelation>
     <using_depth_buffer> false </using_depth_buffer>
     <num_color_layers> 1 </num_color_layers>
     <color_layer0> pixel_buffer </color_layer1>
+    <resolution_multiplier> 4 </resolution_multiplier>
   </pixelation>
 </resources>
 
diff --git a/rendering_pipeline/basic_shader.xml b/rendering_pipeline/basic_shader.xml
index 10fe1b3..49e78fa 100644
--- a/rendering_pipeline/basic_shader.xml
+++ b/rendering_pipeline/basic_shader.xml
@@ -8,6 +8,7 @@
     <color_layer0> color_buffer </color_layer1>
     <color_layer1> normal_buffer </color_layer0>
     <!-- color_layer2, "depth_buffer", is implicit if using_depth == true -->
+    <resolution_multiplier> 1 </resolution_multiplier>
   </world_scene_image>
 </resources>
 
diff --git a/shaders/fragment/pixelation.fs b/shaders/fragment/pixelation.fs
index 8a06c7a..8980ee9 100644
--- a/shaders/fragment/pixelation.fs
+++ b/shaders/fragment/pixelation.fs
@@ -6,5 +6,14 @@ uniform int width;
 uniform int height;
 
 void main() {
-  gl_FragColor = 1-texture2D(pixel_buffer, gl_TexCoord[0].st);
+  gl_FragColor = vec4(0,0,0,0);
+  int counter = 0;
+  int size = 4;
+  for(int x = 0;x < size;x++) {
+    for(int y = 0;y < size;y++) {
+      gl_FragColor += texture2D(pixel_buffer, vec2(gl_TexCoord[0].s + x*(1.0 / (width*size)), gl_TexCoord[0].t + y*(1.0 / (height*size))));
+      counter++;
+    }
+  }
+  gl_FragColor /= counter;
 }
diff --git a/src/renderer/image_buffer.h b/src/renderer/image_buffer.h
index c43c709..ef76f2f 100644
--- a/src/renderer/image_buffer.h
+++ b/src/renderer/image_buffer.h
@@ -19,13 +19,16 @@
 
 class ImageBuffer {
 public:
-  ImageBuffer(int width, int height, XMLTree buffer_info) {
+  ImageBuffer(int port_width, int port_height, XMLTree buffer_info) {
     if(buffer_info.IsInvalid()) {
       std::cout << "Invalid image buffer.\n";
       return;
     }
 
     name = buffer_info.GetName();
+    resolution_multiplier = buffer_info.GetFloatValueOf("resolution_multiplier");
+    port_width *= resolution_multiplier;
+    port_height *= resolution_multiplier;
     num_colour_buffers = buffer_info.GetIntValueOf("num_color_layers");
     if(num_colour_buffers < 1 || num_colour_buffers > 3) {
       std::cout << "This is not a valid buffer count: " << num_colour_buffers << "\n";
@@ -33,7 +36,7 @@ public:
     }
 
     bool using_depth_buffer = buffer_info.GetBoolValueOf("using_depth_buffer");
-    Setup(width, height, using_depth_buffer);
+    Setup(port_width, port_height, using_depth_buffer);
 
     for(int i = 0;i < num_colour_buffers;i++) {
       std::string new_color_layer_name = buffer_info.GetStringValueOf("color_layer" + std::to_string(i));
@@ -42,6 +45,7 @@ public:
 
     if(using_depth_buffer)
       layer_names.AddItem("depth_buffer");
+
   }
 
   ~ImageBuffer() {
@@ -67,6 +71,7 @@ public:
   SimpleContainer<std::string> GetLayerNames() { return layer_names; }
   GLuint GetColorBuffer(int index) { return colour_buffers[index]; }
   GLuint GetDepthBuffer() { return depth_buffer; }
+  float GetResolutionMultiplier() { return resolution_multiplier; }
 
 private:
   void Setup(int port_width, int port_height, bool has_depth_buffer) {
@@ -102,12 +109,12 @@ private:
 
     glBindTexture(GL_TEXTURE_2D, previous_texture_binding);
     glBindFramebuffer(GL_DRAW_FRAMEBUFFER, previous_frame_buffer_binding);
-
   }
 
   int width, height;
   int num_colour_buffers;
   bool using_depth_buffer;
+  float resolution_multiplier;
 
   std::string attachment_names[4];
   std::string name;
diff --git a/src/renderer/pipeline/render_stage.h b/src/renderer/pipeline/render_stage.h
index e2695b8..ad2a403 100644
--- a/src/renderer/pipeline/render_stage.h
+++ b/src/renderer/pipeline/render_stage.h
@@ -49,10 +49,13 @@ private:
 
   void SetupOutputSource() {
     std::string output_location_name = render_stage_output->GetOutputLocationName();
-    if(output_location_name == "SCREEN")
+    if(output_location_name == "SCREEN") {
+      glViewport(0, 0, viewport->GetWidth(), viewport->GetHeight());
       ImageBuffer::RenderToScreen();
-    else {
+    } else {
       ImageBuffer* output_image = GetImage(output_location_name);
+      float resolution_multiplier = output_image->GetResolutionMultiplier();
+      glViewport(0, 0, viewport->GetWidth()*resolution_multiplier, viewport->GetHeight()*resolution_multiplier);
       output_image->RenderToImageBuffer();
     }
   }

It seems that the glViewport calls are messing with it. When I get rid of them, I'm fairly sure the bug goes away. But why would calling glViewport create such a non-viewport related bug? Does anyone have any idea what I'm doing wrong? Please help!

Logged

oahda
Level 10
*****



View Profile
« Reply #36 on: February 07, 2015, 05:31:30 AM »

Why don't you just keep glViewport removed, then, if that's all it takes to fix it? Do you have to use it? I just tried removing it from my own game and it actually made no difference. Everything was drawn properly just like before.
Logged

Schrompf
Level 9
****

C++ professional, game dev sparetime


View Profile WWW
« Reply #37 on: February 07, 2015, 05:47:00 AM »

Does this also happen on other people's hardware? Especially if it's growing over time, it might be a heating or memory problem on your GPU.

To me it looks like you have a view matrix or something that sometimes generates #INF or #NAN. Remove the head bobbing and everything else that might change the camera's parameters over time, then retry. If some triangles stay vanished as long as you don't move the camera, it's a hint. Maybe it's also a projection matrix with a huge near/far divisor, but that would probably fuck up way more than a few triangles. Still worth a look, though.
Logged

Snake World, multiplayer worm eats stuff and grows DevLog
martian_automaton
Level 0
**



View Profile
« Reply #38 on: February 07, 2015, 10:12:34 PM »

Does this also happen on other people's hardware? Especially if it's growing over time, it might be a heating or memory problem on your GPU.

To me it looks like you have a view matrix or something that sometimes generates #INF or #NAN. Remove the head bobbing and everything else that might change the camera's parameters over time, then retry. If some triangles stay vanished as long as you don't move the camera, it's a hint. Maybe it's also a projection matrix with a huge near/far divisor, but that would probably fuck up way more than a few triangles. Still worth a look, though.

Thanks for the hints. I've been running the game exclusively on Linux and I thought that maybe there was something wrong with the Linux drivers so I compiled and ran on Windows and it has exactly the same bug. Cry I removed all animation, head bobbing, the skybox, the weapon, and I've still got the error. I also added a check inside the code that looks at the vertex data just before it's put into glVertex3f and it's sane. Object positions are also always sane. I'm pulling my hair out over this!  No No NO

At one point I paused the video and saw this:


It's fading from flesh colour to grass colour across the triangle but this shouldn't be possible because each triangle only has one colour assigned to it. The only code that renders triangles is this:
Code:
  static void SetMaterialAndDrawTriangleAtIndex(Model* model, int index) {
    SetMaterialForTriangle(model, index);
    SetNormalForTriangle(model, index);
    DrawTriangle(model, index);
  }

  static void SetMaterialForTriangle(Model* model, int index) {
    MaterialRenderer::Render(model->GetMaterialForTriangle(index));
  }

  static void SetNormalForTriangle(Model* model, int index) {
    NormalRenderer::Render(model->GetNormalForTriangle(index));
  }
   
  static void DrawTriangle(Model* model, int index) {
    VertexRenderer::Render(model->GetVertex(index,0));
    VertexRenderer::Render(model->GetVertex(index,1));
    VertexRenderer::Render(model->GetVertex(index,2));
  }

The material renderer is only called once so how can it produce A triangle with a gradient? I feel like the OpenGL calls aren't happening in order or glVertex3f commands are occasionally being dropped (I'm not doing any multi-threading BTW). I find I can stop the error if I call glFlush and glFinish for every single model but that slows it down to 15fps.

Does you (or anyone!) have any ideas on what I might try next?

Quote from: Prinsessa
Why don't you just keep glViewport removed, then, if that's all it takes to fix it? Do you have to use it? I just tried removing it from my own game and it actually made no difference. Everything was drawn properly just like before.

Thanks for the comment. I'd like to do that, but I'm rendering to surfaces of different resolutions. For example, I render to an image 4x the resolution of the screen and down-sample that for the 4XSSAA (i.e. glViewport(0,0,width*4,height*4). Is there a way to do this without calling glViewport?
Logged

danieru
Level 2
**



View Profile WWW
« Reply #39 on: February 07, 2015, 10:39:33 PM »

So we know for sure two things are happening:

1. Some vertice's positions are getting mangled to something much higher
2. The mangled vertice's colors are shifting to a different color used elsewhere.

Have you tried setting the SSAA to 1x to test if it is the OpenGL call itself? It appears the engine is not using VBOs so it should not be GPU side corruption. I would create a small world with just a super high poly terrain. Then in the shader recolor the vertexes based on the position but clamp the position to something sane. That should make it easier to trigger the bug and make it clear when vertices get mangled.
Logged

Pages: 1 [2] 3 4
Print
Jump to:  

Theme orange-lt created by panic