4 ms·
I am growing into the idea that everyone should try and build some games. Just a "simple" card game like solitaire would suffice for a lot of the lessons. Big
by taeric 3y ago
I am growing into the idea that everyone should try and build some games. Just a "simple" card game like solitaire would suffice for a lot of the lessons.
Biggest one being that anything you want to be able to do visually has to be represented somewhere as state. Pretty much period. And this state will be far more complicated than the simplified state diagram that you will come up with if you are only modeling the intended actions of a game.
If you are lucky with extra computing power, you can layer your code so that the core rules of the game are able to be written independently of how you represent the cards in play. But I assert that you will often be surprised that accomplishing this separation is more code than the alternatives.
- cushpush 3y agoPeople who say the universe is a simulation never consider the graphical overhead required. It'd be so annoying to make, I don't believe even an alien species would have the patience for it.
- ikari_pl 3y agoAI had the patience, Mr Anderson
- serial_dev 3y agoThey (we?) could use AI for that, why would you write it by hand?
- p0w3n3d 3y agoIt's simple. You just create set of rules that will eventually end up in earth being created. Just requires you to be God
- 01HNNWZ0MV43FF 3y ago"Red shift is a feature, not a bug!"
- naasking 3y agoThis is a common misunderstanding. You don't have to simulate the universe, you only have to simulate the minds that believe they are observing the universe. You are then by necessity merely simulating their perceptual facts rather than all of the physical states that eventually produce a perceptual fact. This is considerably simpler.
- solardev 3y agoI would love to try something like that, but I have no idea how to model complex game logic like that in data, especially if it's decoupled from the UI state =/ For example, to make even a "simple" game on something like Boardgamearena, you're supposed to create a state machine: https://www.slideshare.net/boardgamearena/bga-studio-focus-on-bga-game-state-machine https://www.slideshare.net/boardgamearena/bga-studio-focus-o... I don't even know what that is, and it's a lot more complicated than anything I'd ever seen on the frontend in the HTML/JS world. (To be fair, that's probably because I never had proper CS training. I'm just a self-taught web dev.) But it seems to me that even simple games require creating really complex engines that aren't really similar to the businesses needs I've coded for in the past... Not disagreeing with you at all, it all just seems so overwhelming compared to simple stuff like HTML/CSS/JS.
- matthewfcarlson 3y agoEven better, make a simple networked game. Socket.io makes it quite trivial to send messages. What I found works really well is keeping state as a series of mutations. Then a client emits a mutation and its broadcast out, if the mutation can’t apply, then it gets discarded and the server sends its copy of the state to the client that emitted the bad mutation. Makes it really hard to cheat but only requires sending mutations to the clients. https://matthewc.dev/projects/vuex-sync-p1/ https://matthewc.dev/projects/vuex-sync-p1/
- swatcoder 3y agoThat's sort of the point. A lot of people got drawn into the industry in its latest boom and found themselves glueing together remote services using an ever-changing collection of heavy frontend frameworks and never experienced actually modeling an application from top to bottom. It doesn't need to be a game, but doing more of the dirty work that "[you] have no idea how to model" andis "more complicated than anything [you]'ve ever seen" can help induct you into a much richer and more cognizant craft practice.
- solardev 3y agoThis isn't so much the old argument of (say) Next.js v HTML(x), but of the different degrees of state complexity required in a typical business app vs an actual game (at least to my mind). To me, it's a lot clearer how to deal with a traditional ecommerce database setup like Northwind Traders (https://en.wikiversity.org/wiki/Database_Examples/Northwind https://en.wikiversity.org/wiki/Database_Examples/Northwind). I've had to do that many times and know how to model such a thing. I have no idea how to start modeling the state for a game like Wingspan (https://boardgamearena.com/gamepanel?game=wingspan https://boardgamearena.com/gamepanel?game=wingspan), much less something more complicated, like Magic: The Gathering, where any of several tens of thousands of cards can interact with each other in novel ways, maybe even leading to infinite loops and such. In my mind it's like a giant if-then flowchart with a billion flows. I wish I could see the source code for the rules engine of such a thing, but with a step-by-step tutorial...
- TacticalCoder 3y ago> Just a "simple" card game like solitaire would suffice for a lot of the lessons. I've written an actual game, a 2D platformer. If there's a domain where it's easy to demonstrate that the view is purely a function of the state it's precisely in gaming. In many games you can toggle (in dev or even for some during gameplay) between "the real view" and, say, wireframe view of the game (with lots of debug infos added too for example). Or you can toggle between a 3D view of your game or a top-down 2D one. Or you can toggle between different types of rendering (as in Diablo 2 where both a 2D and fake 3D view where available and the modern Diablo 2 ressurected, where you can you can show... The 25 year old view if you want to, at any time). Many games are 100% deterministic and the entire game user(s) played can be recreated from only a record of the user(s) inputs (which is why some save files for long games can be tinier than tiny). And it'll replay the same on different screen configurations / different platforms. The view in a game at time n is literally f(state n).
- taeric 3y agoCertainly! That was indeed my intention here. The big learning I'm intending is just how much state that people take for granted is necessary to track.
- ape_key 3y agorespectfully you haven’t written enough games > real game turn-based and real-time games have different kinds of complexity, so a platformer won’t expose you to all of it. turn-based games are roughly going to give you an easier time separating the game code, but the UI code is going to feel like a debilitating slog. > Many games are 100% deterministic Until you use floating points, networking, or different platforms. This is more likely to be true in turn-based games, and super unlikely in anything real-time and multiplayer. Most games like that periodically sync state instead of relying on applying actions on each client
- amelius 3y agoAre you saying that IEEE 754 floating point (which everybody is using) is not deterministic?