13 ms·
Castle Engine – Free open-source cross-platform 3D/2D game engine using Pascal
- Jean-Papoulos 3y agohttps://castle-engine.io/why_pascal https://castle-engine.io/why_pascal I'm gonna have to put a damper on things, here. Most of the reasons listed are things available in any other modern language (safety, cross-platformness, libraries...) but one of the things cited is readability. I work on Pascal code 8 hours a day, and it is not more readable then conventional C syntax ; I'd argue it's much less. The fact that you need to use entire words to denote syntax makes it much harder for your brain to parse things : Instead of immediately seeing "this is code structure" and "this is actual code", you need to actually read the words to make that distinction. It is very counter-productive and a bad design solution, imo. I feel like this page was written 20 years ago. The reasons would have made quite a lot more sense back then, notably about the type safety.
- deleted 3y ago[deleted]
- nurettin 3y agoI don't have a preference over whether C or pascal is more readable. One might seem more readable depending on my mood or time of day just like editor colors. But my main reason to use a pascal game engine for games would be to avoid garbage collection.
- dazzawazza 3y agoPossibly most of these arguments are arguments in opposition to Lua, the dominant scripting solution in video games, as opposed to pure positives for Pascal? In the 90s a spent many years programing in pascal in Think Pascal... not glamorous but it got the job done. It's not too bad but I program on C++ now so... yeah, maybe my brain has melted.
- vintagedave 3y agoWords can be helpful for people who don't like symbols? C is very terse, Pascal verbose. It's like C vs Python. Single-character symbols can be hard to parse for some people in the same way words are for you. A good IDE / code structure will make the structure and code easy to differentiate anyway.
- mirpa 3y agoI see no difference in learning symbols in order to read source code and learning alphabet in order to read words/sentences.
- tmcdos 3y agoThis is like comparing Latin alphabet with Egyptian pictograms or Chinese hieroglyphs. The time has proven multiple times that using words is easier for humans than using symbols.
- spookie 3y agoPicking up a game engine without prior knowledge and making something on your free time, I assume that would be the aim.
- darkwater 3y agoMost probably you already learnt the alphabet in the past, and there is 0 cognitive load for your brain to parse it. Unless you come from a language using another alphabet, but then unfortunately you need to bow to Latin alphabet rule over programming languages in any case.
- mirpa 3y agoOh, really? if ((input = 'y') or (input = 'Y')) then begin writeln ('blah blah'); end else if ((input = 'n') or (input = 'N')) then begin writeln ('blah'); end else begin writeln ('Input invalid!'); end; if input == 'y' || input = 'Y' { writeln ('blah blah'); } else if input = 'n' || input = 'N' { writeln ('blah'); } else { writeln ('Input invalid!'); } If you find Pascal easier to read, I would guess you have very special set of eyes.
- lelanthran 3y ago> The fact that you need to use entire words to denote syntax makes it much harder for your brain to parse things : Instead of immediately seeing "this is code structure" and "this is actual code", you need to actually read the words to make that distinction. It is very counter-productive and a bad design solution, imo. While I agree that it gets slightly tedious to read daily, I have to say that there is no language other than pascal that lets me come back to the language after 3 years and instantly be able to read it with no problems. I don't know if any other language where this is possible.
- tux3 3y agoWhile I'm not the world's #1 Golang fan, this is something that they have. They took a lot of complexity out of the language, so any code you look at will seem very simple & readable. There's not a lot of magic syntactic sugar, you just write things down the simple verbose way. The flip side of that coin is you have to reimplement a lot of things yourself, so any essential complexity that the language doesn't handle for you is pushed on you to re-implement in your codebase. Python's decent at this too. At least the simple Python people use in small scripts. It's almost pseudocode, as long as no one tries and overengineers it.
- archargelod 3y ago> Python's decent at this too. It's almost pseudocode. Nim has Python-like syntax. But, I find it even easier to read/parse at a glance than Python. Also, I hate that in languages with dynamic typing you have to read whole function to understand what type of arguments it takes and what is the return type. Nim is statically-typed, so all the types are properly declared.
- wizzwizz4 3y agoIn my experience, Python, C and JavaScript* all have this property; whereas I have to relearn Pascal, Haskell, sh and (to an extent) Rust every time I go away from them for a bit. I think this is more a property of you or I than of particular languages. *: excluding `for (… of …)` and `for (… in …)` – I can never remember which is which. `for (… of …)` is the one you can use with Arrays and other iterables.
- badsectoracula 3y ago> I work on Pascal code 8 hours a day, and it is not more readable then conventional C syntax ; I'd argue it's much less. I'd disagree with that. I've worked on several Free Pascal projects, C projects, C++ projects and some other stuff and i find it easier to follow Free Pascal code in big projects written by other people than C/C++/Java/etc. At least, i'd say that outside extreme cases (like esoteric languages - or trying to write OOP code in an XML-based language with only imperative functionality :-P), readability is up to the reader. Go is the only other language i found easy to follow, despite not really knowing much about the language itself, but Go is also a much simpler language, more limited in its feature set - Free Pascal on the other hand is a "kitchen sink" language where everything and anything goes and yet it still remains easy to read. That said, IMO the #1 reason to use Free Pascal isn't so much the language itself (most of the stuff mentioned are also available in, e.g., D - and i'd say that D does a much better job at doing compile-time stuff to the point where you can probably implement yourself any missing features from Free Pascal) but the Lazarus IDE and the FCL and LCL frameworks. Well, that and that it has a very fast compiler with a decent optimizer (and there is the new LLVM backend if you need more oomph, though with a big hit to compile time) and a large number of supported platforms. Also great backwards compatibility. That is very important, if my X years old code that used to work stops working without externally imposed reasons (e.g. uses OS-specific code and i switched to another OS or the universe replaced x86 with RISC-V) i don't care how clean, consistent, elegant or whatever else a language might be that give theoretical language designers warm feelings, i care that my code that worked doesn't work anymore.
- graemep 3y agoCan you expand on Pascal vs Go? What is Go missing? I do not know much about either language, but the first thing I thought when people compared Pascal to Go (another comment, not yours) was what about concurrency? Go does have strong concurrency story. AFAIK there is a lack of mobile support, so the use case for Free Pascal is strongest for cross platform desktop apps? Is it something you think is still worth learning? Using for a new project rather than legacy code?
- andsoitis 3y ago
- sylware 3y agoWell... at least there is not pascal++ and that's a win for sure..
- erfgh 3y ago> Instead of immediately seeing "this is code structure" and "this is actual code", you need to actually read the words to make that distinction. First of all, there is syntax highlighting. Furthermore, after the first few times you see a word you don't actually "read" it in the sense you mean here, you are just matching it, as an image, with other words in your vocabulary. So it's not any harder to "read" a word than to read a curly brace, assuming no other very similar words are used in the vocabulary of the language.
- thesz 3y agoWords can be read as single hieroglyphs, basically, it is matter of experience.
- dadie 3y agoAs someone who has been coding in Delphi for a living for the past 5 years I'd argue the syntax being verbose is only a small part of a larger problem, which is that (object) pascal is a very bad language for pattern recognition. The syntax highlighting in current IDEs like RAD Studio or Lazarus is very poor (though I'm not as familiar with the later). I mean I think aside from keywords, strings, numbers and comments everything has the same color. Even if the syntax was less verbose, we'd still be reading each word. It is basically the same as having no syntax highlighting at all. And even assuming the syntax highlighting would get better and/or the syntax would be less verbose, we'd still be reading each word because of the case-insensitive nature of the language. The compiler might not care about the case, but at least my eyes do. So unless I'm reading the word I could not really say whether MyMaGiCaLnAmE and mYmAgIcAlNaMe is the same name or not.
- Log_out_ 3y agoIs it though. The whole cross Plattform is a leaky abstraction almost anywhere. Just accept it's gonna be limited to windows and reduce the workload for main revenues market.
- musicale 3y agoNoticed this on the modern object pascal intro page: {$R+} // range checking on - nice for debugging I want this (perhaps as a compiler and/or runtime option) for clang/gcc as well.
- bitwize 3y agoOooh, Pascal. This'll tickle the fancy of some old-school demo and game coders. I bet we'll see some unique things emerge from this.
- spockz 3y agoI learned to really program in Delphi, before that it was PHP. Pascal and derivatives still hold a special place in my heart. I never imagined nee development would be done with it!
- finnjohnsen2 3y agoMe too. Delphi 4 was THE BOMB! I loved it so much.
- hansonpeter 3y ago[dead]
- bbor 3y agoOk I’ve got a hacker challenge for the more creatively-inclined: if I wanted to stretch “cross platform” to web (and thus webVR?), how might I wrap/integrate/emulate/polyfill/whatever this? EDIT: after a quick search the answer is a resounding “you can do it, but yikes.” Multiple people reference custom compilers, which I’m guessing are beyond my reach… https://news.ycombinator.com/item?id=12029566 https://news.ycombinator.com/item?id=12029566 EDIT 2: wow nvm it’s on their roadmap! Their “why pascal” page says it’s already supported, but i think thats more hopeful than contractual. Coming soon (roadmap): Oculus (VR) (we have the hardware to test) WebGL (FPC can compile to WebAssembly) XBox (we have the hardware to test). (Love the casual “we own at least one xbox” humble brag. If the authors are reading this, that’s the only part that I find a tiny bit off putting — a tinge of overeagerness to persuade me / sell me.) https://castle-engine.io/features#_cross_platform https://castle-engine.io/features#_cross_platform Highly recommend the “Why pascal” page in general, the most interesting part of the project to a passerby like me: https://castle-engine.io/why_pascal https://castle-engine.io/why_pascal
- vintagedave 3y ago> Love the casual “we own at least one xbox” humble brag. Maybe it's not a humblebrag, but showing they're taking cross-platform seriously. I don't own an Xbox for example, and if I worked on something like this, buying one would be for the specific reason of making sure the project worked. I'd communicate that.
- bbor 3y agoI guess my observation was more along the lines of “they’re game devs, they almost definitely have at least a few Xboxes between them”. But of course a matter of rhetorical taste, and I think you’re in the majority
- michaliskambi 3y agoAs for our mention of XBox on https://castle-engine.io/features https://castle-engine.io/features : the point I wanted to say there was that we have "development" version of Xbox, as provided by Microsoft. Though it doesn't matter much nowadays, since retail Xbox versions can also be used for development, from what I read. I edited that statement to say this """ XBox (we have the hardware — even devkit, though "developer mode" can also be activated on a retail version of Xbox). """ As for web: - This is mentioned on https://castle-engine.io/why_pascal https://castle-engine.io/why_pascal as supported nicely by FPC compiler. FPC can compile regular Pascal code to WebAssembly, there's also Pas2Js that can compile regular Pascal code to JS. See samples e.g. here: https://github.com/genericptr/Pas2JS-WebGL?tab=readme-ov-file#pas2js-webgl https://github.com/genericptr/Pas2JS-WebGL?tab=readme-ov-fil... - In the context of Castle Game Engine, web is part of "Coming Soon" of https://castle-engine.io/features https://castle-engine.io/features . We want to utilize above to enable to recompile any Castle Game Engine application (as long as it uses cross-platform API) to the web. Details are on https://castle-engine.io/wp/2023/04/08/web-target-progress-and-plans/ https://castle-engine.io/wp/2023/04/08/web-target-progress-a... .
- tommica 3y agoHow fancy, hopefully the project is successful - interesting language choice, always have put "Pascal" as an out-of-date language, but clearly I was wrong
- baq 3y agoTurns out Go is mostly Pascal with curly braces and nobody is calling Go out of date ;)
- thibaut_barrere 3y agoI often told people that Go reminded me so obviously of TurboPascal (which I dearly used in my childhood) that I felt something "warm" when coding with it :-) I enjoy using it, even though I didn't decide to use it as my main stack for various reasons.
- bitwize 3y agoThe engineers behind Go (and Plan 9) really loved Oberon, which influenced the UI of Plan 9 and Acme, and the developer ergonomics of Go.
- ramon156 3y agoOut of date is more than just syntax
- moffkalast 3y agoAs of this moment, I'll start calling Go out of date :D I mean it doesn't even have generics or exceptions, get with the times.
- LispSporks22 3y agoI have a feeling those pascal developers are getting stuff done super productively.
- bbor 3y agoObject Pascal is a modern programming language. It supports classes, units, properties, generics, interfaces, reflection, closures… Everything you expect from a modern OOP language. :shrug:
- wolvesechoes 3y agoThis is what amazes me. If you go through the available Delphi/FPC libraries, you will find basically anything. From CAD drawing widgets to frameworks for building SCADA systems. Most are not present on GitHub, and if they are, don't have hundreds of stars. On the other hand I have an impression that in more popular languages like Rust - which I use for my projects, I admit - most projects fall into "grep for the 1000th time, but this time made right".
- timw4mail 3y agoExcept most of that stuff in Free Pascal doesn't really have documentation.
- CarRamrod 3y agoI've never commited to going deep on a project in Pascal. Seems a bit too high-pressure for me.
- incanus77 3y agoThe trick is to take it a millimeter at a time.
- fuzztester 3y agoA millipascal at a time.
- d--b 3y agoSorry to explain the joke, but pretty sure he was refering to milimeters of mercury => another pressure unit.
- coderedart 3y agoTy. I could feel that there was a joke in there somewhere, but didn't remember the mercury pressure thing
- zem 3y agothat should be no bar to using it
- fuzztester 3y agoYou're giving me high blood pressure. A pascal walked into a bar.
- DeathArrow 3y agoAfter learning Basic at home, once I went to high school, Pascal was the first "serious" programming language I've learned. But since I discovered C a year or two later, I never looked back to Pascal. C felt more "pro", more flexible and seemed closer to metal. Pascal seemed more appropriate for developing GUI apps, while C seemed able to tackle anything, from the most intricate guts of the operating system, to drivers, games and GUI apps. Of course, that was silly, because Pascal was able to do everything that C did, but to my younger self it seemed less "serious" and "pro".
- SantiagoElf 3y agoSimilar experience. Around '96-97 I was playing with writing fire effects in Turbo Pascal, most of the tutorials used the asm with mode 13h, and all I had was Turbo Pascal 5.5, which didn't support the asm keyword. So, I dabbled a bit with it, and then in late 97, I found about C, and when I saw the for loop in C - I never touched Pascal again.
- vr46 3y agoAt the very bottom of things I expected to see this week, amazing. Worth playing with on sheer chutzpah, hats off to everyone involved. I don’t know a thing about Pascal, though, why would anyone still be using it? Is it good?
- tsukurimashou 3y agoHah pascal, the first language I learned to script some game named Soldat when I was a kid, fun times
- thesnide 3y agoSoldat was actually the first shareware I bought, as I totally didn't have to, yet I sunk so many hours in it. Without doing much progress skill wise :-D
- tsukurimashou 3y agohaha me too! I sent a bank cheque to MM when I was 12 because I wanted to support the guy (and I was so glad that this game existed because I had a toaster and couldn't play any of the "modern" 3D games at the time)
- thesnide 3y agoMM even opensourced it https://github.com/soldat/soldat https://github.com/soldat/soldat
- shoozza 3y agoIn the meantime the repository moved to: https://github.com/opensoldat/opensoldat https://github.com/opensoldat/opensoldat After MM sold the game to someone else I felt like it would be better to make sure the name is different as the new owner had different plans and did not want to continue releasing the source code. Later someone unknown hijacked the original url and copied an outdated version of the repository (you can see the mention of OpenSoldat.)
- thesnide 3y agoThx i didnt know that. Was actually wondering about why 2.
- shoozza 3y ago
- dang 3y agoRelated: Why use Pascal? - https://news.ycombinator.com/item?id=36646890 https://news.ycombinator.com/item?id=36646890 - July 2023 (307 comments) Modern Object Pascal Introduction for Programmers - https://news.ycombinator.com/item?id=36371434 https://news.ycombinator.com/item?id=36371434 - June 2023 (3 comments) Castle Game Engine Roadmap - https://news.ycombinator.com/item?id=36365420 https://news.ycombinator.com/item?id=36365420 - June 2023 (10 comments) Modern Object Pascal Introduction for Programmers - https://news.ycombinator.com/item?id=28079093 https://news.ycombinator.com/item?id=28079093 - Aug 2021 (3 comments) Castle Game Engine: Cross-platform 3D and 2D game engine - https://news.ycombinator.com/item?id=23741883 https://news.ycombinator.com/item?id=23741883 - July 2020 (20 comments) Castle Game Engine 6.4 released – physics, iOS services, shader pipeline upgrade - https://news.ycombinator.com/item?id=16207075 https://news.ycombinator.com/item?id=16207075 - Jan 2018 (2 comments)
- masfoobar 3y agoCannot remember the last time I used a programming language in the Pascal family. Our programming course we had to use Delphi. This was college back in 2001. I purchased a copy of Delphi 5 (my college has version 4) so likely tried things for a year or two afterwards. I doubt I touched Delphi after 2005. In College we had to create a Stock Control program. It was an IT course so most people struggled as programming was not their direction. For me being a "prodigy programmer" had no issues jumping into Delphi. If anything, knew little about Delphi. Once I started coding and realised I was typing var, begin, end, or := (etc) -- I knew it was some kind of Pascal. Going back to my earlier days in high school, I had a copy of Turbo C and Turbo Pascal so thats why I had a little head start. I remember the difficult part was storing the stock data in a binary file, using binary search to find data, etc. My tutor was old-school so I wouldn't be suprised if Delphi had more 'out of the box' solutions which we take for granted in modern Go, C#, etc. Everyone struggled to get their code to build. Brings back fond memories. Today I place Pascal in the same Category as Basic. Seems like an interesting project but I just dont have interet using Pascal so would be a deal breaker for me. I would not be surprised, however, if there is still a pretty large base of Pascal defenders out there. More power to them if the case.
- optymizer 3y agoWe're probably in the same age group. I used to write simple games and graphics apps in Turbo Pascal in high school. Later on I used Delphi to write "business apps". To me, there isn't that much difference between Pascal and C in terms of language design. I used to translate my Pascal code to C by replacing begin/end with curly braces, moving interface declarations to header files, replacing well named functions to cryptic-sounding strtok calls, etc. It was all so unnecessarily ugly in comparison. C is my favorite language now, but the cleanliness of Pascal and the user friendliness of Delphi have stuck with me as reminders of how great a developer experience can be. I've been using Android Studio for 10 years now and the experience doesn't hold a candle to Borland Delphi Architect from 20 years ago. We might have more advanced features these days, but it's a disconnected mess in comparison.
- masfoobar 3y ago
- dkersten 3y agoI took a look at the code, since I was curious far a large Pascal codebase looked like. I haven’t seen a substantial amount of Pascal code since about 2001. One thing I noticed was the file names, I can’t say I’m a fan of prefixing every single source file with “castle”, it makes it much harder to see what the file is about and makes them all look the same. I can’t comment on the actual code, since I’ve never written any Pascal. The engine looks cool though!
- vfclists 3y agoThis is no different from yacc files being prefix by "yy". It makes it easier to spot which files are castle files and avoids collisions with files/units from other libraries. Meaningless nitpick.
- dkersten 3y agoBut if you open the source directory, “every” file is a castle file. I already know which files are castle files because they’re in the castle directory. It’s redundant information and it makes it hard to browse the files, eg I now need to scroll my file browser in my IDE to the right (so can no longer see directory names), Dane for tab labels snd file path breadcrumbs (on GitHub and in IDE), and on GitHub at least on mobile which is how I viewed it, it cuts the filename off after a certain length. So I disagree that it’s a meaningless nitpick, it directly affects how easily I can navigate and read the file names. Just because yacc does it too doesn’t make it good (but at least in yacc’s case it’s not redundant information to know they are generated files, unless you put them in a yacc directory)
- jlarocco 3y agoHave to agree with the OP here. There may be a handful of yacc files in a large project, so prefixing them with "yy" is convenient to locate them quickly - though I'd still prefer a dedicated subdirectory. Every file in this project is a "castle file", so preceding every name with "castle" is pretty useless and hinders readability and navigation. If it's not part of castle, it shouldn't be checked into the repo.
- thesnide 3y agoI'll have to try it, if only to honor Wirth. And mostly to see if those fond memories of learning to code with Turbo Pascal survived the test of time...
- lelanthran 3y agoProbably, IME. https://news.ycombinator.com/item?id=39427811 https://news.ycombinator.com/item?id=39427811
- omgmajk 3y agoMost comments in this thread reminds me of the discussion we had under a discussion about Fortran recently, here's the comment thread regarding Pascal https://news.ycombinator.com/item?id=38966342 https://news.ycombinator.com/item?id=38966342
- malkia 3y agoPascal (Turbo/Borland) was the most most fun I had programming back then. The "Unit" of compiliation just worked (and yes it allowed only DAG-like dependency hierarchies). It was super fast to compile and use, but also to edit/debug. Then something got lost with Delphi, it's not that it was a bad product, but people started looking elsewhere... I still cherish the day, as Pascal gave me the headstart to C/C++ from Apple Basic, but also allowed me to start using bit of inline assembly and learn it along the way...
- alanlammiman 3y agocastle is not a good choice of name though as castle dot xyz is somewhat of a game engine too
- sylware 3y agoAnd it is a proof than grotesquely complex c++ oo is more than useless for a 3D engine. Namespaces using the preprocessor should be enough, if you need more, you are the problem.
- zoom6628 3y agoI like pascal - learnt it in second year if tertiary and used off and on for a while. In my opinion as a bad developer and less-bad product manager FPC is the embodiment of duct-tape programming [1] is only that and c# in which I have seen that ethos in developers. [1] https://www.joelonsoftware.com/2009/09/23/the-duct-tape-programmer/ https://www.joelonsoftware.com/2009/09/23/the-duct-tape-prog...
- Fischgericht 3y agoIt's really a pity how badly the Delphi product was managed by Borland/Embarcadero. Object Pascal is a great language. These days it produces native code for pretty much all platforms out there. The binaries created are tiny, and the speed is high - close to what C will give you - meaning that typically the code will run between 100 to 10000 times faster than comparable Python code. When it comes to Castle Engine, it's a gigantic project, making it extremely easy to create games and 3D applications in a RAD kind of way. And unlike other huge Pascal frameworks, it's not a legacy product, but very actively developed. I have HUGE respect for the developers. A comparable gigantic impressive project is Mormot, and ORM/SOA/MVC framework which is based on extremely optimized code. Building a Server application with Object Pascal and Mormot is easy to do, and where using NodeJS might be able to handle 500 requests per second, with pascal code you will be in the areas of 10000+. And this means that while with other languages you might need to run dozens of servers to handle the load, your Object Pascal based server code instead would easily run on a single server. So, using that language can give you massive cost savings. A lot of people only remember Object Pascal as a teaching language. But the language has evolved, and still has features other languages are lacking, most importantly RTTI (aka reflection). There is only one area where the language isn't up to date, and that is having Multithreading/coroutines integrated into the language itself like it's done in Go. And finally: I can still compile and run code I have written 40 (!) years ago. Within those 40 years tons of languages have come and gone out of fashion. Pascal is still here. Back to Castle Engine: Even if you are not familiar with the Object Pascal language, I can highly recommend to try out their visual editor. It's just amazing.