Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411490 Posts in 69371 Topics- by 58428 Members - Latest Member: shelton786

April 24, 2024, 05:57:52 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)General thread for quick questions
Pages: 1 ... 25 26 [27] 28 29 ... 69
Print
Author Topic: General thread for quick questions  (Read 135338 times)
oahda
Level 10
*****



View Profile
« Reply #520 on: January 29, 2016, 07:02:26 AM »

Yeah, I think I've actually had that issue before now that I think about it.
Logged

BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #521 on: January 29, 2016, 11:55:12 AM »

Yes, inline doesn't actually cause the compiler to inline the function nowadays. All it does is mark the function when compiling so the linker doesn't complain when two object files (i.e. two .cpp's sharing a header) have the function definition. It's thus necessary for all functions and methods that appear in a header.

The only reason you don't notice that you need it when you are starting out using the language, is that (for some reason) if you define a method directly inside the class (rather than having just the declaration), it is implicitly inline.
Logged
oahda
Level 10
*****



View Profile
« Reply #522 on: January 29, 2016, 12:00:22 PM »

Oh, was gonna ask about that.

BTW, re: branching in shaders being bad... I've started doing stuff, like v = 5 * float((a > b)) instead of if (a > b) v = 5; in my shaders to avoid using an if statement where I still need to do check a condition. Is this a solution? Does it only count as branching if I use if statements, making this safe? It's not just the mere use of booleans that introduces branching, right? Because the non-boolean values are just as variable... Seems like a no-brainer to me, but I'm asking just to be 100% sure.
Logged

qMopey
Level 6
*


View Profile WWW
« Reply #523 on: January 29, 2016, 01:24:17 PM »

Oh, was gonna ask about that.

BTW, re: branching in shaders being bad... I've started doing stuff, like v = 5 * float((a > b)) instead of if (a > b) v = 5; in my shaders to avoid using an if statement where I still need to do check a condition. Is this a solution? Does it only count as branching if I use if statements, making this safe? It's not just the mere use of booleans that introduces branching, right? Because the non-boolean values are just as variable... Seems like a no-brainer to me, but I'm asking just to be 100% sure.

Nope that's all good. a > b should generate some kind of cmp assembly instruction, returning a 1 or 0, then this is converted to a float, so no branching. This is a pretty common thing to do. Another common way to go about it is to set conditions as uniforms and then multiply the value into results. Lastly one can use a bitmask and a select operation to mix bits from two different calculations depending on the result of a comparison (like a > b): http://realtimecollisiondetection.net/blog/?p=90

Logged
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #524 on: January 29, 2016, 03:01:32 PM »

The shader compiler will probably know to do that sort of transformation for you, so in principle you shouldn't find any speed boost.
Logged
Pit
Level 0
***


View Profile WWW
« Reply #525 on: January 30, 2016, 03:52:20 PM »

There are by the way also the step and smoothstep functions which do exactly this, if you want something that looks cleaner.
Logged
Glyph
Level 10
*****


Relax! It's all a dream! It HAS to be!


View Profile
« Reply #526 on: February 07, 2016, 09:30:46 AM »

I started using GitHub for the first time for a team project in Unity, and I gotta say that I find it wildly inferior to other revision control systems I've used - unless I have some misconceptions. So if anyone wants to clear them or at least state good alternatives to these issues I see, I'm all ears:

GitHub seems to only allow you to fork an entire repository and merge the entire repository. This means, to me, that if one person forks and the area they're working on ends up having an unforeseen dependency (that requires some modification) on a file that another person also worked on in their (simultaneous) fork, you're going to have an ugly conflict down the road and potentially some redundant code. If one person could simply explicitly check out (lock) that one file for editing then it would be mutually exclusive and you'd be guaranteed to be always making progress. So, am I missing something?
GitHub also doesn't seem to play nice with Unity, with Unity updating some 10-20 non-integral files every time you modify any single thing. This obfuscates what was changed and really just makes it a mess. Is there a tutorial or other resource out there for putting all these types of files into a gitignore or something similar, so that when you change one file, GitHub only really sees one file?
Logged


Dacke
Level 10
*****



View Profile
« Reply #527 on: February 07, 2016, 11:20:19 AM »

That's how all distributed version control systems work, like git or mercurial.

In fact every repository, be it on your computer or a server, is a full-fledged repository that can be completely independent of anything outside of it. GitHub tries to create an appearance of a central repository on their server, but that's mostly an illusion.

Having a single, official, central repository with locked files is a completely different paradigm. So you can't really think of them in the same terms.

DVCS proponents point to several advantages of distributed version control systems over the traditional centralised model:

   * Allows users to work productively when not connected to a network.
   * Makes most operations much faster.
   * Allows participation in projects without requiring permissions from project authorities, and thus arguably better fosters culture of meritocracy[citation needed] instead of requiring "committer" status.
   * Allows private work, so users can use their changes even for early drafts they do not want to publish.
   * Avoids relying on one physical machine as a single point of failure.
   * Permits centralized control of the "release version" of the project
   * On FLOSS software projects it is much easier to create a project fork from a project that is stalled because of leadership conflicts or design disagreements.

It's worth noting that merging conflicting edits is generally muuuuch easier with DVCSs compared to what you may be used to. And if you do atomic commits, you can pick and choose changes that are generated by individual developers.

You do need to communicate with others about what you're working on. But you'd have to do that anyway. The difference being that if I need to make changes to a part of the project you're currently working on, there is no problem doing that with a DVCS and all you'll usually get is a simple (often automatic) merge.

And yes, you can use .gitignore to ignore files you don't want to include/update in the repository.
« Last Edit: February 07, 2016, 11:28:32 AM by Dacke » Logged

programming • free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
oahda
Level 10
*****



View Profile
« Reply #528 on: February 07, 2016, 11:37:41 AM »

Is there a tutorial or other resource out there for putting all these types of files into a gitignore or something similar, so that when you change one file, GitHub only really sees one file?
I followed this when I set git up with Unity (and BitBucket rather than GitHub, tho) for the last Ludum Dare, if it helps: http://adamsingle.com/unitygitsourcetreebitbucketmactute/
Logged

Glyph
Level 10
*****


Relax! It's all a dream! It HAS to be!


View Profile
« Reply #529 on: February 07, 2016, 01:00:34 PM »

Thanks for answering my questions so quickly, Dacke & Prinsessa. I suppose GitHub's behavior is something I'll have to get used to, and we have been muddling through slowly anyway. I just feel like forking and merging the whole thing is more error-prone than singular locks. But hey, maybe I'll get used to it.

Is there a tutorial or other resource out there for putting all these types of files into a gitignore or something similar, so that when you change one file, GitHub only really sees one file?
I followed this when I set git up with Unity (and BitBucket rather than GitHub, tho) for the last Ludum Dare, if it helps: http://adamsingle.com/unitygitsourcetreebitbucketmactute/
Thanks for the link, I see now that it's not actually a very daunting procedure!
Logged


InfiniteStateMachine
Level 10
*****



View Profile
« Reply #530 on: February 07, 2016, 08:33:29 PM »

Yeah locks are pretty essentail for game projects with a lot of non-mergable assets too. Why did you choose git?

Perforce is a good solution for exclusive locking and you can use it in unison with git so you can still use git for text files if you prefer its workflow.
Logged

Kinrany
Guest
« Reply #531 on: February 08, 2016, 12:34:49 PM »

Looking for a fast way to make and share multiplayer prototypes, focused on interaction between players. Ideally it should be something like Roblox: a service that gives you an editor, hosts your games and allows others to play and fork them. But I doubt that someone has made exactly the service I want, so any ideas will be helpful.
Note: speed is a priority, I'm not afraid of using a new language or an unfamiliar tool, but I want to create new prototypes (not necessarily iterations of the same game) as fast as possible. I also don't really care about presentation, text-based interface is OK.
Logged
everlive
Level 0
*


View Profile
« Reply #532 on: February 08, 2016, 10:06:43 PM »

So I have an idea for a MODOM (Multiplayer Online Document Object Model) game.  Anyone think this is feasible minus the HTML Canvas if I keep the process low enough that acceleration is not required?
Logged
Cheezmeister
Level 3
***



View Profile
« Reply #533 on: February 09, 2016, 07:24:17 PM »

I have never heard of a MODOM in my life. It is also a palindrome. Therefore, you should do it. For the lulz.

(Yes, perfectly feasible. DHTML has been a thing for over a decade, just don't get too freaky with the particles.)
Logged

෴Me෴ @chzmstr | www.luchenlabs.com ቒMadeቓ RA | Nextris | Chromathud   ᙍMakingᙌCheezus II (Devlog)
oahda
Level 10
*****



View Profile
« Reply #534 on: February 10, 2016, 04:53:05 AM »

I don't understand, at all (I know what the DOM is, I know what DHTML is, but I don't understand what a MODOM is supposed to be).
Logged

InfiniteStateMachine
Level 10
*****



View Profile
« Reply #535 on: February 10, 2016, 06:12:00 AM »

I guess it means like a game where the scene graph is the DOM and it's a synchronized?
Logged

everlive
Level 0
*


View Profile
« Reply #536 on: February 10, 2016, 12:23:58 PM »

Eh, its an idea of using JavaScript with HTML elements rather than the Canvas or webGL, any and all interaction is more or less based on existing mechanics of HTML.
Logged
Oats
Level 1
*


High starch content.


View Profile
« Reply #537 on: February 10, 2016, 11:29:32 PM »

In openGL whats a good way to render 1 thick lines around quads? I have a bunch of rectangular prisms and I would like an outline around each face, I do not require a thicker border around the silhouette of the shape, which is what a lot of online resources seem to be doing with edge detection and stuff like that.
Edit: I tried rendering just a black wireframe around the faces, strangely enough it looks great from afar, but as soon as I go near there's Z fighting between the line and the polygon.
Edit 2: I have sinned, I have needlessly posted, got it working with GL_POLYGON_OFFSET_FILL and glPolygonOffset(), I should of googled harder before posting.

Edit 3 (new question): Ok so now I have a perfect outline around my polygons, how would I achieve the same effect on a billboard sprite? Say I have one quad with a single colour image on it, where every pixel is either coloured and fully opaque, or is fully transparent. I would like it so that at whatever distance it's rendered at it would have an outline of the same width (1 pixel) that surrounds the filled part of the image. I could imagine writing something that would build an array of lines around the shape, but that seems like too much work for what it is, I might as well use models instead of billboard sprites, would edge detection be the only way?

Edit 4: Ok I'v researched edge detection, and the kernal
 0,-1,  0
-1, 4,-1
 0,-1,  0
seems to do exactly what I want, but I don't know how to get it to work the same at all distances, if I just use the coordinates of the texture the results would be identical to having the outline in the texture, how do I write a fragment shader that accesses fragments around it? I think that's impossible, I could use multipassing, render the scene to an FBO then use edge detection, but then all colours will have outlines. I can't find any solutions online that solve exactly my problem. Is the stencil buffer something I could use?
« Last Edit: February 11, 2016, 05:41:54 AM by Oats » Logged

eh
oahda
Level 10
*****



View Profile
« Reply #538 on: February 11, 2016, 07:10:23 AM »

how do I write a fragment shader that accesses fragments around it?
Like purenickery wrote here, you might have to pad the texture with some transparent space around it.
Logged

oahda
Level 10
*****



View Profile
« Reply #539 on: February 11, 2016, 07:13:18 AM »

Question: what's the tradeoff for swapping shader programs in GLSL? I'm starting to notice some drop in framerate due to my light shader, and right now the shader accepts any type of light and has a few more ifs in there than it could've had if I separated the file into a different shader for each type of light and made the swap depending on the next light in the queue. Would that be faster, or is the tradeoff for swapping programs too big?
Logged

Pages: 1 ... 25 26 [27] 28 29 ... 69
Print
Jump to:  

Theme orange-lt created by panic