This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-15
Channels
- # admin-announcements (3)
- # architecture (2)
- # beginners (54)
- # boot (85)
- # braveandtrue (8)
- # cider (21)
- # cljs-dev (56)
- # cljs-site (5)
- # cljsjs (15)
- # cljsrn (9)
- # clojars (4)
- # clojure (99)
- # clojure-austin (1)
- # clojure-russia (36)
- # clojure-spec (53)
- # clojure-uk (29)
- # clojurescript (161)
- # datomic (8)
- # hoplon (3)
- # immutant (48)
- # jobs (1)
- # jobs-rus (1)
- # leiningen (10)
- # om (23)
- # om-next (1)
- # onyx (22)
- # parinfer (3)
- # planck (13)
- # protorepl (8)
- # re-frame (46)
- # reagent (2)
- # remote-jobs (1)
- # respo (1)
- # specter (5)
- # testing (12)
- # untangled (50)
- # yada (13)
This is reasonable. Room contents, or even the state of devices such as switches and doors, could be associated with the static room somehow, rather than being nested within it.
That would lead to a more decoupled design. And most of these things can be one-way lookups, room-id -> object
. Only room-to-inhabitants and character-to-location are going to be two-way.
Yeah, that's how I would probably do it, knowing what you wrote here, and being opinionated the way I am. I could, of course, be totally wrong about it.
So while I'm fiddling around with nitty-gritty implementation details of map layout and traversal... any ideas about generating plausible maps from scratch given some requirements? This is a much more complex issue, but it's also very computer-sciency, so I bet there are papers I could read. For instance! Say I have a general idea for the zone: "city outskirts; to the east, a path through a jungle; somewhere in the jungle, a river path branches south to a village; meanwhile, the main path leads east to plains. At the heart of the plains, a temple." I'm envisioning a generator which can turn these vague instructions into a sequence of rooms, and even branch and backtrack after creating the river path and the village. Like, "we're in the jungle; we have generated four rooms already; the last room had a southeastern exit; we're -2 squares south, so we should err on the side of going northeast... oh wait, I passed the cumulative percent chance of generating the river path, so let's bookmark this point in the generation and start generating that branch."
Also, if actions that happen within a room (characters updating health/stamina etc.) are more common than actions happening between rooms (characters transitioning) you may be better off using refs and having character state independent from their location.
A fun thing to do if you're interested, is to use Clara to write rules for a room/object/etc.
This is relatively easy (ha), but when it comes to interconnected rooms, I'm stumped. For instance, a jungle path can be linear, but the plains should be a grid of interconnected rooms, to reflect the wide-open nature of it.
But a sequential room generator doesn't allow for interconnections.
I'll take a look at https://github.com/rbrush/clara-rules — it could have some good ideas.
In the RPG combat system I'm envisioning, room movement is part of the tactical landscape: archers want to move one room away and start firing while the warrior blocks the exit to prevent enemies from chasing the archer, and so on. So the layout of the rooms will make different areas play very differently.
Could be multiple, if you want to have a limited number of characters that fit in a given room.
Loosely based on Avalon and the Iron Realms family of MUDs—showing my nerd credentials very clearly here. 😁
Would abstracting the world as essentially a maze help? There are maze-generating algorithms that you could then use.
@devn: That's a good idea, actually. The sequential generator can say "oh, this next part should have this shape," and it generates a set of rooms with a random but constrained shape.
@amacdougall: yeah that's kinda what I was thinking
@sgerguri: Yeah, the world is maze-like in the data-modelling sense. But by no means intended to befuddle...
Yeah, sequential generator which can run subroutines. Makes sense to me.
And I was thinking about limiting the number of characters per room, but then I'd have to think about the literal physical size of the room, which is probably out of scope for this toy project. Not hard to add later. A "room" in a sweeping plains could hold thousands of characters, but a closet in a castle could hold maybe four if they were good friends.
There's a neat book from PragProg that could help with that - https://pragprog.com/book/jbmaze/mazes-for-programmers. The implementation language is Ruby but it makes for a fun project to transform the implementation from a mutable, object-based model into something purely FP. I started playing with that a while ago, reminds me I should get back to it when I next have a spare moment.
Oh interesting! The title even suggests that it applies directly to my problem domain.
...yes, I think this will be a great read. Thanks for the suggestion!
Not directly relevant to question amacdoughall you might be interested in play-clj (there's a Clojure conj video on youtube)
Different subject: This looks very interesting (and don't see it recommended many places): http://www.clojureatlas.com/
trying to make sense of an api that returns xml (no docs about the structure of the document)
and I’m also confused about clojure.xml
and clojure.data.xml
& clojure.zip
& clojure.data.zip.xml
so I can read an xml string with (parse (java.ioByteArrayInputStream. (.getBytes xml-text))
also, you might simplify it, if xml-text is a string, (parse-str xmltext)
, this also takes an encoding, which i think defaults to utf-8
@jiyinyiyong: Nice work! What I would really like would be (a short) blog post that introduces the motivation for this kind of the editor and highlights the main features. I am not really a video person 🙂
Is it recommended to learn to use nosql, mongodb or even basic SQL & etc before you try to approach Datomics as a beginner?
Does anyone know how to set up the database connection in this library: https://github.com/clojure/java.jdbc
(def mysql-db {:subprotocol "mysql"
:subname "//127.0.0.1:3306/clojure_test"
:user "clojure_test"
:password "clojure_test”})
This is what I have, but I have a URL. That I have set to subname
Is there already such a thing as map-invert-with which will map values to keys but will combine duplicate values with a function?
(defn map-invert-with [m f]
(reduce (fn [m [k v]] (if (contains? m v)
(assoc m v (f (get m v) k))
(assoc m v k))) {} m))
http://blog.cognitect.com/blog/2016/8/15/welcome-clojurescript-org
That looks awesome, I look forward to seeing how it’ll help me sell cljs in different portions of my company (we use it so far, but we get a lot of developer leeway)
@danielcompton: Thanks for the advice earlier. Also, thanks for making https://therepl.net/ !
@holyjak: here's the post. but I'm not into the details of the features actually, or it would be a lor longer(already mid-night in my timezone) https://medium.com/cirru-project/stack-editor-programming-by-functions-a961f1d9555c#.n76np9i1x
nor do i really understand what it means to not look at text but AST, since I kinda consider s-exp as AST's, but convenient and clearly delimited
I see that as different tastes. I've been writing with this style for months and already into it.
i don't understand the difference, as the screenshot looks like text but with the delimters blanked out
my editor is implemented with DOM, even it looks like text, it's still a tree. I just styled it to be less messy. It could be really messy with a lot of borders.
I'm also wondering what (* (+ 1 2 3) 5)
would look like in your editor. Without parens, variadic function calls would be ambiguous?
you could write * + 1 2 3 4 5
which could obviously be parsed as many expressions, * (+ 1 2 3 4 5) => 15
, all the way down (* (+) 1 2 3 4 5) => 0
algorithm... https://github.com/Cirru/respo-cirru-editor/blob/master/compiled/src/cirru_editor/comp/expression.cljs#L140 well, compiled code looks bad
the parens in this example show that 3 is the last argument to + and 4 is the last argument to *, but if you required underlining to see this, I'm just wondering what that looks like when it spans multiple lines
also i like the idea of showing you what's relevant rather than what's adjacent, re your organizing according to call stack
I should make GIF.... it would would much better to see it in action, as the algorithm auto layout my code
it's actually "(* (+ 1 2 3)" at that moment, I was moving to the ")", which is invisible, so the corresponding "(" is highlighted
last demo on the layout algorithm, going to bed... https://youtu.be/g0tAVjwuc1U
How does one make a qualified keyword using the current namespace, without double colon?
*ns*
is exposed compiler state. in the repl is sort of a mish mash of compilation and runtime, but if you are just running code without a repl, the value of *ns*
is likely to be something different from what you got in the repl
figured that would kick back a keyword from a different namespace, and therefore be fully qualified
the only luck i'm getting is putting a function in the namespace you want qualified and returning a qualified keyword.
ha i don't know why i didn't think of that. i just saw borkdude mention he was trying to get qualified keywords without using a double colon so i was trying to see what i could come up with
@steveb8n: Is your talk at cljsyn referenced in https://github.com/Day8/re-frame/blame/develop/CHANGES.md#L87 recorded and available online? Or slides?