• Escaping the Garryhole (please help)
    45 replies, posted
I think ASP.NET (Core) would be comparable yeah. Also technically nothing is stopping you from using camelCase but most .NET developers will frown upon not following the Microsoft .NET Naming Guidelines Each to their own, but it nicely solves the problem of naming where you need to have an explicit backing value for a property: public class Foo { private int bar; public int Bar { get => bar; set { if(value > 10) { throw new ArgumentOutOfRangeException(nameof(value)); } bar = value; } } and with proper formatting https://files.facepunch.com/forum/upload/106970/308325dd-9ff8-439d-8653-f731952e1947/image.png
LÖVE is popular for smallish personal projects, commercial games (even indie ones) not so much. Out of the languages you listed in OP, C# and JavaScript are the most gentle second languages for someone who knows Lua, but fundamentally if you grok programming in one language you can pick up all the others. If you don't have a specific goal in mind you want to start working towards immediately - ignore what people say you should be learning, just learn what looks fun to you! Way more productive than getting in a language war.
I know that. But most Java code I worked with looked a little like that. In that joke-example I obviously exaggerated to illustrate how I see some lines of code in java. Oh, and I hope it wasn't the case, but I didn't intend to offend anyone that works with/loves Java, it is just that, personally, it can be confusing for me, which is something that I rarely experienced in C# and some other languages (and I must add: that's the view of an non-expert programmer; I'd say I'm probably between beginner-intermediate, I have not much more than a year of experience <- this might be relevant)
I did some unity stuff. Took me more attempts than I'd like to admit, or publicize. The Code You can also tell that the rotation is choppy, due to the method. I have no idea how to lerp it, so suggestions would be helpful. https://files.facepunch.com/forum/upload/112610/c847543c-302f-4ad4-aafc-4fa86725c096/projectdank 2018-03-22 10-49-37-38.avi
There's a shit load of excellent official documentation as well as tons of existing questions online about how to use Unity. Literally just google "unity lerp" and the first hit is an example that will explain what you're trying to do. Get used to googling things before asking for a while, chances are 99% of your questions for the next year (and beyond) of unity usage have already been asked and answered or documented well.
Looking at your code, here's two tips I can give you: 1. spin = spin + 1; Can be shortened to: spin += 1; 2. To move or rotate objects in a smooth and framerate-independent manner, multiply the velocity by Time.deltaTime. For example: float spin = 50.0f; void Update () { transform.eulerAngles = new Vector3(0.0f, spin * Time.deltaTime, 0.0f); }
Thought so. Multiplying by delta time turns 10 m/frame to 10 m/s What is the significance of f though? Found it Thanks for your help, by the way. The simple example made me a little more confident in using deltaTime.
If you ignore how much cleaner properties make things sure
I mean it really depends. There was a good discussion about this in the Discord channel, but any language with GC is not going to see heavy usage for games because a GC is going to cause frame hang-ups and issues no matter what you do. Sure, they can do well enough for many projects, but they're just not ideal for many projects. Also, C++ is a lot easier to use if you get a solid start with modern C++ semantics: C++17 is really great, and good textbooks like C++ Primer can get anyone started with programming in a good manner (and it uses C++11, so that's especially good!). There's just tons of pre-existing AWFUL online examples and texts for learning C++ imo, that give it a really bad reputation and create really terrible habits (like using "new" and "delete" by default, versus in very rare cases that have only appeared for me in DLL library programming). I think C# looks quite good, and I admire it for seemingly offering a good middle-ground of abstraction vs depth, but selling it as the absolute best solution for a game is a bit misleading imo.
C# GC has bad reputation because of Unity old Mono shit that has old GC. Modern GC is much better. Also still, if you are careful, you can make 0 GC or very low, by pooling everything and being careful with collections in general (for example, you can tell List<T> maximum number of items, so it will internally preallocate array) and so on.
C++ is still an insanely difficult-to-get-right language compared to C# (and the C# compiler errors are extremely nice, which you shouldn't underestimate). Even with C++ as end goal, I'm not completely sure I'd recommend it as first C-like language. This really depends on how easy it is for you to transfer knowledge though, and whether you want to write bare metal games (go with C++) or if you want to use an engine and just get things into a playable state somehow (C# is likely more convenient here).
Nobody uses JavaScript to program shit for Unity any more. Boo's dead and being removed.
My point still stands though, javascript is used fucking everywhere these days. It's a really useful language to know simply because you can poke your nose into so many things with it.
I didn't contest your point, only your statement that people use JS for Unity.
I mean I really don't think Modern C++ - especially if you're using C++14/17, but even C++11 works - is nearly as difficult as people make it out to be. The hardest part continues to be fighting the dissemination of bad resources and outdated information to be honest. C++11/14 have enough advantages to their use that we're trying to replace C code used in space systems work (spacecraft radio firmware) with modern C++ stuff - because it's safer, more performant, easier to write, and easier to maintain than equivalent C code haha. I have nothing against C# though: I've never used it but was observing and listening to a rather interesting conversation in a discord server among some experienced devs about the issues with GC (namely, that you're going to get inconsistent performance and hangups no matter how hard you try, unfortunately). It's clearly a solid language though, and I'll probably eventually get around to using it. I concur that it depends what you want to do - I really enjoy systems and engine programming (plus design), so I use C++ since I'm comfortable with it and writing my own stuff from scratch means I've been rolling C++17 from the get-go. For someone more interested in just getting something playable and doing more actual game development, I think C# makes sense for sure. also: late response but better late than never.
I have to disagree with the "how hard you try" point. Given a reasonable amount of effort you can write (practically) allocation-free and very well performing C#, especially with the recently added framework and language features. At that point the speed difference to native languages comes from the simplicity of the JIT compiler compared to full-fledged optimizing compilers which can spend minutes instead of milliseconds compiling the program. The important thing is that well-written C# is consistently slower, not stuttery and unpredictable. It's not easy though. There are lots of ways to accidentally generate unnecessary garbage and ruin your performance, and the compiler doesn't offer much help. The canonical OOP-heavy style of writing C# fits web servers and desktop applications quite well, but it doesn't translate well to real-time applications like game engines. Learning the most efficient style takes effort and willingness to e.g read runtime-level documentation. And while it has been already said in this thread, I'll have to reiterate: Unity's C# is not C#, and you shouldn't make any conclusions about C#'s and .NET's performance from Unity. Up until very recently, Unity used an almost-decade old version of the runtime and the language, with a low quality stop the world -garbage collector. Unity's APIs are not very well designed either, compounding the issue. It seems that things are about to improve radically within this year though, with the introduction of their job system and their AOT compiler (which forbids allocation entirely).
Sorry, you need to Log In to post a reply to this thread.