Then I thought, "Wait. If I do that, I'll spend 90% of my time writing a language and 10% of my time writing a game".
So I was saved. Except I still haven't even started writing the game, so I suppose it's completely moot :-D
Then I thought, "Wait. If I do that, I'll spend 90% of my time writing a language and 10% of my time writing a game".
So I was saved. Except I still haven't even started writing the game, so I suppose it's completely moot :-D
Wound up with a career writing compilers, not games.
I played empire (in the classic text mode) together with my dad probably more than 20 years ago.
Thank you for the game (I have lots of fond memories playing this with my dad), and for reminding me what the name was!
Most new languages just don't get the things right that C++ did, which is why despite it having a ton of deficiencies when it comes to game development, it's still what everyone in AAA is using. Companies in AAA spend so much money on software to even just somewhat improve places where C++ has gaping flaws. A better language should have been developed by now and I don't even want to think about how much money C++ has cost the industry as a whole, even just purely on iteration speed.
Then I started working with Zig[0]. It's about 90% the language I want and even though it's still immature and the syntax, std lib, and semantics are in flux, I still find the quality of life improvement so huge that all my current projects are in Zig.
Zig is a better C to Jai's better C++, I think. It's a small language, it favors simplicity and explicitness, it has entirely manual memory management to the point that there isn't even a default allocator (we pass one in to anything that requires one). It even lets you import C headers directly to interface with C libraries.
(skip the "stable" 2.0 download, it's way out of date from master)
A lot of language devs want to play with semantics but aren't into the whole "let's do the hard work of actually getting off of C as the baseline" idea so it's nice to have a project that does and has a fairly explicit goal of absorbing and replacing the existing infrastructure step by step.
I find Swift to be the best so far, its strong ties to the Apple ecosystem notwithstanding.
Having tinkered with various environments since the Sinclair Spectrum's BASIC (though back then I had no idea what I was doing) I've successively fallen in love with Visual Basic (6.0, not the .NET impostor) and then C#, and now I'm smitten with Swift.
In Microsoft land I was let down by their usual dichotomies that did not allow you full access to all their APIs (or hardware performance) from anything but C++ (though I did manage to make playable DirectX games in VB6). I don't know how that has changed in the last decade since I jumped ship to Apple, but .NET was treated as a second-class citizen for too long.
With Swift, not only do I have access to everything that Apple's operating systems offer, it's also a modern language which feels naturally suited to game design patterns. Although until Swift 2 I often had to fight the language, since Swift 3 and especially now in Swift 4.2 I find it effortless to reason about most game architectures while sticking to the language's idioms.
I also appreciate it for enforcing good practices and getting rid of most sources of ambiguity (such as the ++/-- operators and the legacy `for` syntax, or being specific about %/modulo and so on), even if it may feel annoying in the beginning if you're coming from "looser" languages. It also compiles to native code and can easily interop with C [0], but best of all: I am glad to be able to finally leave semicolons behind. C# honestly feels archaic in comparison now.
As for the elephant in the room – that Swift is only good for iOS, macOS, tvOS and watchOS – well, those platforms have a combined userbase of over a billion users, and the most successful app market [1]; I don't feel that it's such a downside to be limited to those platforms. I do wish that the Apple TV came with a proper gamepad so we could only target that without losing users. It could be a serious contender to existing game consoles if Apple took that route.
If you're in love with Swift too, I'm writing an open-source game engine which offers an Entity-Component-System architecture on top of Apple's APIs [2].
[0] https://theswiftdev.com/2018/01/15/how-to-call-c-code-from-s...
To the point the Windows UI team does all their graphics demos in C#.
I’m too deeply entrenched in Swift though and disgusted by the sight of semicolons in a language anymore :P (maybe I’ll dip into VB.NET and see how it’s doing.)
The only nagging point is the copy-paste compatibility with C. :\
Such as? We are always looking for for things that get in the way of use.
3, 4, and 5 are all pretty sore points. 2 would be as well if it weren't extremely likely that for any game you create roll some sort of reflection system. It would be a sore spot for small projects.
3 - No access to classes and polymorphism is a bit of a downer. Although I'm a big believer of data-oriented design, I think there are still many cases where modelling things as objects is the best way to go, especially for things like scene actors and game objects.
4 - No built in threading (core.thread) puts a hamper on any sort of distributed updating or performance optimizations you'd want to do. I'd imagine the workaround is external multi-threaded dlls or something, but it sounds like a pain to manage and deal with in a workflow.
5 - No dynamic arrays. This container is used abundantly in game development. It shows up 5 or more times for every heap/stack/queue. This may not be an issue if you want to write a special memory environment and your own containers, which is common in game development, but not having access to a standard one certainly hurts when it comes to smaller projects or graphics programming experiments.
I may be somewhat off base here since what happened is that I read about those being missing and decided not to try it.
Another note is that a big thing I'm looking for is massively improved compile times, which is one of the biggest things Jai looks to have over C++ in addition to its compiler hooks and #run.
- std.experimental.allocator
- @nogc to ensure, well, no GC usage
- various things built on placement new (`emplace`)
- GC profiling with -profile=gc, will display number of allocations and size
None of this existed when people were already making high-performance systems with D...
[0] https://p0nce.github.io/d-idioms/#The-impossible-real-time-t...
--- A popular example is minecraft that uses mainstream G1 GC.
I was suspicious about #3 since classes in D don't necessarily need the GC. For starters D supports C++ classes, so this works:
https://gist.github.com/atilaneves/b69ed0399efac21bb7a977afd...
I used `scope` with `new` to allocate on the stack, but `emplace` should just work as well to "placement new" a class in malloc'ed memory.
#4 is annoying but one could always use the OS threading API. It's doable to write a library solution to do that akin to boost or Qt before C++11. You do it once and it's there.
#5 No dynamic arrays are also annoying. But... writing a clone of std::vector isn't hard, and there's a unique array in my automem library that _should_ be usable in betterC (but I haven't checked): https://github.com/atilaneves/automem/blob/master/source/aut...
> Another note is that a big thing I'm looking for is massively improved compile times
You get that with D.
You will say that you don't want a GC but in reality the GC can be optimized as much as you wan't, and in the mean time you'll get precious _developement time_ to optimize further.
If you can afford the D runtime by all means take it ; for some products I'm doing without the D runtime, and the surprise was that it did't make things any faster _at all_ without the runtime (we did it for other reasons). The only real gain is memory consumption of GC vs manual and that is achievable without going through extreme coercitive measures like -betterC.
Those rely on the garbage collector. If you are willing to do C style memory management, they are all available with betterC.
I tried creating my own languages before, some 15 years ago. While I had fun writing compilers, I missed a lot more writing actual programs. One day I suddenly realized I don't really need new language, what I needed is simply context dependent syntax and code block organization, which can easily implemented on the spot. It become MyDef and I have been programing with it entirely for more than 10 years now and wondering how others don't go down the same path.
Actually in a broad sense, Knuth's literate programing adventure is very similar to mine. He also wondered how others were not as excited as he was.
So rather than a new language, try a new dimension.
Here is a short example:
page: test, basic_frame
module: c
$local int A[3]
$for i=0:3
A[i] = i
$dump A[0], A[1], A[2]
Despite the look, if you know c, you recognize it as c. And as you get familiar, you see it exactly as C. `basic_frame` is merely a custom template so one doesn't have to always write the main function signature. $for is shorthand for `for-loop`, `$dump` is simply printf with simple type translations.Now that you had this meta layer, there is no limit on how you want to dress up your code. Examples:
$local A[3]: int
$sumcode(3) A[i]=i+3
$foreach A
$dump $(t)
or page: test, basic_frame
$call declare
$call init
$call report
subcode: declare
$local pn_A[3] = {1, 2, 3}
subcode: init
$foreach pn_A
$(t) = $(t)^2
subcode: report
$(set:print_to=stderr)
$foreach pn_A
$print "%d: %d", $(i), $(t)
There are lots of idioms and conventions, but it is not a problem as long as you recognize them only as clothing.Lastly, when dressing up the code makes little sense or you simply don't know better way of dressing them, you can simply write vanila C (or any languages that you are writing). MyDef never tried to compile your language.
Like ?
If you want to write games, use your favorite language, and just START. All limitations can be circumvented somehow.
Series of videos here - https://www.youtube.com/user/jblow888/videos - I don't program games but it looks super interesting
If you find yourself in a similar situation and want to get around it I would suggest trying unity, which I was hesitant to do since:
1. It felt like giving up and cheating, and
2. I don't like how unity interfaces with the developer, since I mostly wanted to implement games without using the world editor that seems to be the focus of unity.
But I've enjoyed using it so far and would suggest giving it a shot.
For very specific effects like universe turning, you have to do a lot of code work in a niche area, but it's still quicker than building a particle engine from scratch. Sometimes you can cheat the effect in shaders or camera tranform manipulation. Or skip the effect altogether if the volume of custom code is not worth it and you are prioritizing shipping. Ask yourself, does it make or break your game?
My role meant I had to make the correct business decisions using my technological knowledge and as much as writing engines and technology ran through my blood, the right answer was to switch to Unity. The man cost of constantly writing all the technology we need and then maintain it was too great compared to the ever diminishing wins we got from it.
One scary part of this decision was then hiring Unity programmers and initially having these new hires knowing more about Unity than I did. I needed to make calls about what is possible, time frames, performance, meeting client requirements etc without being an expert of the most important part of our development process. Luckily we made the right hires and it didn't take so long until I had been converted to the Unity mindset. Initially I would always be saying "oh well I would normally tackle this in this way" and wanted to coerce Unity to work in a familiar way. But overtime this disappeared and I became increasingly interested in working out the best way to achieve things in the "Unity way" which ultimately returns much greater dividends.
The first game we released, called Bloody Zombies came out last year on Steam, Oculus, Xbox One, PS4 and Nintendo Switch. It can be played in VR (on supporting platforms) and non VR. It is multiplayer, both in the sense of multiple people on one machine (you can do things like 1 VR player and 3 TV players or 4 TV players) but also online multiplayer (where you can do one player per machine or any combinations say one tv player on one machine playing with 1 VR players and 2 tv players on another machine).
VR meant we had to maintain a constant frame rate (60 or 90 depending on platforms). We used stereoscopic rendering, offloaded graphics work to a special job system. We used custom shaders (the game is like a graphical novel so outline shaded characters) we have spherical fog, lightmaps, FXAA, colour post processing etc.
Online multiplayer meant a packet system, ability to establish connections, matchmake, a system for making parts of the game world communicate, handling so many error cases, etc.
For variety of platforms meant lots of variety on the rendering, controller input etc.
For Switch it meant the ability to play on Switches close to each other on a different protocol to online multiplayer.
I shudder to think how much time and effort this would have been without Unity. I suspect we would have needed several new hires working on platform specific tech, full time network engineers, at least one full time graphics dev, at least one full time audio dev, one full time physics dev, the list goes on. Instead we had 3 programmers (which includes me where my time was heavily comprised being a founder/MD/Tech Director/coffee maker) and whilst the other programmers were very good they had both only graduated a few years prior.
Did Unity solve everything? Absolutely not. We hit loads of huge problems with Unity. Without help of their engineers some problems we would never have been able to solve. We helped Unity fix lots of issues at their end. We found issues that could have been solved trivially without Unity. We felt the strain of waiting days for an answer to a mission critical Unity issue. But in the grand scheme, the pain was less than 10% of what we would have experienced doing it with our own engine.
My big worry was not doing "tech" anymore, but that simply isn't true. But instead of having to write loads of architecture and code to even be able to write the "real" tech, instead you can write the more interesting stuff. For shaders you just write the shaders, not the system for passing in shader constants and setting up vertex streams. Post effects is similar. Coming from a strong engine/Tech background has been massively helpful, whilst unity trained hires are amazing it has been really useful for our studio for me to be able to get into the lower level to add feature, fix stuff, debug stuff, etc.
Wouldn't that make you feel nervous ? To totally depend on unity's merit to ship a game when you cannot address blocker bugs yourself ?
One good thing is that rather than us hitting lots of blocks with the hardware manufacturers with regards to the engine, Unity handles this instead and Unity is in a much better position to resolve issues due to their relationship with the hardware manufacturers but also the size of the dev team.
We still had several issues we had to deal directly with Sony/MS/Nintendo. Some issues they could resolve and others they could not (meaning we had to find elaborate workarounds or key changes to the game we didn't ideally want to make).
But yes, I am dealing with the interface, primarily by ignoring it. I'm still trying to get down the right way to organize my code, but it's making sense.
But more time I do the same things over and over, more I'm convinved I could abstract my main tasks (around data manipulation) in a simple language:
https://www.reddit.com/r/rust/comments/8ygbvy/state_of_rust_...
But the idiot of me think "and the let's use Rust... how hard it can be?". And now.. is HARD! Sadly, Swift was ruled out:
https://www.reddit.com/r/swift/comments/8zb9y1/state_of_swif...
and don't wanna do C/C++.
I expect the language to be a glorified DSL that is just about data, parsing, loading data, moving data, converting from this to that and a way better (I hope!) than ORM for interfacing to RDBMS.
Or perhaps making a small extension to one of the above, I know many languages have the ability to be extended through modules added at compile (meaning when you compile the interpreter/compiler/runtime itself, not the program) time, or used as a target for a preprocessor. That makes it so it's at least a little easier to get a userbase going, maybe some existing libraries can work with your language.
If that's not possible, I'd be curious to learn what makes it not feasible. Fresh approaches to data processing are really desirable right now, since so many of us are working with data that is different from what language designers intended.
I wish to use instead swift, that hit a sweet spot. Using other lang (like python, that I loved!) make hard to target iOS/Android. This is the main crux of mine. This mean that I need to re-code a lot of stuff across platforms and targets, because nothing is good enough. I also use xamarin/F# and the integration with android/ios is not as good as I imagine (ie: xamarin.forms sucks. And is damm hard to integrate yourself anything (ie: ios/android libraries) outside it).
I also try with nim but is too crude and lack a lot of libraries I will need. I'm also thinking on using pascal, that I also like much, so now is just looking how good could be the use of rust...
Give C++17 a try :)
I found myself having the same problem, luckily I don't know how to write a language.
I'm currently working on a part-time project in Go, it involve a HTTP service.
As you may already knew, there is a built-in HTTP server that came with Go, so I COULD just took it and go ahead directly start to implement my service logic.
But hell no, it's too slow. So instead, I made my own HTTP/1.1 server, which is bit faster than Go's.
It was pretty fun to write that server indeed, but I don't think it's worth the trouble. In fact, I really really hope somebody stopped me when I was creating that `http.go` file.
Now, I'm wandering around, thinking the `html/template` is too slow ...
But it was and is a good experience, the last 13 years of writing a compiler. Especially if you like solving problems with no or few searchable solutions.