Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 785 786 [787] 788 789 ... 795

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 815169 times)

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11790 on: July 12, 2020, 09:17:01 pm »

For features I'd suggest doing the same procgen on a smaller scale but with a different system-appropriate color.
Logged

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11791 on: July 13, 2020, 10:34:38 am »

for now I used 2/3 of the contour line for secondaries, while placement is equidistant along the side for secondaries and along aft/fore 2/3 for others.

here's a sample destroyer, with 2 primaries aft, 1 fore and 2 secondaries per side

Spoiler (click to show/hide)

legibility is ass, I know, but destroyer are going to be cheap and disposable, turret scale with volume so it should work out for cruiser battleships and the likes.

turret layer of a larger ship:
Spoiler (click to show/hide)

full ship
Spoiler (click to show/hide)

in order: triple railgun, triple missile launcher, double cannon (yeah cannon and rail have the same gfx for now I was out of time)

« Last Edit: July 13, 2020, 05:52:37 pm by LoSboccacc »
Logged

McTraveller

  • Bay Watcher
  • This text isn't very personal.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11792 on: August 19, 2020, 11:52:39 am »

Dammit W3C.  FileReader explicitly fails if you try to reload a file that changed, because its snapshot state changed.... why doesn't it allow reload?  I know the File Chooser / FileReader interface is specifically designed to help prevent abuse of the local file system... but why prohibit reload? I wonder what specific situation led to that prohibition...

The ONLY way to reload a file is to make your user do a FileChooser again, which is really fun because if they pick the same file, it doesn't trigger the change event (because it didn't change!). So you have jump through hoops to make it look like a change.

 >:( :'(
Logged

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11793 on: August 21, 2020, 05:07:48 am »

Dammit W3C.  FileReader explicitly fails if you try to reload a file that changed, because its snapshot state changed.... why doesn't it allow reload?  I know the File Chooser / FileReader interface is specifically designed to help prevent abuse of the local file system... but why prohibit reload? I wonder what specific situation led to that prohibition...

The ONLY way to reload a file is to make your user do a FileChooser again, which is really fun because if they pick the same file, it doesn't trigger the change event (because it didn't change!). So you have jump through hoops to make it look like a change.

 >:( :'(

yeah, the only reliable way is to have a button, then in the onclick create the input type file and trigger that to open so every time is a new input object, then you put it in a browser blob and clear the input file.
Logged

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11794 on: August 30, 2020, 01:49:06 am »

https://developers.slashdot.org/story/20/08/29/2328255/elon-musk-and-john-carmack-discuss-neuralink-programming-languages-on-twitter

Some stuff came up online about the choice of programming languages for Elon Musk's Neuralink technology. People are going "lol c/c++" and asking them why they're not using Python etc. Get with the times, right? Everything should be written in Python! John Carmack then waded into the fray saying that if you really care about robust code you program it in a statically typed language.

Python is fine if you want to whack something together and want it to just work, but I wouldn't want to write a large complex program in that. The c/c++ compiler is unforgiving, but you can leverage that unforgivingness to catch mistakes for you automatically if you know what you're doing, although Carmack suggests Rust as a more modern alternative, but lacking as many tools as c/c++.
« Last Edit: August 30, 2020, 01:50:51 am by Reelya »
Logged

Uristides

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11795 on: August 30, 2020, 09:08:01 am »

What about the, by now not so much, new support for type annotations in Python? I have to admit I never gave them a serious shot either in personal(they are so few and too small for me to even bother, eh) or professional(we currently have more pressing issues than type safety, tech debt ahoy!) projects, but back when I read the PEPs I found they looked a bit unwieldy and not first-classs enough. Most of the libraries I use didn't adopt them(at least back when I last had to check their source code for anything) and I'm still to hear about any big project reporting positive results by doing so.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11796 on: August 30, 2020, 10:28:33 am »

Are the C/C++ compilers really "unforgiving?" I know I had this very strange argument with someone recently where they claimed that errors in statically typed languages are "novels" or whatever, but do people... really see errors/warnings as anything but a good thing to have?

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #11797 on: August 30, 2020, 11:05:29 am »

I'd say C/C++ is more unforgiving because it doesn't stop you doing stupid things, and less the compiler warnings/errors themselves.

Code: [Select]
auto* i = new int[1000];
delete i;
i[100001] = 10;

Whilst more modern languages tend to be taught in terms where you first use the constructs that include the protections, C lacks them and C++ is still taught in C-like terms of pointers first and then the 'smart' objects like std::vector, std::unique_ptr, std::shared_ptr later. Like they shouldn't be the things you are almost always using with the 'raw' pointer logic being rare-to-none-existant.

The real benefit I always find from types is it enables so much nicer tooling to help you as a programmer not spend half your time in documentation and the other half in runtime issues.

A good type system gives you so much more than just static type checking. A function being able to return an object that prompts the developer with it's contents and forces you to handle every possible return type is just so much nicer for writing quick code than having to keep checking 'wtf does this function take in what order and what does it return again?'.

If you see a function signature like:
Code: [Select]
std::variant<std::vector<byte>, FileError> FileSystem::read(std::string path);There's no real room for ambiguity and I'm pretty confident I can call it without needing to check the documentation first.

There's a reason I write Typescript nowadays and not Javascript, and pretty much every library that matters for Javascript comes with type information.
« Last Edit: August 30, 2020, 11:14:35 am by MorleyDev »
Logged

Uristides

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11798 on: August 30, 2020, 11:46:36 am »

A good type system gives you so much more than just static type checking. A function being able to return an object that prompts the developer with it's contents and forces you to handle every possible return type is just so much nicer for writing quick code than having to keep checking 'wtf does this function take in what order and what does it return again?'.

That is true. I picked up Scala again recently and working with streams(using the standard library, FS2 and Cats are still witchcraft to me) feels really nice and smooth when you can just think about which transformation gets you from type A to type B instead of getting all imperative about it. The types for error handling like Option and Either also make it really neat to handle surprises without littering your code with throws and try/catches.

Overall, despite never being able to get my head around the pure functional mindset, I'm really fond of how ideas from the functional world have been dripping into the more traditional languages in the last decades. The realization that strong typing(and a powerful type system to accompany it) can be an asset for the programmer even when you have compilers smart enough to figure types out on their own seems to be one of these ideas.
« Last Edit: August 30, 2020, 12:04:21 pm by Uristides »
Logged

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11799 on: August 31, 2020, 08:52:33 am »

Are the C/C++ compilers really "unforgiving?" I know I had this very strange argument with someone recently where they claimed that errors in statically typed languages are "novels" or whatever, but do people... really see errors/warnings as anything but a good thing to have?

My guess is that whoever said that the errors were novels were specifically referring to compiler errors from STL in C++, but if I remember right any template code in C++ can produce huge error outputs.  It's been a while since I've written C++, but I know I've seen a few multiple page errors from STL before because of something fairly simple.

I'm not sure if there is some fundamental reason the errors can't be more terse.
Logged
Through pain, I find wisdom.

bloop_bleep

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11800 on: August 31, 2020, 09:55:23 am »

It's mostly typedef expansion and inclusion of default template arguments. std::string becomes std::basic_string<char, std::char_traits<char>, std::allocator<char> > wherever it appears. Wherever type checking occurs, like with function calls, this can lead to a lot of noise in the error output.
Logged
Quote from: KittyTac
The closest thing Bay12 has to a flamewar is an argument over philosophy that slowly transitioned to an argument about quantum mechanics.
Quote from: thefriendlyhacker
The trick is to only make predictions semi-seriously.  That way, I don't have a 98% failure rate. I have a 98% sarcasm rate.

McTraveller

  • Bay Watcher
  • This text isn't very personal.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11801 on: August 31, 2020, 11:30:55 am »

If you get "noise" in your error/warning output - that's a hint you're doing something odd.

I keep screaming at my developers they really should be aiming for no warnings with -Wall.

Now if you're talking about warnings from, say, Lint, then that's another story. Some of those rules are indeed noise, and satisfying some standards (*cough* MISRA *cough*) often makes code more complex, which means it's more likely to have an error due to complexity than just doing the thing MISRA says not to do.
Logged

bloop_bleep

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11802 on: August 31, 2020, 01:06:00 pm »

If you get "noise" in your error/warning output - that's a hint you're doing something odd.

? Not really? I mean, clearly you're not writing correct C++ code if you're getting errors, but the error messages can be rather noisy in the sense that it's harder to get useful information out of them.
Logged
Quote from: KittyTac
The closest thing Bay12 has to a flamewar is an argument over philosophy that slowly transitioned to an argument about quantum mechanics.
Quote from: thefriendlyhacker
The trick is to only make predictions semi-seriously.  That way, I don't have a 98% failure rate. I have a 98% sarcasm rate.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #11803 on: August 31, 2020, 05:52:33 pm »

C++ is easily the worst I've seen when it comes to massive, nigh-unreadable compiler errors, yeah, but I have never failed to get such errors when working heavily with generic stuff in any language in this family--D, Rust etc. all have the same problem, if you're abusing templates/macros enough (and for D you should be).

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #11804 on: September 02, 2020, 07:54:41 am »

Yeah, think Clang and VS2019 C++ compilers are better about the error messages nowadays but they were brutal back in the day and still aren't as amazing as languages with less...obtuse language rules. That level of template metaprogramming is still the thing I miss in every language other than C++ though.
Logged
Pages: 1 ... 785 786 [787] 788 789 ... 795