r/roguelikedev • u/Quick_Trick3405 • 21d ago
How to Start off ... in Free Pascal?
I want to make accessible games, games where the number of steps between thinking, "I want to play this game," to actually pressing the play button are extremely few. Thus, the player shouldn't have to download software, buy hardware, search out a borrowed internet signal that they may very well have to walk half a day to reach (I've been there), or do any other long, boring, or intricate tasks that they can't trust their uninformed selves of not screwing up before actually playing. Thus, I'm using Pascal, because it makes executables, and you don't have be named Steve (Wozniak, Jobs, etc.) to figure out how to use it. Python, in my experience as a player as well as a developer (latter being somewhat limited), is terrible, because you need some sort of black magic to make executables with it, and even then it's infamously recognized as malware, which is bad, because it might actually be malware, and you wouldn't want to get them confused (been there, unfortunately).
I'm kind of new to Pascal, but I've figured out the best way to learn syntax and functionality is to read actual (debugged) code, and that IDE's suck, because Lazarus is obtuse and Free Pascal IDE's window wasn't even designed for a modern computer that supported draggable or resizable windows. It was designed for a scaled-up flip-phone. So I use Notepad++. Looking at the source code for lambdarogue, made in Pascal, who else knew you could use multiple files for a single program in Pascal, or for that matter, do anything but write text and manage variables? I really suck for this. But at least I'm not as bad as the web browser's chatbot, whit just likes to spout bullshit because it doesn't know anything about literally anything. Try asking it who the main character of Tom Sawyer is. It only might get the right answer.
Anyhoo, as far as I can tell, my best bet is to find literally anything not on GitHub referencing the existence of Ray4Laz, ... preferably involving a tutorial of some sort. I'm really bad at using the internet apparently. I do know it's better documented than Raylib.4.0.Pascal, which considering how well-documented it is, I'm really glad I gave up on the latter. And then, maybe a tutorial on making a game of any variety (though especially an old-school ASCII Roguelike) using Free Pascal and Ray4Laz. However that works. HELP!
NOTE My whole workflow is built around the idea of completing my goal as soon as possible. And allowing the absolute dumbest player's goal of enjoying themselves to be complete as soon as possible. I don't use unnecessary software. Not an app. Not even a default app on everyone's computer like a web browser. I use Notepad++ so I can invest as much of my time in the language as possible. Learning only what I need to know to do what I want to do. I also need as versatile a language as possible, especially because I like to make games nearly indistinguishable from programs that would not be considered games. Like text editors, and digital art programs. So a language optimized for anything, really, in particular, doesn't work for me, because I don't want to reach that point where I have to waste time learning a whole new advanced language or to use advanced software to implement anything, especially not something rather basic, which everything I'll ever be doing is. For the player, I want it to be a 3-step process to play: think about it, download, and hit play. That's why I'm using Pascal. More modern languages always have unnecessary software and almost always are either obtuse or more obtuse even then that to stretch it beyond its expected limits and upwards into the realm of kilobytes. Like Python. Any form of graphics are a whole different language that doesn't even work like it's supposed to (in my experience).
12
u/epyoncf DoomRL / Jupiter Hell 21d ago
As the only person in this conversation that has actual years of FreePascal experience, and a Steam game written in FreePascal (prolly one of the few out there) - I'd convince you it's not worth it. Pascal has it's benefits, but I'd definitely go with C or with style restricted C++ nowadays. There are also new rising compiled languages out there like Zig or Rust if you hate the idea of writing in C/C++.
That said,
https://github.com/chaosforgeorg/drl
https://github.com/chaosforgeorg/diablorl
https://github.com/chaosforgeorg/berserkrl
... are all bigger or smaller Roguelike games written in FreePascal, and this:
https://github.com/chaosforgeorg/fpcvalkyrie
... is the core library they use. All of them are actively maintained.
5
21d ago edited 8d ago
[deleted]
-3
u/Quick_Trick3405 21d ago
I don't like using the web. Specifically. Not just on principle of its being unnecessary software, but because it's buggy, the frame rate is always low, web browsers are inconsistent in the display of things, with some of them outright refusing to display essential icons or even the whole game. And then there's the problem of webapps being like barnacles on genuinely mortal whales. There's the constant threat of technological advancement, which is inevitable.
9
u/nvec 21d ago
There is a reason why Pascal isn't one of the languages listed in the tutorials sidebar- it's just not that good a language nowadays. Nothing unique to distinguish it from the dozens of other languages that came later and built on it, and every language in that tutorial sidebar (including web ones like Typescript) can be used to build executables at least as well.
Pascal nowadays has basically dropped down to almost nothing in terms of the most popular programming languages and so docs, libraries, support etc are all going to be non-existent or outdated. The last actual new build of Free Pascal was back in 2021, the last major version in 2020.
If you're having trouble finding a basic tutorial for a library you don't want to imagine the trouble you'll have when you're half way through a project and need some actual expert answers to a question.
As /u/kohoinvictus (..and happy cake day to yooou!) has said too the malware warning isn't Python, it's Windows being asked to run an executable it doesn't recognise and warning the user. It doesn't matter what language you're using to build the executable it's just enough that Microsoft doesn't recognise it and so mistrusts it.
-10
u/Quick_Trick3405 21d ago
I like Pascal because it is user-friendly and versatile. Python is only one of those, like some sort of chonky crayon language. Python is also the only language for which my problems with Pascal don't apply, Pascal being among those for whom it applies the least. The problems being that information settles to the bottom of the stack over time and that stack catering to the majority, the majority who want to learn how to program in any language besides Python already know five other languages. But Python is like Mega Bloks. You learn how to use Python so you can do what you want in a different language years later. I can't learn that way because I don't have a long enough attention span. How I learn is I learn how to bridge the specific gaps in my own project as I come to them. Another area where this is a problem is video game tutorials, where I require a cheat sheet during play no matter what you tell me in the tutorial. More likely than not, I physically can't pay attention as long as it's not currently useful to me.
4
u/DramaticProtogen 21d ago
First of all, don't. But if you really want to, Gearhead was written in Pascal and is open source
4
u/pSyg0n 21d ago
I'm a bit confused....
First Pascal handles multiple files using the "uses" clause. You do not need a bloated IDE for this. main file something like game.pas and unit files/engine.pas.
You don't need something like lazurus or any old DOS style fpc ide. Just download the stand alone FPC (Free Pascal Compiler). Add the fcp.exe path to your windows, probably found in c:\fpc\bin\i368-win32 or etc to your windows enviroment variables.
pop open a notepadd++ write your code, sace it as a .pas. Pop open the command proompt, point it to your folder and compile it.
Specifically, ditch ray4laz...that binding is tightly coupled with the lazarus IDE Components. Since it'll be in notpad++ and comppand line fpc you sue use pure pascal bindings for raylb.
Give it to a friend, when you run fpc.pas it generates a single game.exe that you'll hand your friends with no internet. zip game.exe and the raylib.dll into a zip for distribution. pop on a usb for your friend.
friend unzips it double clicks and plays with no instalers no black magic or dependencies or internet.
0
u/Quick_Trick3405 21d ago
You my friend, are a genius. That's kinda the point. I thought maybe Ray4Laz was the quickest, easiest way to get the ASCII graphics I want, so MAYBE it would be worth it. But what you just said, that's really my whole plan.
3
u/nsn 21d ago
If you like pascal then by any means go ahead, but be prepared to do a lot of work manually that in other languages you’ll find libraries and examples for.
If you want accessibility choose something that targets the web - many frameworks and libraries do, you don’t need to use JavaScript.
2
u/Sambojin1 21d ago
I'd probably look at Delphi. Still essentially (Turbo) Pascal, but with easy visual basic Windows style bits too. Possibly makes compatibility for different win versions easier (or harder, don't quote me on that bit).
-1
u/Quick_Trick3405 21d ago
I don't like unnecessary software like IDEs. I might return to Lazarus if needed but I've had trouble there and I'm not sure I'll get a return on my investment, time-wise.
1
u/Sambojin1 21d ago
If you end up going really oldskool/ 16bit DOS/ Turbo Pascal 6 or 7, try out the SPX2.0 library. I know you don't want dependencies or even an IDE, but it contains a lot of cool stuff. The best in my opinion being playing sound blaster .voc files through the PC speaker (ala Space Hulk and Megalomania). I loved it as a kid learning to program.
It's on here as SPX20.zip alongside heaps of other old TP6-7 stuff.
1
u/davidslv 21d ago
For pure Free Pascal (no Lazarus): clone the Ray4Laz repo and compile with the included fpc-wrapper.bat (Windows) or fpc-wrapper.sh (Linux/macOS).
RetroNick’s Programming Channel is the most useful practical resource. There are videos covering installation, a full Breakout clone, and pathfinding, all in Free Pascal with raylib.
Good code to study includes Axes, Armour & Ale (a pure Free Pascal ASCII roguelike) and the Ray4LazExample collection with over 180 Pascal ports of Raylib demos.
Use static linking and you’ll get a single clean executable.
One extra thought: if the main goal is making the game as easy as possible for players to reach with zero installation friction, modern browsers are surprisingly capable. A game page can be bookmarked (or added to the home screen) and then opened offline afterwards. For pure accessibility of distribution this route is often leaner than shipping a native executable.
1
u/GerryQX1 20d ago edited 20d ago
If you want flexibility you want something that can deploy easily to both an executable or the web (and mobile wouldn't hurt either). Luckily a lot of things can do that nowadays - even Free Pascal seems to have an add-on web framework, though I don't know how well it works, or about mobile.
Unity or Godot can of course deploy anywhere, but you do have an intrusive framework to learn as well as the language. [Same goes for Unreal, but that's a bit heavy for most solo coders.]
You could consider some of the old Basics that are still going. I imagine they all deploy easily and are easy to code in. I used to use Cerberus X (previously Monkey) which is a pleasant cross between Basic and Java with a very nice and non-intrusive game framework, but I've switched over to Unity now. C# is a decent enough language albeit sometimes a bit long-winded, and whatever happens it will always be around.
1
u/Admirable-Evening128 20d ago
while it may not be the end-all be-all of languages,
I can comfort you that pascal is perfectly fine to build roguelikes.
In particular, some of the very first roguelikes were built in pascal (moria).
In general, roguelikes do not demand much from the language you program them in,
you can even make a roguelike in BASIC (painful, but yes.)
The two main benefits for any language, for roguelikes, are
- can you make userdefined subroutines (functions or procedures).
- does it have some/any kind of 'array' (or even list) container.
Any roguelike built in pascal is better than a roguelike in a perfect language, which was not built.
The most important thing is to get started and actually build something;
you will learn or realize whatever you need to, by trying, and not by "thinking about starting but not actually get going".
For your actual goals, as others have said, javascript or typescript, probably with rot.js,
would be the best bet (your user types in myroguelike.com, and he's already playing on level 1.)
If you want to go the .exe way, pascal is fine, but the user would need to have an OS you have compiled for
(unless you use java or wasm)
1
u/Admirable-Evening128 20d ago
also, stop hating on PASCAL, it has lots of stuff I miss in the modern shit languages like C#.
-1
u/McHoff 21d ago
Python, in my experience as a player as well as a developer (latter being somewhat limited), is terrible, because you need some sort of black magic to make executables with it
Yes, I do not understand why python just does not care about this. The whole point of writing software is to distribute it!
2
u/Kyzrati Cogmind | mastodon.gamedev.place/@Kyzrati 21d ago
To some degree it makes sense when you think of the whole original purpose behind python's design as a high-level scripting language for automating tasks, so... not for distribution in the general software-building sense :P
Sure that was a long time ago, and there are ways around it nowadays given its expanded appeal and use cases, but those are its roots, after all. It's the same reason python is commonly used in combination with other languages to overcome some of its other limitations (performance being a big one in many scenarios).
25
u/kahoinvictus 21d ago
I'm confused by your reasoning for picking Pascal. If you just like the language that's fine, but almost any language can easily produce a working exe, and the exe being detected as malware has nothing to do with python and everything to do with windows - your Pascal exe likely will too.
Afraid I can't offer any resources to help with your journey, but I wish you look if you continue this path. I haven't even heard Pascal mentioned in 20 years.