Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411414 Posts in 69360 Topics- by 58415 Members - Latest Member: sophi_26

April 16, 2024, 10:47:24 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)The happy programmer room
Pages: 1 ... 272 273 [274] 275 276 ... 279
Print
Author Topic: The happy programmer room  (Read 677495 times)
qMopey
Level 6
*


View Profile WWW
« Reply #5460 on: May 02, 2019, 06:45:07 PM »

Yep STL is garbage if you like using debug mode.
Logged
Ordnas
Level 10
*****



View Profile WWW
« Reply #5461 on: May 07, 2019, 10:53:26 AM »

Maybe it is intended by Microsoft, so you don't forget to profile in Release  Tongue
Logged

Games:

Guntha
Level 0
***


View Profile WWW
« Reply #5462 on: May 08, 2019, 04:34:40 AM »

That becomes a problem when you create tools intended for debug use only... I had created one such tool, that relied heavily on std::vector and made the program running too slow in a lot of cases, and just getting rid of most operator[] uses turned it almost in release-mode like performance :p
Logged

FrankForce
Level 2
**


This tepid water is tasteless.


View Profile WWW
« Reply #5463 on: May 11, 2019, 04:16:05 PM »

I am happy today because I made a flappy bird game on dwitter (140 characters of javascript)!

https://www.dwitter.net/d/13750

« Last Edit: May 12, 2019, 12:07:07 AM by FrankForce » Logged
FrankForce
Level 2
**


This tepid water is tasteless.


View Profile WWW
« Reply #5464 on: May 13, 2019, 10:07:51 AM »

A "quine" is a program that print's out it's own code. After programming for 20 years, I finally got around to making one, and it fits in a tweet!

https://www.dwitter.net/d/13794



Code:
Z=2e3;for(i=0;i<Z;x.fillRect((S(i)*1e9)%Z,i,j=i++?i%7:Z,j))x.fillStyle=R(G=i*255,G,G);x.font=4+"em'";x.textAlign='center';code.split(Q='\x3B').forEach((s,i)=>x.fillText(s+Q,960,1140+89*(i-t)))
Logged
Schrompf
Level 9
****

C++ professional, game dev sparetime


View Profile WWW
« Reply #5465 on: May 13, 2019, 10:28:32 PM »

Hehe, nice!
Logged

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



View Profile
« Reply #5466 on: May 23, 2019, 07:29:16 AM »

Cool!
Logged

Eggy
Level 0
**


View Profile WWW
« Reply #5467 on: May 25, 2019, 03:22:32 AM »

Ok so as a non-programmer who fiddled with programming in the past (I am more of an artist), I've decided to take upon some programming again after being inspired by another person's work. Basically I'd like to give Monogame a try, so I am practicing some basics in C# via tutorials. So far it's been going pretty well and my first achievement is this:

And there's a lot more tutorials waiting for me to go through plus the potential to experiment on my own once I've mastered the basics, and the fact I'm learning coding for real feels amazing. I really have no clue why I haven't truly tackled something like this sooner.
Logged
oahda
Level 10
*****



View Profile
« Reply #5468 on: May 25, 2019, 09:01:33 AM »

Nice to hear that you're enjoying it! Good luck in making whatever it is you've set out to make! Coffee
Logged

Ordnas
Level 10
*****



View Profile WWW
« Reply #5469 on: May 25, 2019, 09:48:32 AM »

That tutorial reminds me of a code test I made at the University (write on console * in a pyramid way), the difference was that the language was Java  Tongue
Good luck with you progress!  Coffee
Logged

Games:

Eggy
Level 0
**


View Profile WWW
« Reply #5470 on: May 26, 2019, 05:39:45 AM »

Thanks! I constantly imagine myself creating like an RPG or something but at this time that one's nothing more than a pipe dream lmao. So right now I'm starting small and trying not to rush into amazingly complex programming right away without first taking everything in and actually understanding the code I want/need to write Smiley
I think I'm advancing pretty well with C#. Currently on a tutorial that teaches me how to create functions/methods with classes waiting right after. Can't wait to get to the part where I'll be able to create an actual game.
Logged
Ordnas
Level 10
*****



View Profile WWW
« Reply #5471 on: May 28, 2019, 12:07:17 AM »

Actually I also imagine myself gaining exp level like in a RPG when I started programming  Tongue
Good that you start slowly, it is like you can't start a marathon if you didn't learn to walk.
I think that you can also start with Unity instead of waiting to create a game one day. For example you can divide your day time like 30min with C# coding and other 30min make a game in Unity and C#.
Logged

Games:

ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #5472 on: May 28, 2019, 06:44:33 AM »

This is one of those posts where I was super grumpy for a while, but finally got to flip around to being happy when everything starts working.

For a while, I haven't been quite satisfied with my choice of audio APIs. Years ago I used OpenAL, but it was way too high-level and didn't give me the control I needed for a specific effect. I switched to portaudio, which was pretty great for a while - instead of using the API to manage audio channels and sources and stuff like that, it just gives me a callback function that I implement to fill a buffer with arbitrary sample data to be sent to the speakers. Huge improvement.

Lately I've been having some trouble getting portaudio to compile and behave correctly on all the platforms I want to support, and I'm always looking for ways to reduce third-party dependencies. I decided to implement my own bare bones audio output API which would work with the same sort of output callback system, but on the inside would directly use the native audio APIs of each platform I'm supporting without an extra layer in between.

I started with Core Audio on OS X, and man oh man, it's a complete disaster to get started with it. Documentation basically doesn't exist. I couldn't find any official sample code, and a cursory Google search didn't turn up any high-quality unofficial examples either. Looking at the source for portaudio and other open source projects that use Core Audio was moderately informative, but the APIs they were using are both enormously complex and deprecated. Apple's comments about deprecated functions only gave the vaguest hints about what to use as replacements, and without actual documentation or examples, I was left guessing at which parts were even necessary for what I wanted to do.

However, after spending enough time reading Core Audio headers and making educated guesses, I managed to get it to work with this tiny implementation:

Code:
#include <CoreAudio/AudioHardware.h>

static AudioOutCallback outputCallback;
static AudioObjectID device;
static AudioDeviceIOProcID ioProcID;
static AudioStreamBasicDescription streamDescription;

static OSStatus ioProc(AudioObjectID inDevice, const AudioTimeStamp * inNow, const AudioBufferList * inInputData, const AudioTimeStamp * inInputTime, AudioBufferList * outOutputData, const AudioTimeStamp * inOutputTime, void * __nullable inClientData) {
outputCallback(outOutputData->mBuffers[0].mData,
               outOutputData->mBuffers[0].mDataByteSize / streamDescription.mBytesPerFrame,
               inClientData);
}

void AudioOut_init() {
AudioObjectPropertyAddress objectAddress = {kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster};
AudioObjectPropertyAddress descriptionAddress = {kAudioStreamPropertyVirtualFormat, kAudioObjectPropertyScopeOutput, kAudioObjectPropertyElementMaster};
OSStatus status;
UInt32 size;

size = sizeof(device);
AudioObjectGetPropertyData(kAudioObjectSystemObject, &objectAddress, 0, NULL, &size, &device);
size = sizeof(streamDescription);
AudioObjectGetPropertyData(device, &descriptionAddress, 0, NULL, &size, &streamDescription);
}

void AudioOut_startOutput(AudioOutCallback callback, void * context) {
outputCallback = callback;
AudioDeviceCreateIOProcID(device, ioProc, context, &ioProcID);
AudioDeviceStart(device, ioProcID);
}

That's it. That's the whole thing, minus a small amount of error handling. Based on all of the other Core Audio code I'd seen, I was worried this would be pages and pages of audio units, device management, and other nonsense. It's nice when an API gets this much better. If they would just create some actual documentation and sample code, everything would be perfect.
Logged

qMopey
Level 6
*


View Profile WWW
« Reply #5473 on: May 28, 2019, 07:07:01 AM »

I had a similar problem with Core Audio. I had to read docs from an old book on Core Audio I found on Amazon.com. Why not give cute sound a try? It does exactly what you’ve just stated you’re trying to do. https://github.com/RandyGaul/cute_headers
Logged
ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #5474 on: May 28, 2019, 07:32:42 AM »

Oh nice! That'll be a useful example when I go to implement the glue for other platform APIs. Thanks for the link.
Logged

qMopey
Level 6
*


View Profile WWW
« Reply #5475 on: May 28, 2019, 07:46:02 AM »

No problem! It’s a great reference for OS level audio APIs (except Linux where I just used SDL).
« Last Edit: May 28, 2019, 07:58:38 AM by qMopey » Logged
oahda
Level 10
*****



View Profile
« Reply #5476 on: June 08, 2019, 12:31:12 PM »

Got AngelScript up and running in my engine and it’s really nice to be able to have a virtually identical API to access in both the parts of the game written in C++ and those written in AS—don’t have to learn a secondary system for the scripts and jump mentally back and forth between the two depending on what I’m working on.  Gomez
Logged

Schrompf
Level 9
****

C++ professional, game dev sparetime


View Profile WWW
« Reply #5477 on: June 10, 2019, 11:08:17 PM »

Have been using AngelScript for a literal decade now. As long as you're the only dev, it's great. It has its downsides, like the convoluted creation/copying flags you have to guess for each new class, but it got better over the years - now you can disable the ref counting and you have a bunch of options for PODs. The real downside is that once you get other people onboard, they pretty much expect C#-style scripting. And the tooling is SO much better out of the box for C#. I'm still considering a small plugin feeding on some generated json or on the headers directly and deriving colouring and auto completion from it. For the Splitterwelten we had a simple code editor based on the Qt texteditor framework which at least could highlight and autocomplete all symbols registered at the AngelScript runtime. I never did this again, and I miss it.

Don't know what point I was going to make, sorry. Just dropping anecdotes, I guess. The support is great, though! That guy is still present and responding pretty quickly at the GameDev.net forums if you ever have questions.
Logged

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



View Profile
« Reply #5478 on: June 11, 2019, 02:01:02 AM »

Always interesting to hear about other experiences!

I’ve used AS a little bit before so I mostly know what to expect, but I did do a better job of researching it this time so now I know it even better, and it feels good~ For example I’ve made sure to cover things like the generic calling convention on platforms without support for the native one—luckily very quickly done by using the autowrapper add-on so I didn’t have to do much extra work manually!

Overall it seems like most of the things you mentioned regarding registration are fixed by the AS type traits function, but it’s only available if using C++11 or above so maybe you haven’t had access to it? Still have to rebuild to check any registration errors until they’re fixed, but takes away the guesswork for the most part. c:

And yeah, I try to keep memory management and GC on the part of AS to a minimum—reference types are generally just mapped C++ types managed by the parent application (entity components, for instance) that can’t be directly instantiated in AS, and value types are POD or RAII (maths vectors, strings, things like that). There are so many neat add-ons out of the box too that save me from a lot of pain!

And yeah, only me ATM! Tongue

Would’ve been really nice to have C++ (static) reflection to automate all this binding, but alas, that didn’t make it into C++20 either and I’m still stuck on 14 for now anyway...
« Last Edit: June 11, 2019, 03:01:50 AM by Prinsessa » Logged

qMopey
Level 6
*


View Profile WWW
« Reply #5479 on: June 11, 2019, 09:42:33 AM »

I don’t believe in automated binding   Cool
Logged
Pages: 1 ... 272 273 [274] 275 276 ... 279
Print
Jump to:  

Theme orange-lt created by panic