InDarkestNight Posted October 24, 2023 Share Posted October 24, 2023 I've been thinking about making games with text-based graphics, seriously. Part of this is due to my inability to find a decent game engine that can draw graphics. I was trying pygame for a while, but I just got fed up with the lack of information on the language, the arbitrary limits of it (such as not being allowed to have more than one window, among innumberable other issues from it being made with a outdated version of sdl), and performance issues. On top of this though, I figured it would actually be a bit of a fun experiment to see how far I can push text-based games. Text-based games you see today are mainly just 'interactive fiction', aka a 'choose your own adventure' book in digital form. I figured though much more can be done with it. Either way, I've found python highly limiting, especially compared to older languages like Basic. For instance, let's say you wanted to make an rpg (graphics or no) or some other game where you can move between different rooms. There isn't really possible in python. You only have two options; make a long list of elif statements to find which room the player is in, which is clearly not effecient, or do the stupid thing and have functions call each other, which will of course cause the program to quickly flood the RAM. I honestly wish I could this the sensible way and just go a goto or gosub command. Goto in particular would be ideal for such an application. No 'figure out which room the player is in every time they move', just 'go to this area of code and do this'. Thinking about this again today, I came to a realization; python wasn't made for stuff like this. I mean, who does games like this anymore? Seriously. Why would anyone support it? That's probably why there's no way to efficiently do a lot of things in python; it simply wasn't made with such things in mind. Essentially, I'm trying to use a language for make things it was never intended for. That's like making a browser game with just html and NO other language. Clearly it can't be done. I've been thinking that honestly I would be better off with c++. At least that has a goto command, niche as it may be in the modern world. Besides, having a compilable language would improve performence anyway. I can't draw graphics with it obviously, but if I'm making things strictly text-based, why not just use c++? The only reason I focused on python so much was for pygame, which I'm not using anymore. On the other hand, I have been thinking that using tkinter maybe a wise idea just to avoid having a command-line interface. Another thing I've been thinking about is longevity; the main reason I'm looking to make my own games is so I can keep games I love forever, rather than having to f*#@ing buy them over and over. There's also the fact that they cost no money, and I have the source code so I can 'mod' the things in anyway I wish, no limitations. Given all that, an interpretted language like python may not be such a wise idea; just look at what happened to Flash. Don't know if a compilable language would be any better though. Yeah, I could just re-compile the thing on a machine the original exe won't run on, but given how programming languages are perpetually being updated, the thing may not compile after a while (at least without me going through the thing and modifying it by hand). Maybe that's just a lost cause, I admit, though I'm still thinking that something like python wouldn't really be ideal for what I want. As I said, the thing has arbitrary limitions in the thing that forces you to do things in stupid and highly ineffecient ways. If someone could give me a way to do something like a game where you can move between multiple rooms or locations without having to use a long list of if-then statements every time the player moves to a different zone, I would love to hear it. I mean, I don't even see how you could make a game with graphics in python. The base module simply doesn't have all the commands you would need, and as far as I'm aware there's no module that does. Anyway, what should I be using? Is python my best bet? Should I just switch over to c++, for performance if nothing else (though I would have to sacrifice having an actual GUI if I did that)? Maybe use another language? I've noticed that notepad++ does support blitzbasic, but I have no way of knowing what version it supports or even if I could find the resources to learn such an old language (I have tried to look up c, but have come up completely empty time and time again). Link to comment Share on other sites More sharing options...
InDarkestNight Posted October 24, 2023 Author Share Posted October 24, 2023 (edited) Making this post so people see it; before anyone asks, I have a multitude of reasons to make text-based games in the modern era. I don't care what games look like now; to me the only reason you would play a game with modern graphics is so you can turn it into a realistic simulator. Its the only reason I play Skyrim. In fact, Skyrim is the only 3d game I play with any regularity. Outside of simulators, all I care about is the gameplay. I'm literally the type of player who in Magic the Gathering enjoys interesting decks and bemoans when they rotate out of standard (note that I haven't actually played MtG in nearly 20 years). Also, as I said it would be an interesting challenge. Besides, thinking about it, it would actually offer some benefits; there's a lot more freedom when you don't need graphics. Hell, you can actually pull off things that literally wouldn't be possible with graphics-based games. One of the first things that come to mind is aging. With just text, you can have a realistic aging system instead of the system in the sims games where characters just metamorphose every week or two. Also, I like lovecraftian horror, which just doesn't work when you give a visage to the monsters. Its a genre that just works better as being purely text-based. I could go on like this, but I won't for the sake of making yet another wall of text. The point I'm making is I have plenty of perfectly sensible and valid reasons to do this, so just answer my question please and don't bother trying to talk me out of it. I admit, I would be willing to use graphics if I could; I did try to use pygame, but that just didn't pan out. Oh well, what can you do? edit: typos Edited October 24, 2023 by InDarkestNight Link to comment Share on other sites More sharing options...
InDarkestNight Posted October 24, 2023 Author Share Posted October 24, 2023 Looking up the history of python, I found that versions of python prior to version 3 can no longer be interpretted, meaning that older versions of python won't run on modern machines without being completely re-written. Clearly then, python isn't good for longevity. On a side note, apparently pygame v2 finally came out. Can't seem to find any info on what changes it made, but maybe that may explain why examples of pygame programs on youtube for some reason run much better than mine despite clearly doing far more. Also, from what I've read python is far better at handling strings than even c++ for some reason (though I've also read that c++ gets a lot of flak for being highly ineffecient with strings). For text-based games, maybe python would be better. Guess maybe I should make a c++ conversion of one of my half-finished programs (from a project that stalled when it came time to make an ai and I came up blank). Then I could see for myself if it 'draws' the screen any faster than a python program that does the same thing. I admit, maybe longevity is impossible; there's surely a reason why games from the 90s need an emulator to work on modern systems. I would guess compilable languages aren't much better though; surely the compiler program would stop accepting outdated source code if nothing else. I am rather curious though why Dwarf Fortress needs no installation. That game's been around since the early 2000s. How could it still run on modern computers without issue? Then again, I've found that starcraft installed from the original discs runs perfectly fine on windows 10 for some reason. I've also noticed that it has compatibility mode for OS much further back than windows 7 ever supported. Maybe modern operating systems just deal with outdated code better than older ones, given the increasingly popularity of retrogaming? However, I've also seen a lot of complaints about how Skyrim LE won't work at all on windows 11, so maybe that's wrong? I have no idea what's going on anymore... Link to comment Share on other sites More sharing options...
InDarkestNight Posted October 25, 2023 Author Share Posted October 25, 2023 Well, been running some tests. Decided to try out Java (which I also have a certificate in). However, for some strange reason my computer refuses to compile Java no matter what I do, even though my software clearly had no problems doing so when I was working on that certificate. Wtf? Fortunately, apparently I can still compile c++, so that's something. Regarding c++, I decided to run a bit of a test. I had it and a python program race each other to see which could print "Hello World" 1000 times. I did this to see for myself if python really was more efficient than c++ with it came to strings. Turns out, it is not. The c++ program did this in 3 seconds, the python program took 14. So clearly, c++ is more efficient than python. Guess my best choice here is to just use c++. It has more commands (such as a switch statement, which my version of python at least does not have, also can't get the dictionary trick to work either for some reason, maybe its just not supported by my version of python). On the other hand though, machine learning programs require python, which I may need to write an AI over one of my games. The engine is already written in python anyway, and translating it to c++ would take a lot of effort. Maybe I should just leave that in python and see if a deep learning program can figure out how to play it. Fortunately, w3school now teaches how to do that, so its actually an option for me now (when I asked about it, I was told that you needed the equivalent of a master's degree to do that, and I only have an associates). Of course, either way it may end in disaster; this program is a card game and I've heard deep ai programs really like to manipulate random number generators, meaning that in my program the thing may try to stack the decks! Don't really know what else I can do about it though. Link to comment Share on other sites More sharing options...
RitualBlack Posted October 31, 2023 Share Posted October 31, 2023 Hi, just a few points worth mentioning: I can almost guarantee there is no circumstance in a text based game in which performance will be so tight that utilizing a 'go-to' is worth the tradeoff in maintainability. Additionally python itself (like many other languages) isn't limited to executing python code; you see a lot of python used in various science fields because there are C++ libraries which can be easily utilized to model big data or aid in ML / AI which actually are processing datasets which can be bottlenecked by language choice (hundreds or thousands of GB+). Python itself is not likely doing much of the machine learning nor is it required for ML, and you will not likely need to utilize LLM based generative AI within your game. Any of the languages you have mentioned will be capable of making a game as well, unless you are running on extremely limited, niche or era-specific hardware even non-compiled languages will work exceptionally well Game Maker, Unity (licensing issue as of late) or just about any other engine will have support for 2D with text Having Switch statements or lack thereof should not be the determining factor when selecting a language, 'moving between rooms' within a text based adventure should probably be a parameterized function call which can utilize constructors / destructors which solve your described RAM issue. If you're not cleaning up after your program it is assumed that holding the memory in use is intended. Having linear code execution and script completion being responsible for garbage collection isn't ideal for long running applications Text based games are more popular now then they have been in ages so there are a lot of people currently making them so there should be no lack of resources available Your question about dwarf fortress not needing an installation is that it is a 'portable' game, you can look into portable software for more details on itHopefully some of the above is helpful! Link to comment Share on other sites More sharing options...
InDarkestNight Posted October 31, 2023 Author Share Posted October 31, 2023 Honestly, I've never really developed anything big. I don't really know how large programs perform. I have had programs flood my ram, but that were programs that added in MILLIONS of entries into a list. Yes, I've made programs like that, because it was the only way I could think of to count all possible combinations of something. I know its not efficient, I only did it because I knew of no other way. Sometimes you need to just brute-force things. That said, I have heard of people using python and c++ and other things together, but I have no clue how to do that. My degree didn't cover mixing languages other than things used for making websites. How can you use c++ and python side-by-side? Like I said, one has to be compiled, and the other is an interpreted language that can't be compiled. Can you 'import' a module made in c++ into python? I've head that the math module is coded in c, though I would suspect it may need to be designed a certain way to work. I only know how to make modules in python itself. That said, I have been thinking that for my current project, I may be better off using python. Other than the switch command, my old textbook for c++ doesn't seem to mention anything the python one does not. At least in python I can use the tkinter module to make something with proper menus and buttons and whatnot. Also, its been so long since I've used c++ I've actually forgotten it. I still know how do it, but I've just forgotten how it 'spells' things, like for example an 'if' statement isnt 'if x=1 then func()', its instead 'if (x=1){func()}'. Trying to make a program in c++, it honestly feels like I'm having to re-learn the entire language. Maybe I should just stick with python, but honestly for such a large program I don't like the idea of having to re-do the whole thing in c++ if I start to have performance problems. I have noticed though that c++ doesn't seem to be able to 'print' screens much faster than python programs for some reason. So maybe it doesn't make much of a difference, but I'm worried that could change if there's a lot of math. With that ccg program I may have mentioned, I didn't really care about performance since in a real game you often have to wait for your opponent to make decisions anyway, possibly for literal minutes if you manage to get them into a really sticky situation. I even put a line in it saying 'your opponent is thinking...', which it displays before it starts doing its calculations, just in case they take a while. Either way, I still have no clue how to code an AI for a game like this. Also in recent news, the government is apparently cracking down on deep-learning, so maybe it isn't such a wise idea for me to learn how to do it. Right now they're only going after major corporations, but many people are complaining that what's been passed isn't doing nearly enough, so who knows if deep learning will even be legal at all in the near future. Not that I would mind that, I was always opposed to it myself, I only started considering it recently out of desperation and it being added to w3schools. I literally can't think of anything else I would use it for. If it matters to you, I was trying to make a ccg based on magic the gathering. Problem is as the project developed, it ended up being more like hearthstone (mostly due to limitations in how much text could be displayed on the screen at one time, among other issues). How do you make an AI that can play a game as elaborate as MTG? Even WotC can't really do it. I've also heard its one of the biggest unsolved problems in coding; literally nobody knows how to do it. I was thinking of just playing my game and analyzing my own decision processes and seeing if I could translate those to code, but I need a working game before I can do that. So I literally can't make an AI for the game until I've already fully completed it. Fml.. Link to comment Share on other sites More sharing options...
RomanR Posted November 1, 2023 Share Posted November 1, 2023 I will be laughed out of forum, but I found that now Blitz Basic +/3D are now free to download at https://blitzresearch.itch.io/ (remade in MS Visual Studio 2017, so Win 7+ only). I tried it (3D) and it doesn't look so bad. Yes, by today standards it lacks on many fronts, but for making text games only it could be ideal for you - integrated IDE, manual, compiler. There are commands for loading fonts, graphics, sound (samples and MP3 files using Mod.dll library, which is already part of it). Also in comparison of today's IDEs they're really tiny - install file of Blitz Basic + is 8 MiB and 3D 23 MiB in length (70 MiB after install). Regarding "AI" in such games - they're mostly cheating by looking at premade book of moves, which can be hard to make too. Link to comment Share on other sites More sharing options...
InDarkestNight Posted November 1, 2023 Author Share Posted November 1, 2023 I don't own Visual Studio. I do have a certificate in it, but I never saw much use in it for me so I never felt inclined to buy the subscription for the program. I've heard there's basic interpreters you can find, but I know of none. I hear they run quite well on modern computers, since basic was originally made to run on computers in the 80s. Sadly, the only interpretter I know of is actually an emulator for a hobby computer, so it throttles the performance of the program to match that of the actual hardware, so that's not of much use. Link to comment Share on other sites More sharing options...
RomanR Posted November 2, 2023 Share Posted November 2, 2023 You don't need Visual Studio, I only mentioned these new versions are made using it. Link to comment Share on other sites More sharing options...
InDarkestNight Posted November 24, 2023 Author Share Posted November 24, 2023 Thinking about more lately, due to my main computer being broken, I've changed my mind about a few things. Thinking about it, maybe it would be better to develop my games using pygame. I was only going text-based, because I had no language other than pygame to draw graphics. However, with this strategy I'm having to have the freaking print function draw every screen. This obviously isn't very ideal, and can make drawing things rather complicated. Pygame lets you just place text where ever you need it, no need to do stupid things like re-draw the screen every single time the player enters a command. This also gives a lot more freedom in where everything is placed on the screen. Yeah, there's the input lag issue, but honestly none of that would probably mean anything in a turn-based game. Then why not just make the thing in pygame? If I did so, I could even add in features like letting the player select things with the cursor (though I probably won't implement that since I hate using the touchpad on my laptop), or having actual graphics. Before, I was having to try and make the strings of text associated with every card as visually distinct as possible. Simply having actual art would make more sense honestly. I was also having a problem in that the command prompt doesn't allow too many lines to be displayed, but with pygame I could essentially set the number of rows and columns to whatever I need. Basically, it would have a lot of pratical effects, and I wouldn't have to worry about all the garbage stuff about pygame that lead me to abandoning it. Besides, I always preferred strategy games anyway, so its not like I was going to be making too many action games anyway. Of course, there's the issue about the longevity of python programs, but honestly does any language last forever? Looking for a forever language would be futile. Maybe in the distant future I could find third-party retro interpreters for my programs, or maybe even make my own someday. So pygame is it I guess, now to figure out how to design my games knowing I can use more than the print function to draw things. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now