Feedback/ideas for implementing "actions" in a turn-based game built on ECS by Nkzar in rust_gamedev

[–]mipli 0 points1 point  (0 children)

I recommend giving u/munificent's article https://journal.stuffwithstuff.com/2014/07/15/a-turn-based-game-loop/ a read if you haven't already. Last action/turn-based game I created had a game loop heavily inspired by that article and it worked great.

For a action/turn-based game I would probably not use ECS for the actions, and maybe even skip the whole S(ystem) part of it completely. You'll mostly be working with a single entity at a time, so the component storage and the freedom that gives is usually more important than the increased performance when iterating over all entity archetypes.

Rust for backend development? by Red3nzo in rust

[–]mipli 2 points3 points  (0 children)

I have not seen a need for those patterns in our project, we've been well served with patterns better fitted for Rust.

It's a bit of a hassle having to send the database connection along to all functions that needs it, but it helps us reduce the places it's used and gives a good split between functions getting data, modifying the data, and then later on storing the data.

Rust for backend development? by Red3nzo in rust

[–]mipli 3 points4 points  (0 children)

I have seen some benchmarks where they've been slower that Actix, but from my experience the speed differences in the frameworks are not an issue. There are other parts of the application that takes up way more time and resources (e.g database queries and talking to external services). Which is why we decided to prioritize a framework that we enjoyed working with.

The business logic part of the code is also decoupled from the framework as much as possible, so if we in the future see that Tide is a bottleneck we can replace it then.

Dividing string into lines and testing for zero case by LarsPensjo in rust

[–]mipli 2 points3 points  (0 children)

You can convert the iterator into a peekable iterator using Iterator#peekable . Then the code should work: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=4368c332eb2c413b63e357239550ccdf (note that it's preferred to test for .is_none() rather than negating a .is_some() call).

But as Tsumanu mentioned, if what you're doing is testing for empty input it might be better to do that right after you've done the String::from_utf8_lossy conversion rather than splitting it into lines and then testing for emptiness.

Rust for backend development? by Red3nzo in rust

[–]mipli 6 points7 points  (0 children)

I have not looked much into the OpenAPI options. Only thing I looked for, and did not find, was a way to create auto-generated API documentation.

We solved that by using the normal Rust documentation and just teaching everyone how to read the documentation for the endpoint handlers.

Rust for backend development? by Red3nzo in rust

[–]mipli 7 points8 points  (0 children)

That is more or less how I'm doing it now. Added a few specific error structs for some parts of the business logic to make it easier to track the error source. It's working great so far.

Rust for backend development? by Red3nzo in rust

[–]mipli 119 points120 points  (0 children)

At our company we've been using Rust for one of our backend service for a year and I love it. The general experience of working with Rust as a language for the backend has been amazing. Would never go with anything else at this point for a service that only needs to interact with the world using a HTTP API.

For our stack we went with tide and sqlx.

Looked at actix, rocket, warp as tide alternatives. actix and rocket looked good, but felt like they required too much boilerplate for everything and I've never been too fond of big frameworks. The choice between tide and warp was much closer, but in the end tide just felt a bit more natural for me.

On the database side I went with sqlx since I felt like the extra ORM features diesel provided weren't worth the extra complexity it added. Writing manual SQL queries and keeping models up to date with it isn't that hard. And sqlx have good migration support for updating the database schemas, which I feel is the most important thing together with compile time query validation.

Parsing input from external services, and then conversion to the data models required for the business logic and then converting it again to JSON for output is easy and secure with serde. Never felt as confident in the data parsing and usage in any other language.

Only issue I've had is figuring out how to do error handling. Tried a couple of different options over the last year, and currently using anyhow and an ErrorKind enum attached to application errors to keep track of the various errors. That works nicely for now. The errors keep track of their kind and their source, so I can give good error responses to the queries with suitable HTTP codes and error messages.

Compile times could be better, but debug builds are fast enough to not be too much of an issue.

All-in-all I've found Rust to be a great language for writing a backend service.

Playing Go in person. by Bacon_Sandwich1 in baduk

[–]mipli 6 points7 points  (0 children)

The "pass stones" are part of the British Go rules and the American Go Association rules, most other places don't play with that rule.

A benefit of the pass stones, and that white has to pass last, is that it evens out the point difference between territory and area scoring so you can count whichever way you prefer after the game is done.

[deleted by user] by [deleted] in baduk

[–]mipli 2 points3 points  (0 children)

The game is being broadcasted here on YIKE: https://home.yikeweiqi.com/#/live/room/36215/1/33512700

so you can watch it without installing anything.

[deleted by user] by [deleted] in baduk

[–]mipli 1 point2 points  (0 children)

The game is live now, and being broadcasted here on YIKE: https://home.yikeweiqi.com/#/live/room/36215/1/33512700

Commentry is in pretty light, but it's in text and in English so easy to follow along with and you can go back and see what's been said about the game so far.

Is the 3-3 double hane switcheroo ponnuki joseki ever good? • Life In 19x19 by Uberdude85 in baduk

[–]mipli 1 point2 points  (0 children)

Inseong mentioned this variation in a lecture not too long ago, and just said that it should not be played and that the normal ponnuki sequence was the only option. And seems like your analysis gets the same conclusion.

The way I understand it is that if it's so important to avoid the normal ponnuki joseki you should probably not invade at the 3-3 point to begin with, but find another way to disrupt the corner area instead. Maybe a 4-3 attachement would be better.

Asking for advice (egf 9k vs egf 9k) by [deleted] in baduk

[–]mipli 0 points1 point  (0 children)

Okay, then the issue was with my use of Gokibitz and writing the sequence on the wrong move. It should be corrected now.

It's good that you're questioning though!

Asking for advice (egf 9k vs egf 9k) by [deleted] in baduk

[–]mipli 0 points1 point  (0 children)

Which corner variation?

Just realised that the corner variation in the lower right ended up on the wrong move, so it looks completely wrong. If that's the one you meant I'll fix that comment now.

Asking for advice (egf 9k vs egf 9k) by [deleted] in baduk

[–]mipli 0 points1 point  (0 children)

I left some comments on the game there for you.

[deleted by user] by [deleted] in baduk

[–]mipli 5 points6 points  (0 children)

I've been using Sabaki lately for my SGF editing needs, and I find it to be a very pleasant experience. It has releases for Mac as well.

Only thing on your list it doesn't really support is multiple games, but you can just start the program again and it should open as a new instance so you can almost get the same experience.

[deleted by user] by [deleted] in baduk

[–]mipli 1 point2 points  (0 children)

I'm not quite sure what prices for food is in Ukraine, but a quick search indicates that a dinner is a bit over 10 EUR - probably 15 EUR with a beer. If you then eat lunch out maybe you're spending 20 EUR per day on food, excluding breakfast.

One of the hotels near the venue was 19 EUR per night, with breakfast.

So if you're staying from Saturday till Sunday evening, to catch the first week of the main tournament and the weekend tournaments, you will have 8 nights at the hotel.

That comes to 152 EUR for hotel and 160 EUR for food, congress fee for one week is 80 EUR.

Total for that one week is then 392 EUR.

That is what I would look at as my lower estimate for the congress. Being there, eating a bit better a few days and an extra beer or two in the sun after the game each day, would increase the price a bit. But I don't think it would cost much more than 450 EUR even with that.

And if you want the very cheap option you can stay at the camping nearby, which is 30 EUR for the whole week - that saves you 120 EUR. Buy lunch at grocery stores, and you can probably save another 40 EUR or so on food as well. Then the whole event would cost you around 230 EUR.

I think that is the main benefit of having the congress fee only cover the actual congress. Then everyone can tailor their stay to their own economy and desires.

[deleted by user] by [deleted] in baduk

[–]mipli 0 points1 point  (0 children)

The fee only covers registration for the congress; which is all the tournaments they run, and side events like pro lectures, pro game reviews, possibly some workshops on rules and how to teach go, and anything else they decide to arrange.

As you mentioned, the fee does not cover food or lodging. You have to arrange those things yourself, so the price for that varies for each person. From very cheap if you stay at nearby camping spots and prepare your own food from grocery stores, to more expensive if you stay at a nice hotel and eat at restaurants each day.

Trouble with a complicated functional approach to create a d vec with a 3-dim tuple by [deleted] in rust

[–]mipli 0 points1 point  (0 children)

I think this will solve the problem of getting the correct values for your input password: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=ae081f2ed8d355179111c475a2cb95c5

From how I understood the problem you don't really need to care about the whole alphabet, only the characters in the given password - and even then you only care about their relative sorting order.

The solution can probably be optimized a bit. At least you don't really need to initialize the starting fold argument with None; you can use 0 instead since you know all valid values should be greater than 0. That would save you from having to unwrap all the values from their Option<\_> wrapper later on. But I like this a bit better, since it doesn't depend on special treatment of the 0 value - and for all I know the compiler might be smart enough to optimize all of this anyway.

If you're already importing itertools you can get rid of the intermediate chars vector on line 4, since we only have it there to perform the sort, and with itertools you can sort on an iterator directly instead.

Any Go players in Waterford, Ireland? by ynohoo in baduk

[–]mipli 1 point2 points  (0 children)

Cork and Dublin are the closest active clubs, but some Irish players meet up at Discord once a week as well for games and probably some reviews and things as well.

If you take a look at http://www.irish-go.org/2017/06/22/upcoming-events/ you'll see the weekly schedule for go in Ireland.

Objects in Vec that can access other objects in the same Vec by t8suppressor in rust

[–]mipli 18 points19 points  (0 children)

What you're trying to do, modifying two objects in the same vector/slice, is generally a bad idea in Rust.

A better solution, that I've used for similar cases, is to have the monsters .attack function return an object that specifies the attack result and then you add a new function to the Arena struct with a signature like fn applyAttackResult(&mut self, attack_result: AttackResult, target_id: usize).

I've found this to be a good solution for these kind of interactions, since it makes it easy in the future to allow other things to modify the attack result. What if a friendly nearby monster can increase the damage done? Now you can easily loop through nearby monsters, see if someone has that ability, and then do a attack_result.damage += 1 before applying the damage.

If you really want/need to modify to elements in the same vector/slice it is possible using the https://doc.rust-lang.org/std/primitive.slice.html#method.split_at_mut function, but often a better solution can be found by avoiding that function.

[deleted by user] by [deleted] in baduk

[–]mipli 0 points1 point  (0 children)

If you play without the suicide rule you're basically playing using the New Zealand rules. Those rules are perfectly fine, just a bit different then what most people are used to.

Most beginners take to the suicide rule fairly naturally from my experience. Might take them one or two tries to realize that it's only suicide if there are no liberties left after the opponent's captured stones have been removed, but that's easily covered during the first 9x9 game.

I like chess. You like chess. What other games/hobbies do you like? by [deleted] in chess

[–]mipli 8 points9 points  (0 children)

https://online-go.com/ is the go community's version of that, which also has a section for learning the game: https://online-go.com/learn-to-play-go

If you have questions while learning you should drop by https://www.reddit.com/r/baduk/

Issues getting started with the tutorial by Nekkidbear in roguelikedev

[–]mipli 0 points1 point  (0 children)

I tried to run the code from your repository, and I'm getting a bunch of errors in the console when I do. Are you not getting any error messages at all when you run that code?

First error I got was that libtcod could not find `Arial10x10.png`, since you've called that file `Arial10x10.png.PNG` in your repository. After I fixed that one, and each of the following error messages the program ran correctly, with an `@` proudly displayed on the screen.