Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1369501 Posts in 64351 Topics- by 56368 Members - Latest Member: concrete_games

November 20, 2019, 02:23:59 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)The happy programmer room
Pages: 1 ... 275 276 [277] 278
Print
Author Topic: The happy programmer room  (Read 544737 times)
InfiniteStateMachine
Level 10
*****



View Profile WWW
« Reply #5520 on: August 20, 2019, 05:20:57 PM »

Princessa : In regards to the ability to have a lot of lights. Are we talking lots of shadow casting lights?

The reason I ask was because the technique looks similar to a deferred style but if you can have a lot of shadow casting lights then that's really awesome. (edit, not that it's not already awesome, just more so Smiley )
Logged

Prinsessa
Level 10
*****


Ava Skoog


View Profile WWW
« Reply #5521 on: August 21, 2019, 03:08:15 AM »

All the shadows would be composited in one step this way, but you’d have to render shadow maps from the perspective of every light unless there is some technique I don’t know about so dunno how performant that would be.
Logged

InfiniteStateMachine
Level 10
*****



View Profile WWW
« Reply #5522 on: August 21, 2019, 08:53:43 AM »

All the shadows would be composited in one step this way, but you’d have to render shadow maps from the perspective of every light unless there is some technique I don’t know about so dunno how performant that would be.

Have you tried seeing how far you can push it? I'd be curious to know. Unreal engine has a thing where if there are more than 4 lights on a fragment (polygon? can't remember) it starts ignoring lights influences on the surface.
Logged

gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #5523 on: August 21, 2019, 09:15:49 AM »

In order to implement that "wall of text" Global Illumination solution, I need to look at space partitioning ... I looked at voxelization briefly and realized that I could rasterized directly into a voxel texture in open GL  using bitfield trick. That is, hash the depth of the fragment to te voxel volume position, instead of z culling then bit insert it in the framebuffer ... which openGl  don't support, but we can abuse the fact that bitshift are x2 and x0.5 and find equivalence (there is difference in rounding I think) and we can abuse the fact it's just an "add" of number at specific position, the idea comme from overdraw shader, but instead of fixed transparency you inject the number of the bit position. While I was trying to solve the edge case (bit that write at teh same bit depth and jusxt reading bit as fast as possible) I found a paper that already do that, they used look up texture (8x256 and 1x8) to do that ... The end result is that you need 8 texture (3 x 8 renders on each axis to capture triangle) of 256 to get a 256 voxel cube (only volume data, no color or extra info), that's "kinda" cheap and practical. Most game don't have that range on vertical axis, so I probably could stop at a single 32x256² volume texture.

BUT voxelization was just a trail, I need to a limit of 256 probes to place, ideally I wouldn't want  to place a probe at each voxel, so I need to find way to aggregate volume in a smart way.
Logged

Prinsessa
Level 10
*****


Ava Skoog


View Profile WWW
« Reply #5524 on: August 21, 2019, 09:42:47 AM »

Good luck, Gimmy!! Kiss

Is there a problem in this industry as far as a proper payscale is concerned?

Short answer: yes. If I've understood correctly, the big companies (especially in the US) can get away with paying lower salaries and preventing their employees from unionising because there are so many people willing to work in the field that they can just hire someone else if anybody puts up a fight, so people are very much treated as disposable. /:

Have you tried seeing how far you can push it? I'd be curious to know. Unreal engine has a thing where if there are more than 4 lights on a fragment (polygon? can't remember) it starts ignoring lights influences on the surface.

I did try like 50+ point lights which barely differed performance-wise from just one, so without shadows it scales very well, but I haven't tested with shadows yet. But I also haven't implemented cascaded shadow maps yet (there is only one so far) so I guess I need to do that first.

Thing is I guess there are two ways of going about this:

1) pass everything into one render pass as uniforms and process it all in a loop, having prerendered one shadow map per light (which is what I'm doing ATM cos it was faster and easier to set up)

or

2) render one shadow map, do a composite step and apply that, then render another shadow map reusing the same texture as before, do another composite step and so on, and keep applying each shadow in its own pass which is theoretically infinite unlike using uniforms which have a limit to them (especially texture samplers) and uses less memory but probably takes longer.

What's best probably depends on the use case and since I'm not super interested in lots of different shadow sources (I might do two, one for the sun and one for the nearest lamp) I'm not sure I wanna change it up. D:
« Last Edit: August 22, 2019, 04:12:48 AM by Prinsessa » Logged

InfiniteStateMachine
Level 10
*****



View Profile WWW
« Reply #5525 on: August 21, 2019, 10:56:00 AM »

Fair enough, if you don't need it then you don't need it Smiley
Logged

ProgramGamer
Administrator
Level 10
******


The programmer of games


View Profile
« Reply #5526 on: September 09, 2019, 03:53:43 PM »

Logged

Schrompf
Level 6
*

C++ professional, game dev sparetime


View Profile WWW
« Reply #5527 on: September 09, 2019, 10:10:15 PM »

I like the "luambda" keyword. Apart from that I'm pretty sure you'd build a perfect lua func wrapper with arbitrary arguments with a few template lines. And now that I think of it, someone probably already did it and put it to github,
Logged

Snake World, multiplayer worm eats stuff and grows DevLog
Daid
Level 3
***



View Profile
« Reply #5528 on: September 09, 2019, 10:45:09 PM »

I like the "luambda" keyword. Apart from that I'm pretty sure you'd build a perfect lua func wrapper with arbitrary arguments with a few template lines. And now that I think of it, someone probably already did it and put it to github,
Actually, decomposing the function arguments into luaL_check* functions requires a bit of metaprogramming magic.

I've done both, registering C functions with templates in lua. And calling lua functions as if they are C functions (automatic conversion of parameters)

This is the start point for the function registering:
https://github.com/daid/SeriousProton2/blob/master/include/sp2/script/environment.h#L36

But the real magic starts here:
https://github.com/daid/SeriousProton2/blob/master/include/sp2/script/luaBindings.h#L143
Where you need to construct the function arguments from the lua stack.


(The whole code is a lot bigger, as it also handles binding to object functions, and direct property binding)
Logged

Software engineer by trade. Game development by hobby.
The Tribute Of Legends Devlog Co-op zelda.
EmptyEpsilon Free Co-op multiplayer spaceship simulator
Richard Kain
Level 10
*****



View Profile WWW
« Reply #5529 on: September 13, 2019, 08:45:49 AM »

Short answer: yes. If I've understood correctly, the big companies (especially in the US) can get away with paying lower salaries and preventing their employees from unionising because there are so many people willing to work in the field that they can just hire someone else if anybody puts up a fight, so people are very much treated as disposable. /:

Sadly, yes, this is the current state of affairs. What's even more infuriating is how short-sighted the whole mess is. Of all the industries out there, game development is one of those that benefit the most from experience. Seasoned, capable game developers are usually able to improve their efficiency and avoid pitfalls that rookies commonly run across. And this is also true of programming in general. I'm a far better and more efficient programmer now than when I first started out. Solutions to problems come faster and easier than ever before, frequently because I've encountered similar problems before and already know where and how to start working.

But the meat-grinder that is game employment basically insures that the current inefficiencies and crunch in the industry will constantly remain in place. The best way to combat that sort of structure is to have capable, experienced developers in charge of the production process. They're the one who are best suited to identify inefficiencies, establish tool-chains and processes, and train up-and-coming rookies. Yet the nature of the current game dev industry grinds developers up and burns them out before they can reach that point. The vast majority of developers leave the industry before their best days.

On a more personal note, I finally learned C++ recently, and have been having a lot of fun digging into some lower-level coding. Pointers, memory management, and header files confounded me for a long time. But some experience with Python and some practice tying a C library into Unity helped me to overcome that mental hurdle. Now I have an SDL2+OpenGL project running on my raspberry pi 3. Fun stuff.
Logged
Schrompf
Level 6
*

C++ professional, game dev sparetime


View Profile WWW
« Reply #5530 on: September 13, 2019, 10:55:45 AM »

Grats. It can be satisfying.
Logged

Snake World, multiplayer worm eats stuff and grows DevLog
ThemsAllTook
Global Moderator
Level 10
******



View Profile WWW
« Reply #5531 on: September 29, 2019, 01:54:06 PM »

I implemented something fun today... The game I'm currently writing has a mechanic where each participant in a battle has their own speed value, which charges up an invisible gauge to determine whose turn comes up when. I didn't want to repeatedly add the speed value to everyone's gauge to reach some arbitrary "full gauge" value, so the number that determines gauge fullness is based on the speed of the fastest participant. The fastest one will fill their gauge exactly every time gauge values change, while everyone else will add their own speed value to their gauge until it reaches the reference point and they get their turn.

My initial implementation worked fine, but there was one detail that kept bothering me about it. When the full-gauge reference value changes, it's necessary to rescale everyone's current gauge value, since the values now represent a different amount of time. I was doing this with integer multiplication and division, which would potentially lose information if there was an extreme speed difference - say there was someone with speed 2, someone with speed 3, and someone with speed 100, and the 100-speed participant died? Small relative differences between the two slower participants would be obliterated by truncating integer division.

Floating point numbers have inconsistencies between platforms, and fixed point numbers would still be lossy on a micro level, so I thought for a while about how I could make this rescaling lossless. I realized that what I actually wanted were fractional numbers where the numerator and denominator are stored separately. I added an IntegerFraction structure to my framework and implemented some basic arithmetic operations for it, and changed my gauges to use this representation for their current values. Now it can represent numbers like "4 and 1/7th" losslessly, so large rescales won't erase information anymore. Success! I hadn't worked with this representation of fractions before, and it was a lot of fun to puzzle out how to implement basic arithmetic and reduction with them. I'm pretty happy to have this tool in my toolbox now.
Logged

Daid
Level 3
***



View Profile
« Reply #5532 on: October 03, 2019, 04:39:20 AM »

Found out today that windows quite happily allows you to read your own exe file while it is running. And that you can append data at the end without windows giving any fuzz. AND that zip files are basically read from the end of the file instead of the start.

That combined, and some static linking tricks, means I can build my code into a single executable. No data files, no extra dependencies, just 1 exe download and run. No extracting nor installing.

Resources files in zip files was already a feature I had build, so that part was covered, other things I needed to do:
Logged

Software engineer by trade. Game development by hobby.
The Tribute Of Legends Devlog Co-op zelda.
EmptyEpsilon Free Co-op multiplayer spaceship simulator
ThemsAllTook
Global Moderator
Level 10
******



View Profile WWW
« Reply #5533 on: October 03, 2019, 05:12:32 AM »

Nice. A related thing happened to come across my Twitter feed yesterday: https://stackoverflow.com/questions/20278489/gcc-linker-options-format-binary
Logged

Daid
Level 3
***



View Profile
« Reply #5534 on: October 03, 2019, 06:28:51 AM »

There is actually a pretty big difference. The trick with converting a file into a area in your exe makes it actually a part of your exe. It's embedded (in a very compiler specific way) with the rest of your exe "data". It's also mapped into virtual memory at startup, which could cause issues on 32bit systems if you have a lot of data.

In my case, for the rest of my code, there is no difference if this comes from the zip at the end of the exe, a normal zip file, raw files on disk or android assets. Making development easier, as during development the resource files are just on disk.
I also don't need any special compile steps, other then the static linking and the post-processing.

While the LD trick needs to be build as part of your executable, and leaving it out causes the build to fail.


To my surprise, 7zip fails to open the resulting exe as a zip archive. I kinda would have expected it to just open it.
Logged

Software engineer by trade. Game development by hobby.
The Tribute Of Legends Devlog Co-op zelda.
EmptyEpsilon Free Co-op multiplayer spaceship simulator
Pineapple
Level 10
*****


~♪


View Profile WWW
« Reply #5535 on: October 05, 2019, 07:08:53 AM »

I know it doesn't look like much, but this is the culmination of years of on and off work on various libraries for facilitating cross-platform game development in the D programming language. Dlang is pretty good and I have wanted to be able to do my game development in easy idiomatic D for literal years. I am feeling very happy about this



Code:
import mach.sdl;

const vertSource = `
in vec2 a_position;

uniform vec2 u_screenSize;
uniform vec2 u_drawSize;
uniform vec2 u_drawPosition;

void main() {
    vec2 topLeftScreenPosition = (
        (vec2(+2.0, -2.0) * u_drawPosition / u_screenSize) - vec2(+1.0, -1.0)
    );
        vec2(+2.0, -2.0) * u_drawSize / u_screenSize
    );
    vec2 screenPosition = topLeftScreenPosition + (
        a_position * bottomRightScreenOffset
    );
    gl_Position = vec4(
        screenPosition.x, screenPosition.y, 0.0, 1.0
    );
}
`;

const fragSource = `
uniform vec4 u_color;

void main(){
    gl_FragColor = u_color;
}
`;

class Square: Application {
    GLProgram program;
    GLAttributeBuffer squareBuffer;
    GLVertexArray vao;
   
    // Initialize the window.
    override void initialize(){
        this.window = new SDLWindow("Prototype", 512, 512);
    }
   
    // After the window and OpenGL have been fully initialized, create OpenGL objects.
    override void postinitialize(){
        this.program = GLProgram(
            GLShader(GLShader.Type.Fragment, fragSource),
            GLShader(GLShader.Type.Vertex, vertSource)
        );
        this.program.link();
        this.program.use();
        this.vao.initialize();
        this.vao.bind();
        this.squareBuffer.componentType = GLTypeOf!float;
        this.squareBuffer.components = 2;
        this.squareBuffer.initialize();
        this.squareBuffer.set!float([0, 0, 0, 1, 1, 0, 1, 1]);
        this.program.attributes["a_position"].set(squareBuffer);
    }
   
    // Free resources from memory when they are no longer needed.
    override void conclude(){
        this.program.freeShaders();
        this.program.free();
        this.squareBuffer.free();
        this.vao.free();
    }
   
    // The main application loop.
    override void main(){
        this.program.uniforms["u_screenSize"].set(this.window.size);
        this.program.uniforms["u_drawSize"].set(this.window.size / 2);
        this.program.uniforms["u_drawPosition"].set(this.window.size / 4);
        this.program.uniforms["u_color"].set(Color.Green.rgba);
        this.program.drawArrays(GLPrimitive.TriangleStrip, 0, 4);
        swap();
    }
}

void main(){
    new Square().begin;
}
Logged
gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #5536 on: November 04, 2019, 08:05:57 PM »

It means nothing for you, just another monday and random images
for me it was the biggest bump into the road toward that global illumination implementation.

Atlas of octahedron cubemap


Logged

Prinsessa
Level 10
*****


Ava Skoog


View Profile WWW
« Reply #5537 on: November 07, 2019, 09:03:45 AM »

Yay, you did it!!
Logged

gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #5538 on: November 07, 2019, 11:08:11 PM »

Not yet

This was probably the hardest due to documentation, but I still have to implement the rest and see if result are good enough and not noisy or too artifacty
Logged

Prinsessa
Level 10
*****


Ava Skoog


View Profile WWW
« Reply #5539 on: November 11, 2019, 05:12:46 PM »

Still! c:

Nine months into working on my game, and a lot more than that into working on the engine as a whole, I'm finally getting around to an editor. I've just been manually putting entities and components into a JSON file up until now. Went and got the newish, fancy docking branch of ImGui and it's going smoothly so far!



Ended up deciding to just build it into the game itself (might be fun for modders too) if compiled with a flag set. Saves me having to do something clever to get the engine to know about game-specific C++ stuff and so on. Cheesy
Logged

Pages: 1 ... 275 276 [277] 278
Print
Jump to:  

Theme orange-lt created by panic