Can I Create Video Games Using SQL? (No Game Engine)
Вставка
- Опубліковано 26 вер 2024
- Leaving all the other contenders - Unreal, Unity, Godot, GameMaker and many more - in the dust, I bring forth the strongest game development toolkit known to man - SQL.
Taking advantage of all the features this tool offers, I developed a fully functional Snake Game implementation, which runs on a remote database, to which anyone can connect, play (or watch), and marvel at the future of video games and their development.
Making use of PostgreSQL and a couple of really interesting options it has to offer, along with some of my beloved Python, I managed to create a fully interchangeble/interoperational architecture, to make this as customizable and modular as possible.
Link to the Github repo: github.com/ici...
Finally, server side rendered games
A new era of gaming indeed
@@icitryNew Google Stadia
What TRUE server side looks like
i remember playing Garry's mod sandbox where people could build anything, there is Expression 2 interpreted language that is based on lua ingame functions. it was always serverside and it was fun making something usable with screens and stuff even though it works with obvious delay
Thank god out games now have SEO.
rule 91 of programming: if it's turing complete it's a game engine
what a coincidence, I was exactly on that chapter when I got the idea
Who's going to take up the Brainfuck game engine challenge?
@@michawhite7613 someone wrote tic tac toe for it with a computer opponent
Sql is not even turing complete dude
@@pacote_se postgres is (which is what he uses in the video)
love the (No Game Engine) in the title, as if there was a whole universe of SQL game engines out there and you specifically chose not to use any of them
Well of course, I am a man of integrity and commitment to the bit. Plus, better play it safe, who knows what lurks out there
Prolog’s graphics libraries is likely the closest you get to a sql-like language for game development
Well, there is. It's called ECS. Unity Dots or Bevy for example.
Lmao
I thought it was a typo and ment SDL, but no, you ACTUALLY made a game using SQL...... WTF? Good job man
I try to make everything I do seem like a typo, so thank you doubly 😄
structured directmedia language
@@icitryThat is REALLY smart, it really made the video stand out on my home screen! Awesome!
@@mki443 😄I actually was just talking about the project ideas, but now I'm definitely stea- integrating that into the original idea (also I'm really happy nontheless, thank you!!)
@@icitryahahahaha, what do you meannn that just programming
Looks great! I've started migrating my Godot project to this wonderful new engine, because as we all know, newer = better.
Why yes what a delightful decision, I see you're also well versed in the righteous ways of programming
I want to do similar for a custom engine or two one point.
People really out here doing anything to avoid using unity /s
mad respect.
Do not tell them about godot
Well, you could say it’s a data driven approach
You can have partial redraws by creating a table that simply contains the changed pixels' with their position on the framebuffer, and color they are (now) set to, as well as the ID of the change being auto incremented, clients could then query "Get me all pixel changes since pixel change ID XYZ" where XYZ is the last pixel that they fetched on their last query. You can truncate the table by automatically deleting pixels that you are re-writing to. Initial client would simply pull all pixels on the screen in a single query then continue fetching from the last ID they had fetched.
You can also improve FPS by using the concept of a tile system, like how older consoles work, where you would instead store tile IDs for groups of 8x8 pixels, have the client request the tile sheet once and then fetch screen using tiles, that would technically mean you are rending client side however.
Also consider batching your queries into groups, you can probably achieve higher FPS by having a single query that both fetches the current screen, as well as submitting all events that were recorded, then waiting the 16.6ms necessary and re-executing the query. One query less delay.
one other small thing I though of, you are running a game loop server side, but there's probably an argument to be made that you have a client query allow the game to perform a tick manually, moving away from frame based updates to time delta based updates based on how long since the last tick was run, e.g. (velocity += some fixed speed) vs (velocity += speed * delta).
Ok, first off - wow thank you a lot for taking the time to write this out 😄
For the 1st thing, I totally agree, great improvement, exactly the fix I was looking for when thinking about this shortcoming.
But for the 2nd thing, exactly as you said, it would start to lean on the client too much, which I wanted to avoid.
On the 3rd point - there's definitely a point to be made for reducing the number of queries as much as possible, but wouldn't that cause potential delay to feedback on user actions?
For the last idea, yea I could see that work actually, could probably end up a bit smoother visually and maybe lighter on the whole processing.
Really great points, all of them (even on the small disagreements it pretty much boils down to personal preferences), so big props to you!
@@icitryYeah for the third point it would introduce a single frame of input lag, I think some games do this method but can't remember why they do.
Thanks for listening to my ideas lol, just had them while eating lunch watching your vid.
Hmm, I'll have to check that out then, you actually made me curious. And of course - brainstorming ideas is what makes this whole thing fun, I always enjoy seeing what others can come up with 😄
@@icitry lots of netcode uses a rollback feature, where they post process events after they happened.
So like
Deliver Tick 1
Deliver Tick 2
Deliver Tick 3
Deliver Tick 4
Event keypress tick 2
Rollback 4
Rollback 3
Rollback 2
Event Tick 2
Execute 2
Execute 3
Execute 4
Deliver Tick 5
Ah yes SQL the perfect game engine
Glad to know there are people with the same stance on this
It's all fun and game until the madlad from your neighbor's basement turn them into Bobby tables. 💀
You know you could've simply not manifested the thought or put it into words, but now look at what you've potentially unleashed
Mah man really woke up and said
Commit;
To optimize the frame rate as you said at the end of the video, you could maintain a table of frame updates where you always keep the last, say, ten changes. That way, clients that are perfectly synchronized can always fetch the next frame, but if a client falls behind by a few frames, it can just catch up by querying multiple lines at once from the changelog...
Ohh yep, really great solution, virtually no drawbacks and simple to implement. Someone else suggested something similar, and gotta say - you both came up with it so fast it's amazing. Big props, and thanks for taking the time to write it out 😄
@@icitryNo problem, glad I could help! I'm always happy to participate in these sorts of gloriously ridiculous projects
@@icitryBTW, another thing that comes to mind: Instead of sending a grid of pixels, you can probably make much more complex games much more easily if you send simple vector draw instructions instead (e.g., "draw a 5x5 square at 0, 10", etc.).
@@jakesarjeant8326 Oh definitely, that would be a great optimization - just that it would shift a lot more responsibilities onto the client, which is something I wanted to avoid for my approach (but if I wanted to make an actually viable solution, I'd probably go for something like you said)
@@icitry The engine is still the engine though and the client can be an SVG display or Tektronix 4010 (say)
I thought I was going to see a version of an ECS (like Bevy game engine is basically SQL) where you implement the logic functionally as views or something, not this plsql madness 😂. Great video ❤.
Oh but who would I be if not for the madness 😤 Thank you, love to hear you enjoyed it!
Similarly yeah. Thanks for the heads-up on Bevy, it’s a cool system
I remember when I made Tetris as a Stored Procedure on SQL Server 2000 because I was too bored from just making queries for reports in stored procedures.
Finally - a fellow supporter of the SQL game dev movement
The implication that there's a game engine that uses SQL as a scripting base is hilarious to me.
No. No I can't. Don't make me do this.
Oh yes, yes you can. And I will
Very interesting, I've used SQL at work , I used it to create a save text area within the cmpanies log in for inventory managment users to save their work throughout the day instead of writing everything on paper. I also found a backdoor which allowed me to see everyones log in and because of how the company was set up I suspect it was very easy to hack anyone in the company, I let the company know and they told me ~ to go f myself. I also wound up saving them 2.2 mil/yr on shipping and then they illegally fired me , so I guess don't work at home depot.
ohh well that's shitty... sorry you had to go through that - goes to prove how for most (if not all) of these companies employees are just replaceable commodities
@@icitry Thanks, you get get it :D. I look forward to seeing your next videos.
Thank you as well! :D
i was completely gone braindead thinking about other stuff while watching this video until 18:48, great refresher
Well there's a reason they call me waterboy (they don't) - always ready with a refreshment
@@icitry i cant wrap my head around how u got this much play when ur an SQL developer lmao
@@ohimdabiggestbird Woah woah this a wholesome-only zone, let's not throw around words like that (for the 2 sql devs in this world I'm sorry)
10 seconds into the video and there is already the door stuck meme of cs. Beautiful.
Good job man! I would have never though that one could use SQL for operations like these. I've always seen databases as just external structured file storage. But the complexity is really nice.
I have 2 more things to add though.
1. The "2" fps looked more like 20 fps in my opinion. Did you speed up the footage so it is no that much of a pain to watch?
2. You can compile C/C++ on windows. It is a bit of a pain to do it in VSC but Visual Studio supports C/C++ compiling and debugging.
Great content though! Your channel is definetely underrated
Thank you so much! 😊
As for the 2 points you raised:
1. Yep, that is sped up (although surprisingly enough the original still looks good, and handles better than it would at higher framerates - due to how Snake is designed probably - just that it takes longer to get a good grasp on the gameplay).
2. Also yep, you can, but it's not something in-built with a well designed repository system and CLI tools something like Linux comes with by default, for example. You can get by with doing simple stuff, but once you break away from that... (also you don't have a universal solution, so each compiler, be it the MSVC one, mingw, or cygwin will have its own quirks which often don't translate between them)
This is amazing, I love it
Thank you, glad you do!
I knew this would be insane from the title, but somehow the actual implementation bullshit you had to pull to make this work still took me out at the knees. Good job, I guess?
Well thank you very much, glad to hear I managed to deliver on your expectations 😅
Both cursed and beautiful at the same time.
honestly, imagine buying a game and you get the ip and a password to stream code over lol
This kind of thing is what awaits you if you start coding. Intrusive thoughts that end up being a bag of hours you're never getting back, but you learned like, one useful thing in the process xD
Now make a video called "Should I create video games using sql? (no game engine)"
In all seriousness though, great video, enjoyed it alot!
9/10 very insane, do NOT see me after class or ever again
but.. I still have so many other unhin- revolutionary ideas
"dig your own path"
digs a grave
Respect man holy shit wow using actually sql wtf??? U are a genius man
I was thinking more of "masochist", but I'm flattered nonetheless 😅 Thank you!
11:35 MSVC is the native c/c++ compiler for windows
Also you need to add some sort of client prediction, otherwise if you host your server in another network (not LAN) you wouldn't able to do literally anything (network latency and packet loss will be a problem)
edit: also Clang run on both windows and linux natively, so I don't really understand your point here
Well unless something major happened in the meanwhile, MSVC is proprietary software to the Visual Studio toolkit, which isn't shipped bundled with Windows, so it's as much a native compile as any other you can install on your machine.
For the second thing - yeah let's just say sustainability wasn't a core concern when developing this 😅
I clicked on this video reading the title as "SDL" instead of "SQL" and wasn't at all prepared for what this video would actually be about lol.
SQL lends itself naturally to multiplayer games and shared experiences in general by virtue of being relational.
what the database teacher does on his free time when no one is watching:
ushering the game dev world into a new era? hell yeah he is
Get this man a Linux virtual machine. Great video!!
I hope it's one built with SQL though...
Thank you!! 😁
@@icitry hahaha
Another question. I know this would go against the spirit of the project, but let say for a second that rendering would be purly client side. Could the SLQ Engine approch legit work?
Great question actually! And I would argue that yes, it would, but in very specific scenarios. I'm thinking generally games where the player has a predefined set of actions allowed and in which users don't interact with each other (not necessarily only singleplayer, could also work for "multiplayer" games where players work toward common goals for example - mainly in the style of those gimmicky mobile games). That way the database can simply manage the state of each player, along with the actions and responses it should provide, whereas the client needs to only display the visuals for what is returned by the database - like: hit enemy -> update enemy hp data -> signal play enemy hit for enemy with a certain id -> client plays hit animation for said enemy. So really simple stuff, but there are definitely games made in that style that could (and I'm pretty sure do) benefit from such an approach. Another thing is that you'd probably use something like Redis for direct communication with the client, as it would be exponentially faster for these kinds of operations, and have Redis instances for multiple regions, all of which then flush the data at given intervals to a relational database.
This is the mark of utter genius
Well.. genius isn't quite the word I'd use, but I do appreciate the compliment 😄
Im watching someone rise above human reasoning and compression!
I'm simply beginning to believe
I know y'all were laser focused on that guy munching straight sand like it was God's providence
yessir XD
New video idea "I added multiplayer to my sql game engine"! I think it will be super easy to implement multiplayer if multiple clients use the same db!
This is so incredibly cursed. Always online games taken to new extremes
you are him you are that guy
hell yeah acknowledgement! you too, making me blush like that
Pretty cool idea.
11:38 What do you mean by there being no native support for compiling c & c++? They have MSVC.
Thanks! Well yes, they have MSVC, but it doesn't come prepackaged with the OS, instead it's part of Visual Studio, meaning you don't get access to the compiler the OS was actually compiled with, so obviously there'd be differences across implementations - reason why we have like 3 different solutions.
@@icitry Understood
Still better than writing a game in javascript
Now why would you go and say that, you've hurt potentially all ten js game devs in this world (I agree)
Awesome video, though I wonder if it would be doable to make the server more abstract, and letting the client dealing with drawing the frame. Then for example, the server would say "draw a line here and a triangle there, and fetch this asset from the db and rotate it and draw it there". This way you could even leverage something like OpenGL on the client side. Come to think of it, using the DB to queue up openGL calls would probably also work, and make the client very simple. Though then you'd have a massive restriction of only being able to use opengl on the client.
Thank you! Yeah, exactly, well pointed. It's all a balancing act - you can move more of the logic to the client, but then you'd be losing portability, and wouldn't be leveraging the full potential of SQL 😔 But it's a really nice alternative approach to the problem. Also I'm sure it can ultimately be made more portable - you can abstract away the primitives used on the client and just call what is available once the server makes a request. But I guess it boils down to personal preference, or rather restrictions you want to impose on the architecture.
Well.. you can of course do that, but going in that direction is just going to go further and further towards "just do everything without using SQL" (which is of course the correct answer if you were trying to make a game as efficiently as possible) - after all, there's really no need for the server to exist at all and everything could be done way more easily by just.. not using such a convoluted setup, but then you just aren't making a game with SQL at all anymore.
Haha yes, when refining the SQL method more and more I'm sure you'll end up not using SQL at all, or at least very little of it (possibly only storing temporary game state - or even better only long term game state). Though as @icitry pointed out at the end, encoding the video feed would make this setup a lot more efficient, and I guess even sending the stuff I mentioned above would be a way of "encoding" a very strict video feed.
Finally something I needed to see
i knew it was possible. I always wonderd about it. Now i need no wondering no more :D ty for the Vid and Work!
Glad to hear you enjoyed it! 😄
The fact that does not run at 0.5 fps is insane as an web developer.
Honestly I was really surprised as well, initially I was going to try incrementing the size from 50x50 pixels till it crashed - now imagine my surprise when I went with 400x400 for the lols and it worked decently
sql injection gonna go crazy lmao
Is it possible to make a system call with only SQL?
Depends on what you think when you say "just SQL". Cuz you could write a DLL to define new procedures that SQL can use, and inside those you can technically do whatever you want. But with just the stuff you'd get when installing it and not modifying anything - I'm pretty sure you can't (although depending on the flavor there could be some extra functionalities that may allow some more freedom).
You absolute menace.
What can I say, I always try to bring out my A-game
nah now we need a non-relational mongodb game engine
I think I'll let someone else have the honor of doing that
what an absolute madlad
We can play "how do you rename a table?"
It's pretty hardcore
Neato.
Thanks! 😊
make a game with mongoDB next lol. more server side games
Going through the whole databases gauntlet hmm.. But I think there needs to be as many people as possible making the server-side gaming gospel known - I'm just happy being one of the founding fathers (I'm not)
From the same creators of Cascading Server Sheets:
Now, don't lump me in with those lunatics, it's obvious my creation is an actually viable product with real value
this video is bonkers!
just the aftermath of me being in a silly goofy mood
1. Wouldn't using docker/wsl make either the windows pains null, or in the other approach, make setting up an env easier?
2. Have you heard about our lord and saviour LISTEN/NOTIFY? :D I had some fun recently with PG, using it for relational storage, MQ, distributed locks and some other stuff xD
wow
I just love this.
😁 Thank you!
But can it run doom?
Oh it's not a matter of can, just of when
Is this that "cloud gaming" thing that those city slickers keep talking about?
You can create a game solely using SQL without having to utilize another language like Python etc. You just have to figure out how. Nevertheless, thank you for sharing and the effort. It's still a challenge to accomplish such tasks.
Well unless we'd run the game in the db console, calls to os primitives are still needed, so I don't think a pure SQL solution is actually possible (at the very least I see it as needing to modify the internal libs) - I could be wrong though, but I genuinely don't see how - would be curious to see some ideas, if anyone more well-versed happens to chime in.
Also thank you for the kind words!
Haha I don't think you not using an existing game engine is the interesting part here ...
Good job though this is amazing
😅 Thank you, happy to hear you liked it!
This is kind of what space time db does.
Very impressive. Now try again using sqlite 💀.
I.. think I'll let others do the honors for that 🤕
C++ is no contender to how hard this is.
C++? Oh yea that's definitely a small fry, especially compared to this absolute work of art
what's the game at the start that shows all the bones breaking when they get shot
Oh that's from Sniper Elite 3
Great video. Now i could actually play a server side game. Some of your code that i see could be shortened via the use of dataclasses but hey it is still equivalent. Also what code theme do you use?
Oh the code could always be improved. About the theme - if you're asking about the code samples, it's actually Carbon, they're not taken directly from my IDEs. Otherwise I'm running the default dark theme and config on all of them. Also glad to hear you liked it!!
Alot of Civ atleast V and VI and I belive IV aswell is coded in SQLite
Hmm I wouldn't say a lot (at least not from a pure programming perspective, as data-wise it might be), as from what I know they basically use SQLite to store config, initialization files and the like, as well as localization stuff, so they don't walk around parsing XML and ini files and instead rely on db optimizations. Ofc I could be wrong, but I find it highly unlikely it's used for more than that, given the nature of the games
19:45 wait until some 10 year old kid hacks you with sql inj
The fact that you used the GameMaker 1.4 Logo hurts my soul
Let's call it a nostalgia trip
@@icitrylol
would you rather have infinite bacon but no game engines, or game engines, infinite game engines but no game engines
well that's a tough one, but I think I'll go with the infinite game engines... I mean there's grease involved in both cases, but infinite game engines is obviously better
bro invented ECS
Now he gotta do prolog for making games
What a sick and twisted individual you are - why must you take joy in others (me) suffering?
what happens if you view a .wav file in binary waterfall
yo, how did u manage to merge the = and > sign like that? 7:03
That's actually because of Carbon, as that's what I use when creating the code snippet demos. But I'm fairly sure there are plugins/add-ons for most IDEs that can do just that
Tortual a drive with a Willy Wonka way
Welcome💙 🧡🙏🏼
im sure Primeagen will make reaction video😅
oh that's a terrifying prospect, and I don't know for whom more
now we are looking for game engine on brainfuck
I wonder who's the unlucky (pronounced insane) bastard that's gonna try that
now create a chip 8 emulator in sql. another thing, have you tried other sql db's? perhaps sqlite or mariadb?
not really tbh, I went with postgres from the start, knowing it's a really mature and comprehensive solution, so that if I wanted to touch on some edge cases, there's at least a chance a mechanism already exists - others would probably work as well (maybe even better), it's just that I went with the safest pick
Next project, creating a game without using objected oreinted programming.
its said a game like lord mobile is basically a redis server instance, thats why it can handle 10000ccu
Oh wait that's smart actually, given the type of game that seems to be (haven't actually tried it, but I think I get the gist of it). Ty for telling me about it, now I have something else to look into 😅
@@icitry well if you find out how the backend architecture work you should make the video abbout it , waiting for it 😀
Insane
Thanks, always happy to provide 😤
Rule 34 of programing: if a programing language exits its a game engine
Oh yea very true, and don't forget about the section 2b addition: some languages (sql) are better suited than others for the task. For more information look up rule 34 2b
yes only if the creators of the souls game made the games via sql maybe then they'll understand the pain of their creation
Even that wouldn't be enough, gotta add some poison swamps throughout the codebase
isnt there a doom plugin for psql?
Is there? I mean I shouldn't even be surprised at this point, there's probably a way to run it directly on my retinas
Ohh gotcha. Well it's a pretty clever hack though so you gotta give it to the creator
is this fullstack game development
hmm I like the sound of it, sounds like it's fancy and pays well - let's go with that
Madman
I'm 100% taking that as a compliment
14:45 cygwin ? what sort of HELL are you doing to that poor windows computer ?
hey, if I'm putting myself through hell, my computer has to experience it as well - solidarity you know
You're sick. But I love it
And I love being like this :)) Thanks!
My god, this man doesn't use the python black formatter D:
The what now? I always used the default one, but now ofc I gotta check that out
@CHBG ты ли это?
"Just use an ORM bro"
"yea dude just use an ORM (Osql Rgame Mengine)"
but why
"but why hasn't anyone thought of this before?" ikik that was my first reaction as well
Oh I read SDL, not SQL lol
That seems to be the trend... guess I should be proud 😤
im more of a plv8 kinda gal, amazing video tho
oh but what an extremely exquisite alternative (and also thank you!!)
Great great great job 😂
Thank you!
Uhh SQL is either pronounced sequel or squeal
Errm ackchyually the correct pronunciation is "ess-cue-ell" 🤓 (also my native language made it more logical for me to spell it out). Also I'll commit seppuku before calling it squeal
Tell that to the Primeagen haha @@icitry
@@omega_no_commentary Welll, let's not meddle with the elder gods now shall we
It’s weird, cool but weird. And a way to kill ur SSD.
Ehhh, I'm sure it'll be fine (brb gotta go do some backups)
@@icitry lol
This is an example of game development using illegal methods and forbidden magical arts 😂😂😂
Everyone knows game dev needs a bit of deep dark magic and eldritch forces to come to fruition