Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411482 Posts in 69370 Topics- by 58426 Members - Latest Member: shelton786

April 24, 2024, 01:10:51 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)The grumpy old programmer room
Pages: 1 ... 292 293 [294] 295
Print
Author Topic: The grumpy old programmer room  (Read 738615 times)
qMopey
Level 6
*


View Profile WWW
« Reply #5860 on: October 02, 2019, 01:45:12 PM »

I often nul-terminate my binary data  Huh?
Logged
fluffrabbit
Guest
« Reply #5861 on: October 02, 2019, 02:08:57 PM »

But a null byte, AKA \0, is literally a byte with a value of 0. How do you avoid that byte randomly existing in a buffer? Isn't the number 0 rather common?
Logged
qMopey
Level 6
*


View Profile WWW
« Reply #5862 on: October 02, 2019, 03:56:04 PM »

It’s fine if it’s already in the data, but generally also harmless to add onto the end.
Logged
fluffrabbit
Guest
« Reply #5863 on: October 03, 2019, 02:47:39 AM »

Then you have a buffer with multiple null bytes in it, which is useless if you don't know its length.
Logged
Daid
Level 3
***



View Profile
« Reply #5864 on: October 03, 2019, 04:01:31 AM »

null terminated data is quite common even in binary data, but then generally with fixed structures.

Did you know that the "argv" to main is actually terminated with a null pointer?
https://stackoverflow.com/a/3772826/7533710
Logged

Software engineer by trade. Game development by hobby.
The Tribute Of Legends Devlog Co-op zelda.
EmptyEpsilon Free Co-op multiplayer spaceship simulator
fluffrabbit
Guest
« Reply #5865 on: October 03, 2019, 04:07:38 AM »

When you get into operating systems and the C language, the situation is different. A command line parameter equal to null is unlikely to exist, so null-terminating argv might be useful in some cases (not sure where as each string within it is also null-terminated).

When sending data over the network, a byte with a value of 0 could be interpreted as 0, or if the data type is int32_t* and you have a value of 500, 2 of the 4 bytes are going to be 0, or null. If the value is 0, all 4 bytes are null.
Logged
ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #5866 on: October 19, 2019, 08:38:10 PM »

Windows audio APIs.

I had what I thought was a working DirectSound implementation, but it turned out to be pretty garbage - extremely high latency, occasional buffer underflows, and sometimes output would just break and never recover. The last two problems are probably fixable if I wanted to spend time messing with them, but the latency problem seems more fundamental, so I'm going to have to throw this one away and start from scratch.

waveOut looks like it might do the trick. It's pretty old-school, and I'm trying to adapt it to work in a new-school way - my audio layer needs to expose a callback function that allows the consumer of it to fill a buffer with raw PCM data, then have that sent to a device to be played. waveOut wants to work on a more static paradigm of playing loaded WAV files, and it's turning out to be pretty fiddly to get it to work the way I need it to. Can't evaluate its latency and reliability until I have the implementation basically done, so I don't even know if I'm going to have to throw away all of this work again.

XAudio2 was brought to my attention. It looks a lot heftier than what I'm after, but it'll probably be my next choice if waveOut can't do the job. Why are there so many different options, and why do none of them actually seem to be any good?
Logged

Schrompf
Level 9
****

C++ professional, game dev sparetime


View Profile WWW
« Reply #5867 on: October 19, 2019, 11:53:46 PM »

I'm stuck with FModEx for ages now, but I still vividly remember trying to get something running with the convoluted DirectSound API. I think MS deprecated it, as it did with DirectInput, but a proper replacement is nowhere to be seen. I wonder what law-abiding people nowadays use for sound? Or is everyone using Unity and the likes now, and those use a carefully maintained clutch of deprecated stuff which MS is too sober to remove?
Logged

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



View Profile
« Reply #5868 on: October 20, 2019, 03:21:58 AM »

SDL2 offers an audio API like that. Seems they have implementation with directsound, wasapi and winmm. In a quick scroll trough, the winmm looks like the simplest. But you could test all 3 for latency.
Logged

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


The archivest master, leader of all documents


View Profile
« Reply #5869 on: October 20, 2019, 05:50:11 AM »

custom render texture is really not well documented in unity :sad_emoji:
Logged

ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #5870 on: October 21, 2019, 09:01:12 AM »

Slightly less grumpy update: I got my waveOut implementation working, and it's...OK, I guess? It's more stable and slightly lower latency than DirectSound, but not 100% ideal. I'll probably still need to look into XAudio2 at some point. At least I have something that's reasonably workable until I'm ready to put in that extra effort.

This was all part of the process of compiling my game for Windows for the first time in months after developing it primarily on a Mac. I was seeing a lot of unexpected performance issues that weren't all related to audio. I traced one source of the problem back to gamepad detection, and figured I'd spin it off into a secondary thread so that it wouldn't have to block execution if it took too long to complete. Somehow, this didn't seem to help.

I got a hunch that CreateThread might actually be slow on its own, so instead of spawning a new thread each time I wanted to poll for gamepads, I started just one thread on initialization, and implemented some semaphore communication to pause and resume it when I needed it to do some work. This seemed to fix the problem. Lesson of the day is that thread creation is expensive, so do it just once at startup and keep using the same thread(s) for ongoing work whenever possible instead of starting new ones.
Logged

gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #5871 on: October 23, 2019, 12:29:10 PM »

I hope you can get it to happy programmer room territory
Logged

gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #5872 on: October 25, 2019, 10:04:13 AM »

THIS

Code:
Shader "MAGIC/AtlasTransfer"
{
    Properties
    {
        _Cube ("Cubemap", CUBE) = "" {}
    }
    SubShader
    {
        Pass
        {
            CGPROGRAM
            #include "UnityCustomRenderTexture.cginc"
            #pragma vertex CustomRenderTextureVertexShader
            #pragma fragment frag
      
            samplerCUBE _Cube;
 
            float3 UnpackNormalFromOct(float2 f)
            {
                float3 n = float3(f.x, f.y, 1.0 - abs(f.x) - abs(f.y));
                float t = max(-n.z, 0.0);
                n.xy += n.xy >= 0.0 ? -t.xx : t.xx;
                return normalize(n);
            }
 
            fixed4 frag (v2f_customrendertexture i) : COLOR
            {
                float3 normal = UnpackNormalFromOct(i.localTexcoord.uv);
                return texCUBE(_Cube, normal);
            }
            ENDCG
        }
    }
}

throw this

"no matching 1 parameter function" at the first line of frag ...

and I don't know why nor does google  Angry


EDIT:
SPEND TWO DAYS ON THIS AND POSTING HERE MADE ME TRY SHIFTING  .uv TO .xy AND IT WORKS  Mock Anger
AMA CRY  Cry
« Last Edit: October 25, 2019, 10:21:35 AM by gimymblert » Logged

gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #5873 on: October 26, 2019, 08:04:17 AM »




AIs Are Getting Too Smart - Time For A New "IQ Test”
Logged

qMopey
Level 6
*


View Profile WWW
« Reply #5874 on: October 26, 2019, 01:29:48 PM »

I work in machine learning (ML) building robust deep neural nets (DNNs) professionally. ML is simply non-linear optimization, meaning it boils down to just a bunch of mathematics. The implementation of ML training requires a lot of hard work to develop a training set that the underlying training algorithm can find useful. This means finding little tricks to help the training algorithm ignore useless information and focus on relevant information, or avoid local minima.

In all, ML is about generating code. It is just a code generation algorithm. The DNN that training produces is a mapping of the problem space from inputs to the solution, a lot like finding a valid path through a very complicated maze. A DNN can not generate truly new information, they can only interpolate through known pre-mapped space. They have no actual intelligence either, or will, or anything silly like that.

The video, though interesting, is just a bunch of pop-culture. DNNs are not black boxes, they are built from smaller and easier to understand building blocks, just like everything else in computer science. Building a new IQ test because a DNN did well is a really silly idea. IQ tests are for humans, and it's irrelevant how good a DNN might do.

If anyone else is curious about DNNs and ML in practice I'm of course happy to answer questions. It's something I'm actively doing and learning about, so am eager to talk about it  Beer!
Logged
gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #5875 on: October 26, 2019, 09:00:19 PM »

Oups I posted in that wrong thread ROFL

BUT that guys also work on deep learning, also I'm quite educated of the issues and what is a latent space encoding. ALso he is talking about actual academic paper, with actual application going on at the state of the art.

There is also this saying that AI is the concept we don't master yet, once passed a threshold where the mystery is dispel it became just a "tool" not intelligence. Remember when relational database use to be the hot AI shit?

The corollary is that maybe we think intelligence is hot shit because we can't precisely define, which prevent it from being mundane. Maybe we aren't so smart?

Anyway, I often present DNN as having the math of a supermarket ticket (mul add and then testing if over budget), but also like an advance parser and pattern matching. The thing is, it demonstrate that pattern matching is quite powerful.

Then you have the philosophical question, maybe we just interpolate data ourselves too? We can't really produce thing that don't exist, we mostly rearrange what's existing, what's creativity? The dabet is still raging on after millenia. I mean we are just a bunch of chemical and firing neuron, open a brain and you don't see silly thing such as will ...

And to finish, there is the simple that DNN encompass more than just the neural network, the reward control architecture matter as much as it control the DNN "data". That is NN by themselves don't do much, but add a q learning control unit evaluating actions based on a score and you have a minimal "will" set up.

After all human too have a reward/punishement system in the form of emotions, in which we try to optimize based on our sensibility, aka the tuning set up of these emotion. If anything adding multi polar reward system probably would give the DNN more "intelligence", adding "curiosity" (prediction of the environment), "self awareness" (prediction of next internal state) and "imitation" to classic sandbox problem really help the AI generalized to task in sparse environment.

To be frank we haven't yet an architecture that handle "reasoning", which make current performance even more wilder, as basically a lot of intelligent task can apparently be performed by just statistical matching (which plain NN are). One problem is that we haven't found yet a way for the intelligence to map it's knowledge back to himself to manipulate, it doesn't have access to its own latent space. We have architecture with external temporary memory, but that's not the same.

Now I gonna put that video in the correct thread ...
https://forums.tigsource.com/index.php?topic=68138.n
« Last Edit: October 26, 2019, 09:07:15 PM by gimymblert » Logged

qMopey
Level 6
*


View Profile WWW
« Reply #5876 on: October 26, 2019, 10:51:18 PM »

You may post it in the correct thread, but we will talk about it here anyways!  Cheesy
Logged
qMopey
Level 6
*


View Profile WWW
« Reply #5877 on: October 28, 2019, 10:19:31 AM »

Then you have the philosophical question, maybe we just interpolate data ourselves too? We can't really produce thing that don't exist, we mostly rearrange what's existing, what's creativity?

Depends on what you believe in terms of free will and ideas. If an idea arrives it can be "new" information, but then again, it could be really old information, i.e. something passed on from one's ancestors in some esoteric manner.

For DNNs though, they do interpolate data quite well. It's popular right now because they are the best strategy to solve qualitative problems, especially in computer vision. If some other strategy were better we would all switch.
Logged
gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #5878 on: October 28, 2019, 10:00:17 PM »

That's the problem, it's belief not facts Tongue

I do have an "equation" for creativity though lol, it's the redux is basically a distance to "known form" there is a boundary in which thing get increasingly too "alien", art move that boundary. It's also relative because knowledge is relative, what's new for you isn't new for me, I lament the lack of creativity in X, but for you it might be a revelation, then you add meaning and relatedness as the value of "newness", it might be new but is it worth it? yet again it's relative. In general it mean new thing close the (personal and relative) boundary have more value, too far it's foreign, too inside it's safe and relative, familiar but not new, might be even boring. I had another dimension (it was triangle) but I can't remember now lol. But basically creativity is cultural and personal, not an absolute metric. I needed that representation because i'm interested in computer creativity, so I needed to fix a relative starting point for a potential algorithm that generate some "value".

Wait I found back teh thread that explain it lol
https://forums.tigsource.com/index.php?topic=48981.msg1156678#msg1156678
Quote
on creativity we can pose the problem as such: let say there is a set A of all creations, B is a set in A that is all created work, then creativity is all work in A that increase set B that was not in B prior /obviously as the set B is increased/. let's call d the distance between two different work, originality is such that d is as big as possible for single work toward all the other work in B. then there a fitness score f /the purpose/ such as the work please to an audience. creativity is maximizing a work such such as f and d is big when increasing B. low d is clone, low f is random. we can define two strategy to increase B creatively, one is exploitation by having a big f and the second is exploration by having a big d. the problem therefore is in defining f and d. in reality f and d vary accross culture and individual, so there is a sensibility modifier, however we can first solve them assuming they are constant first.
Quote
okay let's call 'description' the series of parametrized steps to create a work. the current description is the current 'assumption'.

let's call frustration the creation of works with low scores, it increase with the number of low score works, once the frustration reach a certain score the system challenge the description.

let's call boredom the creation of score with consistent high f low d, increased by each succesful works with low d, past enough boredom the system challenge the description.

the description is challenged by testing the validity of any of its proposition by switching, adding or removing elements of a proposition. then scoring the description to evaluate the contribution of the elements. similarly the system can try to add or remove element to test its contributions. so the system form belief about the importance of each element of a description.

how can we call low f high d ? ie original but purposeless random work



a more complex system evaluate a description per 'intent' and form multidimensional belief of the description with intent as context. intents being specific set of fitness born from experiential system such as angelina, pleasing a specific audience being just a subset of this, another one would be 'how to make the player cry', this last example prompt the question about how to make a crude system such as it can form such intent? how to give the system a set of standard that can evolve to create intent?
Logged

kason.xiv
Level 0
***


View Profile
« Reply #5879 on: November 20, 2019, 06:36:43 AM »

I've been desperately trying to write a template library and link it to my project (CMake) - to no avail... it's turning me seriously grumpy (and old) :<
Logged
Pages: 1 ... 292 293 [294] 295
Print
Jump to:  

Theme orange-lt created by panic