r/Python • u/noodlesteak • Oct 19 '19
Here is my progress so far on my python game engine for the terminal, after almost a month of work. It can convert pictures and make animations, move sprites, move and animate ascii art, display sprites with layer effect, transparency and so on... I plan on releasing it's source code in a month.
61
13
10
u/Zeftax Oct 19 '19
That looks Awesome!
4
4
u/Zeftax Oct 19 '19
!RemindMe 2 months
0
u/RemindMeBot Oct 19 '19 edited Oct 20 '19
I will be messaging you on 2019-12-19 18:58:47 UTC to remind you of this link
4 OTHERS CLICKED THIS LINK to send a PM to also be reminded and to reduce spam.
Parent commenter can delete this message to hide from others.
There is currently another bot called u/kzreminderbot that is duplicating the functionality of this bot. Since it replies to the same RemindMe! trigger phrase, you may receive a second message from it with the same reminder. If this is annoying to you, please click this link to send feedback to that bot author and ask him to use a different trigger.
Info Custom Your Reminders Feedback 2
6
u/davincible Oct 19 '19
Simple question; is the printing literally just moving the cursor up and overwriting the previous text?
I modded some command line python script recently to add some stuff by sending a 'cursor up' signal and overwriting the text but it looks kinda whack, so was wondering how these things are done
6
u/noodlesteak Oct 20 '19
Exactly... as for my old renderer which was doing 1fps at this and was flickering even though I printed everything as fast as I could. Now I use python sets, intersections and stuff in order to print everything in order (therefore avoiding long cursor escape codes) and never two time at the same place in one frame, nor two time the same element at the same coordinates. And allowing more latency computation side seems to be worth it if you can reduce ever so slightly the number of chars printed on screen
0
Oct 20 '19
[deleted]
1
u/noodlesteak Oct 20 '19
I don't really get what you are suggesting me to do... what is a terminal backbuffer ?
0
Oct 20 '19
[deleted]
2
u/noodlesteak Oct 21 '19
Now that you tell me about it I remember that my old renderer was almost like that. But for erasing pixels it was so slow because my engine kinda works like a oled screen in order to make transparency work. Idk I'll need to consider this now that I know more about it
1
u/noodlesteak Oct 21 '19
Oh ok, I didn't know it worked like that but I totally thought of something similar, still I didn't manage to figure it out due to the way I managed color back then. I may try to give it a shot ! For now I do the exact same thing of never reprinting but I compute what I should reprint with sets comparison. Maybe trying with buffer will be faster
4
4
u/IOnlyLikeSpaghetti Oct 19 '19
I feel like I’ve seen that art before... I feel like it was from this game I played on my phone.
4
u/noodlesteak Oct 19 '19
It is very possible. It is only a placeholder gif for the technical demo, I took it on pixeljoint.com from this user http://pixeljoint.com/p/34703.htm whom I credited in the gif. What is the name of the game ? I really like this artist
5
u/IOnlyLikeSpaghetti Oct 19 '19
Idle Apocolaypse
5
u/noodlesteak Oct 19 '19
I'll check it out thanks
edit: wow that's a quite popular game indeed, I almost feel unsecure for having innocently chosen this gif x)
1
2
6
u/GodIsClose Oct 19 '19
Looks promising .. keep up the good work .. will check back after two months 😉😉
3
4
u/BFG9THOUSAND Oct 19 '19
Smithing game? Had no idea this level of game stuff was producible in the terminal. I know 0 about it. Are all games generally displayed in the terminal?
11
u/noodlesteak Oct 19 '19
Glad you asked, games are never displayed on the terminal. Most of the time they run thanks to a graphical library that works on its own. But here I decided to put it on the terminal, well... for the sake of it. And it was quite tough to make it run smoothly.... As for the demo here, the pictures you see are just placeholders. Even though my engine is quite fast for a terminal program, it is not very convenient for full graphics games, so I doubt we see standard 2d games made with it x)
2
2
u/PRIV00 Oct 19 '19
That's really neat! Would love to read the source code
2
u/noodlesteak Oct 19 '19
Thansk ! I'll make sure to remind you when it will be on github and decently documented/commented
2
Oct 19 '19
Sorry, can you elaborate on what exactly this game engine is / what terminal you mean?
The animation looks nice though.
3
u/noodlesteak Oct 19 '19
No problem, this runs on any terminal that supports ansi escapes codes and 255 colors, such as the windows 10 python terminal, or most linux terminals. This aims to simulate a 2d game engine with it's graphic part (what you see here), it's input part (not done yet) and it's state/game logic management part (not done neither)
1
Oct 21 '19
wait what, you built a game engine for terminal?
so with text input or with a graphical, clickable ui?1
u/noodlesteak Oct 22 '19
For now I have done nothing on the input side. I'll surely try both but clickable UI may be a challenge without using curses and not very portable in a result...
2
u/tamasiaina Oct 19 '19
Would this work for a MUD?
1
u/noodlesteak Oct 19 '19
this may help you with the making of a MUD if you plan on adding colored text, replicable pieces of colored ascii art, and even sprites
2
u/tamasiaina Oct 20 '19
Yeah, I'm thinking about it. I'm working on converting a really old school MUD to something else.
2
Oct 19 '19
I love that those look close to pixel adeptus mechanicus acolytes. They would be happy to exist in the machine in further service to the Omnissiah
1
2
u/0x0012013 Oct 19 '19
This is awesome- I admire your persistence so much. Trying to get started on my own projects, but always have trouble staying focused. How did you manage to follow through for the whole month? Anything you do to keep yourself focused?
2
u/noodlesteak Oct 20 '19
I mean, I assume that the support I got from reddit really motivates me even though I'm not doing this full time (I study IT at university). I may be mad or obsessed about my project because I think about it alot and I always try to find a free hour at my university in order to work on it. The big thing I guess is that I always sleep 8hrs a night and I always wake up at the same time regardless of my planning, so I feel fresh even though I'm working on it ~15hrs a week + university and life
2
u/PistolRcks Oct 19 '19
At first, when I looked at this, I thought to myself: "Wow! This is unnecessarily convoluted!" Then I remembered that I do and love the exact same kind of things.
Good luck!
2
u/noodlesteak Oct 20 '19
thanks, that is so true, so much work put into it to archieve 15fps at this res on a TERMINAL hahaha
2
u/__xor__ (self, other): Oct 19 '19
This is pretty bad ass!
I hope people use this and make games we can pip install and run in the terminal :D
1
2
2
2
Oct 20 '19
Looks great! Definetly would pay full price for this
1
u/noodlesteak Oct 20 '19
Thanks ! Well, it will be open source , but I may ask for optional donation later if I release it and I feel it is worth people's donations.
2
Oct 20 '19
If u need any beta testers I would love to help!
1
u/noodlesteak Oct 20 '19
Thanks, I'll recontact you when my renderer will be fully done so I'll see how it performs elsewhere.
2
u/Muhznit Oct 20 '19
Here I was thinking that the little wannabe rogue-like I was making with curses was hot shit, but then you come in with this massive flex. Well-done.
1
u/noodlesteak Oct 20 '19
Thanks, but don't worry, every project starts mediocre, but as long as ou learn and as long as you keep experimenting with python you will get something flex-able soon enough ;D
2
u/Muhznit Oct 20 '19
Oh, I have no issues reaching flex-able tier. But this is like... a giga-flex. It's the kind of thing that makes you question your career choice and level of competence.
2
2
2
u/tankbacca Oct 20 '19
This looks so cool! Are you "animating" it by constantly printing a new image, or is there some python library you can use?
4
u/noodlesteak Oct 20 '19
I had two different methods for this, the second one is the fastest one. At the start I was constantly reprinting everything in layer order (so the top get on the top). But printing times on the terminal are crazy long. So I use python sets objects and mathematical sets intersections between layers and between frames so I never print again a pixel that didn't change. This only uses pillow library for picture reading. Otherwise it is all homemade
2
2
u/psota Oct 20 '19
Can I interview you for my: 7,000 Twitter followers 6,900 Instagram followers 2,500 FB page fans 40,000 member Slack group ? Let's talk about your project and get people excited about your work.
1
2
2
2
u/theng Oct 20 '19
I plan on releasing it's source code in a month
wow a month is real short where you live haha
2
u/noodlesteak Oct 20 '19
yeah I felt I had nothing more to wait with so much support haha
but it is very badly documented for now
2
1
u/ExPikabushnik Oct 19 '19
Это круто. Всё сделано стильно и качественно. Завидую твоим достижениям. Тоже мечтаю изучить Python хотя бы до такого уровня.
2
u/noodlesteak Oct 19 '19
(using google translate)
Большое спасибо за ваши добрые слова. Работайте усердно, но учитесь шаг за шагом. Тогда я уверен, что вы осуществите свою мечту!
1
u/Super-Speed- Oct 19 '19
!RemindMe 1 month
1
u/noodlesteak Oct 19 '19
;-)
2
u/Super-Speed- Oct 19 '19
Yeah! I’m super excited!
Edit: I don’t know how to work the reminder
1
u/noodlesteak Oct 19 '19
Thanks. Don't worry I'll look back at all my posts when it will be ready in order to contact whoever was interested in getting a link.
2
1
u/Thecrawsome Oct 20 '19
does it work cross-platform?
1
u/noodlesteak Oct 20 '19
It works on windows cmd, windows powershell, windows python shell, repl.it which is linux. I assume it works as long as your terminal supports modern escapes codes for color and cursor displacement.
1
u/Exodus111 Oct 20 '19
Could this be played over SSH?
Without the client having to install it?
1
u/noodlesteak Oct 20 '19
The engine generates a string to print all in one at each frame so you definitely could !
2
u/Exodus111 Oct 20 '19
Nice.
2
u/noodlesteak Oct 20 '19
damn thanks for the insight I haven't thought about it at all but this could be very useful the first terminal game engine in the world, but also the first remote one haha
2
u/Exodus111 Oct 20 '19
Well, nethack is typically played this way, you ssh into a server, and then the game begins, no need to install anything. Unless you want a graphical wrapper to make the game look better. Without it that game looks like ASCII symbols on a screen.
With your system you could play a more graphical game in the same way.
1
u/noodlesteak Oct 20 '19
I see, if I do a ssh version of my engine it would not need a wrapper unless the client side terminal does not support the escapes codes I use
2
u/Exodus111 Oct 20 '19
Exactly. Is there a terminal limitation for those? Gnome-terminal and windows command line are the two
suckiestmost used terminal apps out there.1
u/noodlesteak Oct 20 '19
on windows 10 everything works just fine and fast. But I remember I had to perform a little code side tweak with kernel and stuff. I let it in my code in case someone needs it
2
2
2
2
u/jonrhythmic Oct 19 '19
!RemindMe 1 months
2
u/kzreminderbot Oct 19 '19 edited Oct 20 '19
Sure thing, jonrhythmic 🧐! Your reminder is in 31 days on 2019-11-19 23:55:05Z :
3 OTHERS CLICKED THIS LINK to also be reminded and to reduce spam. Thread has 20 total reminders and reached max of 4 confirmation comments. Additional confirmations are sent by PM.
jonrhythmic can Delete Comment | Delete Reminder | Get Details | Update Time | Update Message
Bot Information | Create Reminder | Your Reminders | Feedback
2
Oct 20 '19
!RemindMe 1 months
1
u/kzreminderbot Oct 20 '19
Sure thing, assesandfaces 🤗! Your reminder is in 31 days on 2019-11-20 00:01:06Z :
CLICK THIS LINK to also be reminded and to reduce spam. Thread has 14 total reminders and reached max of 4 confirmation comments. Additional confirmations are sent by PM.
assesandfaces can Delete Comment | Delete Reminder | Get Details | Update Time | Update Message
Bot Information | Create Reminder | Your Reminders | Feedback
2
2
2
1
u/meshikhah Oct 19 '19
!RemindMe 2 months
0
u/kzreminderbot Oct 19 '19
All set, meshikhah 🤗! Your reminder is in 2 months on 2019-12-19 20:11:52Z :
CLICK THIS LINK to also be reminded and to reduce spam. Thread has 4 total reminders and 2 out of 4 maximum confirmation comments. Additional confirmations are sent by PM.
meshikhah can Delete Comment | Delete Reminder | Get Details | Update Time | Update Message
Bot Information | Create Reminder | Your Reminders | Feedback
0
Oct 19 '19
[deleted]
1
u/noodlesteak Oct 20 '19 edited Oct 20 '19
I tried more complex rendering many times, I had to rethink entirely my renderer in order to make it run smoothly with this demo (two ~100x100 animated sprites at 16fps overlapping with a 32x120 static sprite moving and overlapping) For everything around 64x64 I assume you can archieve 60 fps on a modern cpu terminal. I also tried with the new win10 gpu terminal but on my gtx 1660 it performs worse. With sprites bigger than 200x200 it starts going bellow 10 fps, even thought my renderer never prints useless chars on the terminal, printing being the biggest issue.
0
Nov 19 '19
[deleted]
1
u/noodlesteak Nov 20 '19
Hey, here it is https://github.com/AnicetNgrt/flore1 There have been big changes since this post so I have to redo all my doc, if you have any issue don't hesitate to mp :) !
1
Oct 19 '19
[removed] — view removed comment
2
u/kzreminderbot Oct 19 '19 edited Oct 19 '19
Hi, tntpower10 🧐! Your reminder is in 2 months on 2019-12-19 20:50:51Z :
3 OTHERS CLICKED THIS LINK to also be reminded and to reduce spam. Thread has 11 total reminders and reached max of 4 confirmation comments. Additional confirmations are sent by PM.
tntpower10 can Delete Comment | Delete Reminder | Get Details | Update Time | Update Message
Bot Information | Create Reminder | Your Reminders | Feedback
54
u/noodlesteak Oct 19 '19 edited Oct 20 '19
I just wanted to show you the code in my main.py file for this demo: here it is
I try to keep a good ease of use/fonctionnalities balance. Tell me if you have any concerns :D
Edit: Wow thanks for the silver dear stranger
Edit2: Platinium, yo really ? Thanks !
Edit3: Ok support is just massive, so I released the current build on pypI for you guys. But for now it is very badly documented...
python3 -m pip install flore1
Edit4: Support was so crazy that I released it on github with 2 beginners tutorials. Docs soon ! https://github.com/AnicetNgrt/flore1