pengu1nxHello, can someone recommend me a library to use for a game?
dreamrealwhat kind of game, what kind of library are you needing
dreamrealI guess the actual answer to your question is "maybe"
pengu1nxOpen to the kind of game, it should have a simple API and be cross platform (Linux/Mac/Windows) though
dreamrealWhat kind of API
pengu1nxTo use the library, no?
dreamrealI mean, you can write simple games with pure java, no library at all
dreamrealnevet has hangman, 21 matches, safecracker built in and they could be done with console
dreamrealno library at all
pengu1nxI meant with a UI though, not CLI
dreamrealso I don't know what you'd use the library FOR. Window control? (Why? JavaFX and Swing are built-in.) OpenGL? There are opengl libraries for java, designed for games, but you haven't said you needed one. Is multiplayer a concern?
dreamrealSee what I mean? You asked a VERY open-ended question :D Now at least we have a clue you mean something with a UI
pengu1nxMultiplayer isn't a concern, I suppose OpenGL would be ideal
dreamreal~lwjgl
javabotdreamreal, lwjgl is the Lightweight Java Game Library (lwjgl.org). [LWJGL] is a solution aimed directly at professional and amateur Java programmers alike to enable commercial quality games to be written in Java. It provides direct access to crossplatform libraries such as OpenGL and OpenAL, as well as controllers such as Gamepads,Steering wheel and Joysticks.
dreamreal~javafx
javabotJavaFX, or OpenJFX, is a set of APIs for writing rich client applications in Java. It's more fully-featured and capable than Swing. For more information see https://openjfx.io . To get started, simply add as a dependency in your build script: https://openjfx.io/openjfx-docs/#maven . Also see ~scenebuilder
pengu1nxlwjgl references libGDX, is that just a sorta extension?
dreamrealit's the underlying library that provides the opengl access
dreamrealit's cross-platform, if minecraft can run on your systems, you're good
dreamrealnote that javafx might be just as good
dreamrealI can't give you a whole lot of information beyond this, though: I don't do opengl stuff, so my experience is quite limited here
dreamrealothers may be able to fill in the gap
pengu1nxI see, regarding a build system, it seems Maven and Gradle are the two big ones. Which one would you say is easier to learn?
Paralwjgl is moving to vulkan, I think, so that's going to be an option possibly as well
ParaBest part is that you as developer probably don't have to care.
dreamrealI'd say maven between the two
dreamrealgradle's more expressive but harder to predict
dreamrealmaven's mostly copy-paste to get it to work: it's verbose but ^C/^V is SOOOOO hard
pengu1nxExpressive as in the configs contain less keywords?
pengu1nxLike strange keywords
* GreenResponse joined #java
BombeAlso, don’t “learn” build systems. Use them, pick up what you need, be done.
BombeThe optimal amount of time spent on a build system is 0.
* MonsterAbyss joined #java
pengu1nxTo pick up what you need one still has to learn about it
BombeYeah, in the same way that you have to “learn” a website in order to find the “download” button.
pengu1nxNot really, if something doesn't work or if you have to use it more often then you have to understand it better, you can't just keep resorting to copy pasting
* MonsterAbyss joined #java
BombeRight, but you don’t do that before you work on a project. Same way you don’t read about all the ways a website can offer a navigation menu before you want something from that site.
dreamrealpengu1nx: a gradle build is typically MUCH shorter than an equivalent maven build. But the FIRST thing you learn as a gradle user is "lock down the version did you lock down the version OH GOD LOCK DOWN THE VERSION KILL IT WITH FIRE" because gradle's publicly not committed to version stability
dreamrealif you USE the reasons you'd use gradle, you're engaging with specifics that are not guaranteed to be constant from version to version
pengu1nxThat is interesting, thanks.
dreamrealgradle is great as long as you work with it. It's got a good blend of convention vs configuration (you can configure it in ways that maven makes "interesting") and if you NEED to do that, well, there you are!
dreamrealBut MOST builds don't need it; developers choose gradle because they have a build file with 40 lines instead of 180 that they copy-pasted
dreamrealand maven developers get SURPRISED when a build fails due to maven changing; gradle developers don't get those surprises because they've got scars that remind them to LOCK DOWN GRADLE VERSIONS WITH THE WRAPPER
dreamrealand a lot of maven users don't even know it HAS a wrapper
Tenchi./mvnw wrapper:wrapper
Tenchifor a long time i thought the maven-wrapper-plugin was needed in order to use maven wrapper, and i avoided maven wrapper because i thought it was a stupid chicken egg thing
Tenchiafter a long time of avoiding it and looking at how it actually worked, i THEN discovered the plugin's only used to generate the wrapper script if you don't already have it
Tenchi🤷♂️
Tenchidreamreal: do you still make use of fabrikt ?
dreamrealnot if I can help it. (Actually, no: that was for $work and getting it to work was proprietary: they didn't let me contribute back to the project.)
dreamrealI think it's still usable if you constrain the inputs really tightly
dreamrealhow come?
Tenchii'm wondering if it's massively different than the last time i used it... like 2 years ago
dreamrealI'm going to bet that's a pretty strong "no."
dreamrealIt's better than openapi-generator but that's a pretty low bar to have to clear.
Tenchii'm actually putting together a demo comparing openai generators against LLM-based code assistants heh
dreamrealoh, my
dreamrealTenchi: would you, uh, do me a huge favor?
dreamrealPM?
Tenchimaybe haha
Tenchiyeah you can PM
* jamezp joined #java
* metalmaniac joined #java
* lockdown joined #java
* MonsterAbyss joined #java
Tenchithe frickin fabrikt docker image isn't even retrievable
* Tenchi rolls up his sleeves and prepares to lay hands on gradle 🙄
* kusanagi joined #java
* stfstfm joined #java
* stfstfm__1467 joined #java
dreamrealI had to run it locally
dreamrealand TBH I heavily modded it
* MonsterAbyss joined #java
* MonsterAbyss joined #java
* zChris joined #java
* B_fd joined #java
* MonsterAbyss joined #java
* troydm joined #java
* domicron joined #java
* stfstfm joined #java
* MonsterAbyss joined #java
* RussE joined #java
* magla joined #java
* jaskarth joined #java
* MonsterAbyss joined #java
* raj joined #java
* jaskarth_ joined #java
* jbosmans joined #java
* magla joined #java
* jetchisel joined #java
* jaskarth joined #java
* creechy joined #java
* stfstfm_ joined #java
* kcomhnall joined #java
* kathadris joined #java
* domicron joined #java
* B_fd joined #java
* B_fd joined #java
* sa02irc joined #java
* saml joined #java
samlhow can I interpolate JsonNode (jackson) to string template? interpolate("\{foo} \{bar}", jsonNode); jsonNode is supposed to be {"foo": "abc", "bar": 24, ...}
* Inline joined #java
ParaJava doesn't really have string templates. Various formatter methods and such, sure.
javabotTenchi's title: "The Apache Velocity Project"
Tenchi"Velocity separates Java code from the web pages, making the web site more maintainable over its lifespan and providing a viable alternative to Java Server Pages (JSPs) or PHP."
ParaJSON Schema for input variables? As in for the incoming request body?
samlyup
ParaWhy bother with YAML :P It's an ass format anyway.
ParaNow that that's been said, hm.
* mwnaylor joined #java
samlconfiguration can be in json.. or whatever format. just wanted to let users add simple llm features easily without coding in java and recompiling
jbosmanscode-wise it doesn't sound too crazy, however i'd make "something" do generic json parsing for you to some object, so you can skip the low level parsing
ParaJackson can do YAML as well, but as said, YAML is an ass format so it won't be convenient to use.
jbosmansi tend to agree
Para~yaml
javabotPara, yaml is short for YAML Ain't Markup Language and is a human friendly data serialization standard for all programming languages. See http://yaml.org for an explanation of the format, and http://bit.ly/1LZV5Zt for a library to marshall YAML into and out of POJOs. ~jackson also has a dataformat provider for yaml available.
nevet- YAML Ain't Markup Language
ParaHeh, the bot hasn't been injected with opinions for that one.
jbosmansimho yaml as primary input format sounds bad, it could be an input format "plugin"
samlPOST /llm/a.json {"user_id": 123} given this, and a.json has {"prompt": "find mcdonalds near user's house where user_id is \{user_id}", "tools": ...}
jbosmansi guess i'd want something predictable
ParaYeh
ParaClaude actually uses XML :D
ParaBecause obviously the more structure you can introduce, the less guesswork and misses and weird undefined behavior you have.
jbosmansnothing wrong with XML, a means to an end
jbosmansexactly
jbosmanssaml, sounds good !
jbosmanseven if burger king > mcdo
Para(other burger chain may be available)
jbosmans:-D
jbosmanssaml, it sounds pretty simple on the java side
jbosmansintegration-wise, i'd say use something like spring ai or ..
dreamrealWhat's the question?
dreamrealWhat's being asked? Don't listen to morons!
jbosmansi remember mashing up a stupid recipe app with structured data in like an hour iirc
ParaSome kind of superprompter 7000
dreamrealwait, are you trying to TALK TO an llm, saml ?
samli'll try to use spring-boot-starter-thymeleaf. I'm constructing llm prompt. I was gonna use java21 string template. But that doesn't seem to easy to work with jackson json
dreamrealsaml: oh god
dreamrealno
jbosmansthymeleaf isn't relevant for llm interaction
dreamrealsaml: do not do this
samli'm using spring ai for llm part
dreamrealokay, so... what does thymeleaf do here?
jbosmanssaml, thymeleaf is for generation html from whichever you'd want
samlI have a config: {"prompt": "... {{user_id}} ..."} and user input {"user_id": 123} I want to interpolate
jbosmansi guess you'd want a tool to tell you where the user is
saml"foo {{user_id}} bar {{user_id}} baz" + {"user_id": 123} => "foo 123 bar 123 baz"
samlI can change the variable syntax from {{user_id}} to whatever
dreamrealsaml: well, err... why not send the data to the tool per se
jbosmansokay, so now it's just a string templating thing
dreamrealthis sounds like an intermediate incorrect solution, where the way you're working your way TO a solution is breaking it
jbosmanswhich is pretty simple :-)
ParaAs I understood it, saml wants to create an API which takes a bit of data describing a prompt with some variables (why not preformatted prompts, who knows), runs that through spring ai, and returns whatever. And a bit of schema to make the input and output have a known structure.
samlyeah tool calling is done as well. but some variables are better be interpolated into the prompt instead of tool calling
ParaWhich is...a lot, why not just grab ?prompt=eat+my+shorts but what am I to judge :)
samlI'm building prompt template API (if it is a thing)
jbosmanssaml, it's just replacing things in a text, you could use a template engine or write it yourself
samlinstead of accepting any prompt, only taking parameters of existing prompt templates
ParaBut if the user provides the prompt template, that doesn't really add anything?
dreamreal~template
javabotPopular templating engines include ~thymeleaf, ~freemarker, ~qute, ~velocity, ~stringtemplate, ~pebble, ~rocker, and ~handlebars . ~jtwig exists but looks like it's unmaintained.
ParaOh no, I can't do "sing {songname}", I'll just prompt "sing happy birthday" ...?
dreamrealso you've got thymeleaf, why not populate the thymeleaf context with your JSON values, just iterate through as a map and interpolate
jbosmansString template = "my name is _THIS_IS_MY_NAME_"; String result = s.replaceAll("_THIS_IS_MY_NAME_", "myActualName");
jbosmansI'm thinking/hoping Pattern.quote() isn't needed here :')
samlthanks i'll try these
samlbecause copilot can't figure things out
samli wonder if claude code can fix my coading skillz
* dreamreal mourns
jbosmanswell, today i cancelled openai and switched to anthropic
jbosmansfor reasons i was unaware of before a few days ago :)
Parasaml: LLMs can't really make you smarter if you don't know what to ask. You can't run before learning how to walk and all that.
dreamrealsaml: you're saying ... copilot can't figure out template interpolation in thymeleaf?
ParaWhich of the 27 copilots even is this :P
dreamreal~gpt how do I populate a thymeleaf template from a map
javabotTo populate a Thymeleaf template from a Map in Java, you need to pass the Map object to the model of your Spring MVC controller. Then in your Thymeleaf template, you can access the values using Thymeleaf's ${...} expressions. Java: ```java @GetMapping("/template") public String getTemplate(Model model) { Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); map.put("key2", "value2"); model.addAttribute("map", map); return
javabot<p th:text="${map['key1']}"></p> <p th:text="${map['key2']}"></p> ``` In the above code, the values "value1" and "value2" will be inserted into the <p> elements respectively.
Chronoswait, people use copilot? non-ironically?
* dreamreal weeps
ParaOn tangent, Windows 12 will require an NPU and is AI first for everything, check your favorite tech news site for more.
ParaMy conservative hunch is that Apple's gonna sell about a billion Macbook Neos.
ChronosPara: Are those requirements real, or debunked like some of the other claims made recently about Windows 12?
dreamrealsaml: I think you just iterate through the JSON and populate the thymeleaf context directly without the ${map} crap but what would I know, I'm only human
ChronosPara: Sadly, the base MacBook Neo comes with woefully insufficient RAM, 8 GiB. Such a shame.
ParaChronos: Everything's a rumor until it isn't. But it's ridiculous that such even is a rumor.
dreamrealChronos: 8GB in apple silicon is not the same as 8GB in an intel processor
ParaChronos: It's a Chromebook, really. But iBook was already used years ago.
dreamrealdon't make that mistake, the 8GB in apple silicon is *much* more efficient than in intel
ChronosRemember, it's unified memory — take a chunk out for video.
dreamrealI'm not saying 8GB is the same as 16GB or anything like that, because usage patterns matter, but even so
dreamrealChronos: yes, BUT the apple silicon compresses *in the CPU* so it doesn't have the same pipeline limits
Chronosdreamreal: We have Windows and macOS in the house. This is one of those hills I'll die on: 8 GiB isn't enough for macOS (in my opinion). I know normals that blow past 8 GiB with just 3 or 4 web pages open.
dreamrealit's far more efficient
dreamrealChronos: Right, I'm not saying "8GB is enough for anyone!"
ParaAnd the use case is basically web browser based things and text messaging and other similar light tasks.
geenvoudcompresses what?
dreamrealI'm just saying it's not an apple-to-apples comparison
jbosmansdreamreal, not sure if thymeleaf is (by default) recommended for non-html string templating
dreamrealjbosmans: what does HTML have to do with this
dreamrealmoustache would be the same thing
jbosmansdreamreal, err thymeleaf ?
ChronosFor those people where 8 GiB is enough, I'd strongly suggest they use a Chromebook instead.
dreamrealjbosmans: what about it? It's a template engine
dreamrealthat's it
dreamrealpeople use it for HTML, woo
jbosmansyeah i know what it is
dreamrealI use a dry-erase marker for art
dreamrealI know you know what it is
GreenResponseI’m on 8GiB computer and found the ways to use it efficiently
Chronos(I've got a Chromebook in the house, too — they are, frankly, wonderful machines)
jbosmanswhy propose it for simple scenarios?
dreamrealjbosmans: because he's already using it, it sounds like, and it's right there
dreamrealhe has a nail, he's holding a hammer, do the math
Tenchii have an m1 mac mini w/ 16gb of ram running latest sequoia and apple intelligence enabled... and it uses 7GB when it's booted up and I haven't done anything yet
ChronosTenchi: ouch
jbosmansdreamreal, i see what you mean but they're not using it for simple string templating i'm guessing?
Tenchifire up idea and brave browser and it's using 13GB
dreamrealTenchi: I record my drums in a measly 8GB M1, running 16 audio tracks and recording multiple tracks on the fly, I should be PUNISHING that thing but it's FINE
ParaThe Macbook Neo doesn't simply have a lot of the "fancy" stuff like AI in it.
dreamrealjbosmans: right, but *why not* if it's right there
Tenchiload up a few web sites and a java or kotlin project and i'm at 16GB
jbosmansdreamreal, because it's html oriented?
dreamrealjbosmans: but... it's not
dreamrealpeople use it for html, but so what
ParaIt's what Apple considers barebones; it's not meant for developers running a copy of their company infra, it's for the kids and grannies.
TenchiPara: i have no idea what the neo's all about or how 8GB suffices
jbosmansdreamreal, th:text or whatever?
dreamrealthis is like complaining that a housewife shouldn't be using a craftsman hammer just to hang a painting
jbosmansit's really not :-)
dreamreal"that hammer's too good for a simple nail being driven into drywall, y'all!"
dreamrealit really is
dreamrealI understand what you're saying, but ...
ParaMy mom basically migrated to an iPad this winter for most the things she needs a computer for. It sucks at some tasks, but that really is the thing, if 90% of what average person needs to get done can be done with a lot less hardware, then don't overdo it.
jbosmansagreeing to disagree
* dreamreal shrugs. Okay.
ParaI kinda wanna try painting with a hammer.
jbosmansdreamreal, happy to continue btw :)
ParaLike...punch small balloons filled with paint on a canvas, or something.
Parapunch/hit/hammer/slam
jbosmansThymeleaf is a tool for creating natural and elegant HTML templates that can be used in web and standalone environments.
jbosmansit *could* be used for other things, i use it for html email templates as well
ChronosPara: iPads and Chromebooks are amazing for a lot (perhaps most) people
dreamrealjbosmans: why? I mean, you're saying that a tool whose design was template replacement shouldn't be used for template replacement because the tool's got specialization for html. It's got a text mode so it can be used for, uh, hold on, checking the references, carrying the 2, dividing by zero... OH TEXT
jbosmansbut for simple text templating?
dreamreal`The TEXT template mode will allow the use of a special syntax for templates of a non-markup nature. Examples of such templates might be text emails or templated documentation. Note that HTML or XML templates can be also processed as TEXT, in which case they will not be parsed as markup, and every tag, DOCTYPE, comment, etc, will be treated as mere text.`
dreamrealThat's from their docs
dreamrealcopied
dreamrealI mean, why argue at this point, if you think the text mode is insufficient for use with text, what can I say? I am not here to win an argument, you should feel what you feel regardless of what I think of it
jbosmansI know you're not here to win an argument, nor am i
jbosmansthymeleaf is the best template engine i know of, but it's html focused which makes sense, it's great at it
dreamrealsee? no problem. And while it has HTML specializations, the docs suggest "html focused" might be a bit much
jbosmansfor simple text templating it's an overkill
jbosmansworst case the String.replaceAll() needs a Pattern.quote()
dreamrealso: moustache. Unless he already has thymeleaf in his classpath already.
jbosmansactually, i always do that i guess
dreamrealbut at this point this is proceeding beyond not-my-problem.
ParaMoustache was good. Wish it was still common.
dreamrealit's still pretty popular because it's so freaking fast
jbosmansi think i used what came after in javascript world, like long ago
jbosmansmustache right?
dreamrealYou used what came after moustache? ... what was that? Because I've used moustache in JS (and java, and python) relatively recently
jbosmansah handlebars, that's the one i had to use quite a bit like 10 years ago
jbosmanslong story short, for simple scenarios i'd always prefer simple String.replaceAll() over pulling x dependencies. If it's about HTML tho, that would be dumb(ish)
* Ragnor joined #java
jbosmansthese replaceAll() call could be chained over a text block in recent java version
jbosmansdreamreal, am I making sense here or not at all? I'd love to hear it
dreamrealjbosmans: not enough scope to answer. If it works for you, that's what you should do.
dreamrealWorking code > everything else
jbosmansi do tend to agree :-)
jbosmansgiven i care/try to look at if my "actions"/responses are worthwhile, are they?
jbosmansforgot the highlight @ dreamreal
jbosmans&&
jbosmanssaml, how's it going?
dreamrealI mean... I dunno, I don't know of your code
dreamrealif you're satisfied with it, why wouldn't I be satisfied with it, too?
jbosmans~dreamreall++
nevet~dreamreall now has karma of 1.
javabotdreamreall has a karma level of 1, jbosmans
jbosmans;-)
jbosmansmm that's an 'l' too much
jbosmans*many
jbosmans~dreamreal++
nevet~dreamreal now has karma of 1.
javabotjbosmans, what does that even *mean*?
jbosmansall is good then :)
jbosmans<-
dreamreal?
jbosmanssomething about karma and for whom it does or does not work
jbosmans"<-" means "leaving" which i obviously messed up :)
jbosmansand/or "going out" i guess
dreamrealwell, I'm remarkably hard to assign karma to
jbosmansso it appears
dreamrealnot sure why but it might be my utter disdain for karma personally
jbosmansit might be hardcoded i guess
jbosmanson another note i switched from openai to anthropic today
* kmh_ joined #java
jbosmansand it still works pretty well for what i use it for \o/
jbosmans(or better)
dreamrealI find claude a lot better than chatgpt for code myself