[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: software-raster-edition.png (16 KB, 1252x815)
16 KB
16 KB PNG
Software rasterizer edition

gedg/ Wiki: wiki.installgentoo.com/wiki/Gedg
IRC: irc.rizon.net #/g/gedg
Progress Day: rentry.org/gedg-jams
/gedg/ Compendium: rentry.org/gedg
/agdg/: >>>/vg/agdg
Render bugs: renderdoc

Requesting Help
-Problem Description: Clearly explain the issue you're facing, providing context and relevant background information.
-Relevant Code or Content: If applicable, include relevant code, configuration, or content related to your question. Use code tags

Previous: >>101476047
>>
File: 1698425496826332.jpg (27 KB, 480x480)
27 KB
27 KB JPG
Just want to say, thanks guys you solved my project hopping problems.
I now instead keep hopping languages
>>
>>101507574
Is not actually a bad idea, spend two months learning as many programming languages as possible.
>>
>>101508191
thats a bad idea
>>
>>101508217
You are a bad idea.
>>
>>101507574
Your welcome. I hop projects every week and I hop languages every month. This keeps my brain sharp and healthy as I'm exposed to multiple paradigms rather than being stuck in a single thing.
>>
>>101508217
Not necessary, you should see which toys other languages have to offer and then recreate that in C++.
>>
>>101508835
Hopefully ditching c++ in the process.
>>
what is the good way to use ECS for rendering UI?
>>
>>101509093
Don't, the number of components that participate in the UI is not so high to require ECS.
>>
>>101509093
UI + ECS is a match made in hell. Don't.
>>
>>101509093
you spend a day or two creating a global messaging system for component interconnection, then you drop the project after realising ECS can't handle it in a sane way.
>>
File: 1721516547639585.png (566 KB, 1080x1080)
566 KB
566 KB PNG
>>101509093
>ECS
>>
File: bb40.png (94 KB, 1028x811)
94 KB
94 KB PNG
More or less have gotten the scene query system - now to get something to pick I added a PNG file reader to read some voxels layer by layer. Next week - voxel picking and manipulation.
>>
>>101509248
>>ECS
why does it make OOP retards seethe so much?
>>
>>101509093
Just do an imperative immediate mode UI.
It's the only sane method
>>
>>101509518
>ECS is diametrically opposed to OOP
save me
>>
>>101509518
The thread is thriving with C tards, OOP has nothing to do with it.
>>
File: saitama_thinking.png (366 KB, 930x450)
366 KB
366 KB PNG
>>101509113
Okay
>>101509189
got it

>>101509226
I'm writing a retained mode UI and was looking for a data oriented approached and stumbled upon ECS. I think I'll go with a modified, minimal version of ECS. I'll write a custom allocator that allocates the views followed by its properties and build the widget tree. Depending on the event(mouse or keyboard) generated by win32api, the library outputs a list of byte codes which are the operations that will be perform on the views to be redrawed. Gotta see.

>>101509537
already did that. Wasn't that fun and I already went insane. Need something to preoccupy myself.
>>
File: 1690733810045743.jpg (31 KB, 624x264)
31 KB
31 KB JPG
aaaaaaaaaaaaaaaaaaaaaaaaaaaa why is creating a physics engine so hard
>>
>>101509825
if it makes you feel better valve created a shit one and still made gajillions
>>
>>101509816
>ooking for a data oriented approach
why?
>>
>>101509849
to end up with good performance and less complicated mess, obviously.
>>
>>101509849
>ooking
>ook
>"Imitative of the cry of an ape or monkey. "
>>
>>101509871
>good performance
its a fucking gui
>>
>>101509919
yes. I'll be rendering text with it and make a text editor. Having to run multiple LSPs in the background should not slow down the text editing experience. For me to do that and anything big in the future, its better if the UI library is light and fast.
>>
>>101510007
you're clueless
>>
>>101510036
are you sure you aren't?
Seems like you are looking down on rendering GUI as if there is nothing much to do there. Welp, I can't bother to explain shit if that is what you think.
>>
>>101509518
Unsuspecting devs latch onto it for bizarre reasons (“omg my memory cache will love it!”, “omfg, it’s like data I can process everything with monads!”) when in reality you can achieve better results in less time using a completely dumb but hackable solution.
>>
>>101510078
yeah if you think the GUI for a text editor needs to put into an ECS for some reason you don't have a clue
>>
>>101510132
>you don't have a clue
that's why I asked. And I'm thankful to the anons that told me not to and that's it.
If you are a narcissist that is naturally trying to criticize me to make me look and feel inferior, it ain't working. I encourage you to try harder.
>>
>>101510132
also, it is a general purpose GUI, not dedicated towards creating a text editor application only. The text editor is just an example.
>>
>>101510181
It's cargo cult behaviour. Your text editor GUI is going to have a tiny performance footprint, and ECS won't make it faster
>>
>>101510200
>and ECS won't make it faster
okay
>>
>>101510221
GUIs are trees, use your brain
>>
Giving monogame another crack. Any recommendations for learning material?
>>
>>101510260
I already mentioned how I'm gonna deal with that shit here >>101509816. You use your brain to read.
>>
>>101510301
What is the point in storing something in an ECS then turning it into a tree?
>>
>>101510347
I don't know, you tell me because that wasn't what I intended to do at all.
Every entity has a tree node header component that could used to traverse the tree was what I was thinking.
>>
>>101510449
how is that ECS
>>
>>101510459
as mentioned in >>101509816
>I think I'll go with a modified, minimal version of ECS
>>
>>101509518
ECS sounds very much like the latest cargo cult that will allow quality code to be written by trained donkeys, which is what UML, OOP, WTF, and whatever else always promises. Agile Clean Code is the lastest thing, I think.

There is no magical way to write good software other than understanding what you are doing. Methods of achieving that goal are not that important.
>>
>>101510550
It won't allow you to write quality code though
>>
File: bestest game ever.jpg (73 KB, 802x627)
73 KB
73 KB JPG
Performance is overrated anyways, right?
>>
>>101510550
ecs is required to some degree for getting general purposed 3D game engines working, but it's not related to the game, people can make games in unity or unreal or godot and they don't need to write any ECS for the game logic, they just need to use the building blocks to get rendering and physics working, and then they can decide how "actors" or whatever you call them are programmed.
I completely agree with you, people here should be focusing on making games, clean code, not engines and complicated ECS shit and working on the same project for years accomplishing nothing, telling themselves this will save time surely on the next game, telling themselves other developers will use their engine surely, telling themselves that they are a elite programmer and will get a big money once they start working on a real project.
>>
How retarded would making a 3D FPS game in C99 as a free time project be?
>>
>>101511382
Not that much. It will be a lot of work.
>>
>>101511382
Very. You will never finish.
>>
So if I don't use ECS what's the alternatives?
>>
>>101511493
Just make up your own. Using premade design patterns is boring desu. Its like looking up how to solve a rubics cube instead of slowly figuring out how to solve it by yourself
>>
Why aren't computers magical so that they can scale textures perfectly at any scale?
My ideas to fix this would be to either:
Scale to powers of 2 only. So goodbye to smooth camera zooming.
SSAA, might not be perfect when two objects are next to each other like in pic related.
Blur the final image. If possible I would avoid this since It will reduce the image quality.

Any ideas I'm missing?
I'm currently trying SSAA.
>>
>>101510007
>what is threading
>>
>>101511560
implement an svg renderer
>>
jesus christ i'm glad filtering tripcodes and hiding replies exist
>>
>>101511560
you can draw into a texture and scale that up if you don't mind smooth filtering.
>>
>>101512609
>render in a resolution that everything will line up perfectly than scale up
that's not a stupid idea. That way I will preserve the smooth camera zoom. Thanks!
>>
>>101511560
cause most programs aren't fractal
>>
noob here, what engine would you recommend to make a rhythm game in c++?
>>
excuse my wall of text sirs
>>101506807
>I'd REALLY rather not.
which part is the problem?
1. if it's the Electron part, then that could be swapped with many alternatives like Ultralight or Tauri.
2. if it's the TS part (for the "engine"), then you can instead use anything that compiles to JS (or even just WASM like Blazor).
3. if it's the JS for game scripting part, then you can use whatever scripting language you want. I've opted for JS for the time being because: 1) I can just use node's built-in mechanism for loading and executing JS files;
2) I want the engine (and not the scripts) to hold the game data, and when they're both in JS targets, I can just pass objects around without having to convert them; and 3) JS is a pretty popular compilation target, so I could e.g. switch to writing the game code in https://civet.dev/ at any time if I wanted something more expressive than JS;
4) I improve on Era by having sane declarative components that you can output from the game, like a <Table> or maybe a <PieChart>, and JSX is a very neat way of declaring them in the game code compared to either nested function calls or manually printing spaghetti like in Era.
plus I'm actually keeping the possibility open for making a custom scripting language analogous to Era Basic, but in order to know if this is a good idea and how the language would have to look to be most suited for this, you kind of have to write a good chunk of the game first.
4. and finally if it's the HTML, then anything else is going to be even more of a cancer to deal with for this kind of game. I've seen your (I assume) mockup in agdg, and what you're aiming for is indistinguishable from a single-page web app or a desktop program. of course this is achievable in Unity, but things like QML or Avalonia UI or HTML are just better suited, with HTML being the easiest and the safest bet.
>>
>>101512890
GLFW+OpenGL
>>
>>101512939
I just don't want it to be more browserslop.
>>
>>101512890
c and vulkan
>>
>>101512987
that's a meme reason. all the UI frameworks that would be a good fit for this are slop in their own way. you can also do it yourself and possibly end up with uber slop like Emuera. or , if you're really desperate for something else, I guess you could try doing it (what is basically a webpage with basic interactive elements) with imgui. I don't know how that would work out but my intuition tells me not very well
>>
I feel like making a ui is harder than making raytraced graphics. there's no information on how you would go about rendering it.

do you give all the elements a depth and render them asynchronously so you can batch them or do you render everything back to front? do you depth test AND render them back to front for transparency? do you calculate the position of the element hierarchy every time something moves?
>>
By changing zoom scale ratio and the sprite texture size, I got the artifacts to a minimum.
>>
>>101513162
Fuck Vulkan, too complicated compared to OpenGL.
>>
>>101513720
Why does it look like it doesn't line up
>>
>>101511074
Why do I get the feeling that everyone in this thread who says "ECS" has no idea what it means?
>>
>>101513470
Render a GUI by doing a tree traversal, it's simple
>>
>>101513940
Im sorry you're stuck on 2010
>>
>>101512084
I know what threading is but you need to go look up what is rendering is
it doesn't matter if a text editor is multi threaded if its busy redrawing every frame 60 times per second as and tree sitter working on AST along with LSP doing its heavy shit will definitely slow the text editor down if the project is big or if there are multiple LSPs running in the background. Retained mode will surely provide efficient results.
>>
>>101513470
There's very low information on UI. It's a lost art at this point.
>>
>>101510007
using a web browser as an editor is the problem
>>
>>101514711
There doesn't need to be, anyone with half a brain can figure it out from first principles
>>
>>101513470
It is a perception thing. Things you haven't done always seem harder than those you are familiar with.
>>
>>101512890
Raw input for fps independent polling at 1000hz.
Audio library with good resolution on something like getAudioPosition function.
Any graphics library.
>>
>>101514717
exactly. If the thing rendering UI is slow af, stuff like threading won't make much impact
>>
>>101514842
no I've been trying to figure out how to make a ui properly for almost a decade.
>>
>>101515047
You can't have been trying very hard
>>
>ui is easy!
>no repo posted
>no explanations made
>>
>>101515104
If you're having any issues with UI, ask away
>>
>>101515047
क्या आप कृपया अपने निष्कर्ष साझा कर सकते हैं, सर?
>>
>>101515108
Ok, here we go, my biggest problem with UI has been how to do retained mode UI, every single UI library that is not GTK/Qt assumes you're supposed to do immediate mode rendering which let's be honest is fucking wasteful. You could just tell me to read Qt/GTK they're open source but they're not some couple thousand line codebases that I could make sense of. Also layouts, for which I have realized CSS is actually pretty good so I could just copy that for layouts/styling. Also event handling.
>>
>>101515108
1. how do I deal with scaling issues? I'm using skia to redraw each texture used for my elements each time the ui is resized, which is locked to 1x, 2x, 3x etc size.
2. the back to front tree traversal option stops working when I want my ui to be rendered in the world on a panel, do I draw everything to a framebuffer first?
3. how do I position everything? currently every ui element has a bounds object that has child bounds and when one is re-positioned they all move cascading down the tree. the alignment is calculated here.
4. should I be rendering everything on the same quad I make a transform for?
5. I'm redrawing the entire game ui every frame, is this retarded?
>>
>>101515165
>how to do retained mode UI
Every UI element is an object in a tree
It's a basic bitch OOP problem
>>
File: .jpg (120 KB, 1378x1325)
120 KB
120 KB JPG
>>101513720
Try again.
>>
>>101515173
>1. how do I deal with scaling issues? I'm using skia to redraw each texture used for my elements each time the ui is resized, which is locked to 1x, 2x, 3x etc size.
Scaling is the hard UI problem. The simple answer is don't. The complicated answer is vector graphics, SDF fonts, etc
>2. the back to front tree traversal option stops working when I want my ui to be rendered in the world on a panel, do I draw everything to a framebuffer first?
I don't understand. Turning off the depth buffer and drawing everything back to front should be fine
>3. how do I position everything? currently every ui element has a bounds object that has child bounds and when one is re-positioned they all move cascading down the tree. the alignment is calculated here.
Your solution is fine
>4. should I be rendering everything on the same quad I make a transform for?
Doesn't make sense, GUI elements can contain many quads, for example a piece of text
>5. I'm redrawing the entire game ui every frame, is this retarded?
No
>>
>>101515213
>Turning off the depth buffer
oh yeah I could just not write to it
>>
>>101512945
Why GLFW? SDL is superior in every way.
>>
>>101515165
>CSS is actually pretty good so I could just copy that for layouts/styling
I suggest not to follow that approach and forget about how browsers do UI. The primary reason why the web is fucked is because it uses two languages for UI and one for UX. Its better to have everything together and make it so that its all handled by one single thing.
>>
>>101512939
> https://civet.dev/
I quickly skimmed that and stopped reading where it said it's a "typescript superset". Typescript is already a superset of JavaScript. This is peak webdev brain rot.

I hope they at least have a civet->js compiler and aren't doing civet->ts->js
>>
>>101515174
>It's a basic bitch OOP problem
its absolutely not if you include dealing with the rendering part as well.
>>
>>101515323
You can render a GUI simply by traversing the tree of objects you've created
>>
>>101515323
I'm not sure what you're confused about. This is pretty straightforward, guy. Create some shit like BaseNode, give it a Draw and a Update function, children array, parent pointer. Override it to create like ButtonNode, TextNode, etc. Then just walk the tree however you want and call the update/draw functions. This is like intro to programming stuff, unless I'm misunderstanding what you're confused about.
Post code for more help
>>
>>101515329
okay. What about buffers for handling textures, font, vertices and stuff. How do i make it efficient to change the background color of a quad or font upon mouse over? Simply traversing a tree wouldn't take care of low level rendering part. It only takes care of organizing the widgets.
>>
>>101515370
traverse the tree
when you get to each object, bind it's appropriate parameters, color, texture, mesh
draw that mesh
it's so simple I don't know why this is an issue
>>
>>101515387
this issue is that what you are proposing is the general way of achieving it but I'm looking for an efficient way to do it. Maintaining a hash for each widget while constructing the widget tree, comparing the hash to the previous widget tree and redrawing only that widget is no big deal but doing all that within a single draw call as one vertex buffer where each widget has its own transform along with its own additional attributes like rounded corners, border, blur background is several folds more steps than a simple tree traversal and where the actual performance hit takes place.
Of course, you don't have to deal with any of that if your UI is basic af but if it isn't, then it gets a tab bit more complicated than a simple tree traversal.
>>
>>101515387
Wow that rendered a static looking frame, great. How the fuck do you handle actual UI, do you think all UI is static? Events motherfucker how and efficiently, I don't want to traverse every single tree to find out which component my mouse is hovering on, I don't want to draw the entire screen when all I needed to change was a green to a blue.
>>
>>101515420
Video game GUIs redraw every frame
If you're not making a video game and you're making a regular application that doesn't redraw every frame, I don't know
>>
>>101507574
Glad I'm not the only professional language hopper in here...
>>
>>101515427
The question was how do you render a GUI
How you handle GUI events is a completely different question
>>
>>101511382
Are you gonna go pure C and write a software renderer or are you gonna use OpenGL/Vulkan?

If the former, based.
If the latter, also based.
>>
>>101515428
>Video game GUIs redraw every frame
all of them don't. That's just a typical immediate mode UI implementation that video games go for as its ez to implement and works really fine for minimal looking widgets. There are games that go for efficiency and draw the UI to a texture with alpha channel and just present that texture. This UI texture is only redrawn or partly redrawn when anything needs to be updated.
>>
>>101515482
This is a bunch of misconceptions, rendering the GUI is not expensive, what you're suggesting is not common or efficient
>>
>>101515497
>rendering the GUI is not expensive
If you are rendering a very complex ui and only have a millisecond to spare then it can definitely be difficult to do so with immediate mode solutions
>>
>>101515521
Intermediate mode has nothing to do with GUI rendering
Rendering GUIs is not expensive, period, even a complex one. There's various optimizations you can make like batching draw calls as you would with sprites but even that's not really neccessary
>>
>>101515482
it draw on all update. many times every panel is quad. it just another scene on another pass.
>>101515521
also ui is not that expensive as all shaders are very simple afterall
>>
>>101515387
If you implement damage tracking and buffer reuse (the big performance optimisation of retained mode), it's a fair bit more complex than that.
>>
>>101515624
You should not be implementing damage tracking for a video game in 2024. This is an optimization which ceased to be relevant when graphics accelerators became a thing
>>
>>101515638
Yeah, it would be pointless in a game because like 99% of your frame is going to change anyway, but it seemed like this conversation was moving to a more general case.
>>
>>101515650
Do operating systems even do it anymore?
>>
>>101515656
Absolutely. Outside of "do nothing if nothing happened", it's still one of the biggest optimisations you can do for battery life.
>>
>>101515547
>as all shaders are very simple afterall
no, they are not. Maybe they are for something like ImGUI but that is absolutely not the case if you want to render material design UI.
>>
>>101515547
>it draw on all update
it doesn't have to and can be skipped if the devs intend to optimize it. They definitely will if the UI does not have simple widgets and uses different textures to render.
>>
>>101515676
>>101515693
You don't know what you're talking about
>>
>>101515693
baka, also to draw to any texture buffer it costs more vram and latency.
since this is gamedev and not webdev, i wont judge how much you know about material ui.
>>
>>101515827
okay. Maybe a retained mode with multiple image textures, animated UI icons and widgets is very ez and its hard for me because I'm dumb.
>>
>>101515873
>to draw to any texture buffer it costs more vram and latency
who says it doesn't? I'm pointing out that devs will optimize it if their requirements include having to draw multiple texture buffers like all the player's pfp in waiting room, inventory item images and stuff like that.
>>
>>101515875
The first step to not being dumb is to stop assuming things
If you're making a game, and I assume you are because this is the gamedev thread, you redraw the UI every frame. Drawing it to a seperate buffer and trying to damage track isn't really an optimization because of what >>101515873 says
Stop trying to prematurely optimize. Work from first principles, just make a basic UI with no optimizations applied, then benchmark it yourself and see if it's a performance issue. Because if you did this you would know that it actually isn't and you've just made things uneccessarily complicated for yourself before you even started
>>
>>101515901
>If you're making a game
I'm not. Stop assuming that I'm making a game first. I'm doing a retained mode UI and been singing that for a long ass time now. People have been chiming in while assuming that I'm making a game and were causing misunderstanding over misunderstanding.
>>
>>101515918
>Stop assuming that I'm making a game first
Can you read the title of the thread?
>>
>>101515932
yes. I don't see how I'm talking anything irrelevant though. All I was asking about is how to render general purpose retained mode UI and fags keep coming at me with immediate mode UI facts.
>>
>>101515951
This is /gedg/ you moron, if you aren't talking about games then go post somewhere else
retained mode and intermediate mode have nothing to do with rendering
>>
>>101516045
>retained mode and intermediate mode have nothing to do with rendering
okay
>>
>>101516048
retained mode / intermediate mode is how your logic is structured. Logic should be seperated from the rendering process
And easy way to do damage tracking is to divide the screen into a grid. When a GUI element changes, find the grid cells its in and flag those as dirty. When it's time to render, traverse your GUI tree, and only draw elements if they occupy a dirty cell
>>
File: mky02ltvpw831.jpg (926 KB, 1920x1080)
926 KB
926 KB JPG
>>101514653
how do I render this ui with tree traversal
>>
>>101514683
explain to me how a render loop in a separate thread doing its thing >60 times per second, will somehow force the lsp thread to a certain time constraint. just render the state of the lsp at that point in time at the start of the frame
>>
>>101516091
not flushing buffer kind of clever. still it require pipeline customization which preferably changing coordinate on atlas of a quad is better.
as in the context yall want very complex ui then a partial redraw kind of messy tho
>>
>>101515542
>>101515547
>Intermediate mode has nothing to do with GUI rendering
I said immediate mode retard
>Rendering GUIs is not expensive, period, even a complex one.
Yes it can be, if you only have one millisecond to spare and need to render something very complex. I have seen multibillion dollar pieces of software slow to a crawl because of the UI.
>>
>>101516242
>I have seen multibillion dollar pieces of software slow to a crawl because of the UI.
Not because of rendering it
You seem to have trouble seperating rendering from not-rendering
>>
>>101516091
>retained mode / intermediate mode is how your logic is structured
yes but efficient logic will be structured depending on how efficiently the engine does the rendering. You only totally separate rendering and UI logic if you are totally fine with the performance overhead, like you usually do with immediate mode.
>is to divide the screen into a grid
no, doing this will only over complicate things. The reason why you don't do is because this will be very limiting in terms of having features like onMouseOver() and onMouseEnter() events. It is fine if you want to do a basic retained mode UI though. The change in state of UI will de decided by the state of the model. In other words, the engine does absolute nothing when idle. Not even running a update loop.
What I'm currently doing is when mouse pointer moves, win32api's WM_MOUSEMOVE(or WM_KEYDOWN or WM_UP for keyboard) will be triggered and that is when the search for change in state happens. The position of mouse pointer will be determined by traversing the widget tree and skipped if the mouse pointer is not within the bounds of a root widget, allowing it to skip all the child widget of that root node. This way, it becomes very easy to trigger onMouseOver() and onMouseEnter() kind of events accurately on all the widgets the mouse pointer interacts with.
Flagging and traversing again will only over-complicate and it becomes more annoying if the widget is inbetween two grid cells. I don't think I'll be taking this approach as its very restricting and limiting in functionality. Thank you for sharing though.
>>
>>101516275
>Not because of rendering it
Yes, but this is a game development general. Game UIs are generally immediate mode, and in the case of immediate mode GUIs the rendering is the bottleneck. If you are spending more than a millisecond or so on your UI you are doing it wrong and that can require some optimizations for a sufficiently complex UI.
>>
>>101516168
>explain to me
no. It only happens when there is a lot of overhead while rendering UI, which is typically the case with electron apps.
>>
>>101516291
>>101516305
You have no fucking idea what you're talking about
>>
>>101516322
I am unironically developing a state of the art 2D graphics library, sit the fuck down
>>
>>101516338
I feel sorry for anyone you managed to trick into believing this then, because you can't even seperate logic from rendering in your mental model of how things work
>>
>>101516352
You are welcome to greentext a single thing I've said in error
>>
>>101516305
>If you are spending more than a millisecond or so on your UI
/gedg/ fags hardly experience this as all they do is render simple shit so they'll never understand and rant UI is light and immediate mode is GOAT, I guess.
>>
>>101516317
does electron belongs here?
>>
>>101516359
Seperating logic and rendering has no performance overhead. You should seperate the two in pretty much every situation, it makes things much easier to work with
Everything else you say is about logic instead of rendering, but you've conflated the two of these in your head
Game UIs generally aren't intermediate mode either, imgui is good for quick and dirty stuff, not for the real thing
>>
>>101516365
Yeah state of the art 3D graphics is pretty simple compared to flat shapes and text, I defer to you webdev-sama

>>101516374
He literally said he isn't making a game but he's still here for some reason
>>
>>101516379
>intermediate mode
Why do you keep saying this? The term is immediate mode. If you don't know what you're talking about you shouldn't be trying to call other people out.
>>
>>101516399
I used the wrong word, that doesn't change the point
>>
>>101516412
I've already corrected you and you continued to use it. Which is to the point that you are overconfident and would never admit defeat. It's pointless trying to argue with a person like that
>>
>>101516430
It's a fucking word bro, it has nothing to do with anything being argued
You're acting like a typical dunning kruger idiot who spouts a bunch of nonsense and just wants to be right regardless of the turth, look at what's actually being said instead of the spelling of a word
>>
>>101516374
I'm answering the question, though. Change in the state of UI, like showing suggestions while typing can be expensive for an electron app as it has to go through the web shit overhead before doing any actual rendering. And LSP is by no means a light weight protocol. I don't want to go into details on how fucked up it is and its not as simple as updating the LSP's current state. The communication happens through json and the editor will have to wait till LSP got its shit together and when it does, having to redraw the entire frame with these new updates will take a significant amount of time to display depending on how the editor manages to render these updates in state and having to do that 60 times will cause a significant lag while updating when all this is a continuous process.
>>
>>101516452
Renderering GUIs does not take a significant amount of time
>>
>>101516390
>Yeah state of the art 3D graphics is pretty simple compared to flat shapes and text, I defer to you webdev-sama
yeah, I get that you won't bother with optimizing your game's UI and focus on graphics of you game. I mean, you don't have to if you never rendered complex UI in the first place.
>he's still here for some reason
I may not be making a game but I'm not talking irrelevant shit.
>>
>>101516454
>Renderering GUIs does not take a significant amount of time
yes, it won't if all you are rendering is plain stuff. It will if you are doing anything fancy though, like rendering multiple fonts with varying sizes, colors and stroke and all that.
>>
>>101516489
I've rendered a complex UI, it barely takes any time at all. UI rendering is only complex if you're doing vector graphics
>>
>>101516512
Text is pretty simple to deal with because you can generate a text drawable and then cache it and only update it when it actually changes. Nearly all text is static so text performance isn't an issue
>>
>>101515289
BLOAT
>>
>>101516516
>doing vector graphics
welp, that is what icons in material UI design are made of. Also, rendering font as vector straight outta bezier data is more efficient for handling font resizing situation with accuracy unlike the bitmap alternative.
As I was saying for a while now, UI is simple if all you are doing is render plain shit but that's not the case if your requirements demand more than that.
>>
>>101516539
So you're writing a vector renderer?
>>
>>101516527
you are talking about a bare minimal text rendering scenaior. I'm talking about a situation where text needs to be of different sizes, colors and stroke. I assume you mean generating a font atlas when you say "text drawable" but that has its limitations being not looking good and hard to handle resizing and stroking.
>Nearly all text is static
I'm talking about a fancy scenario where all text is not static like in a text editor
>>
>>101516548
no. I'm writing a retained mode UI that is not basic af and doing vector rendering happened to be its requirements.
>>
>>101516568
A font atlas is one way to cache text but it's not the only way, you can save whatever data is generated by your text generation system and reuse it until the text changes.
Text in a text editor is static. It's not changing every frame, it only changes when you put some text into it. In a text editor you break the document up into some sort of partitioned data structure, so when you insert text the whole thing doesn't need to be regenerated
>>
File: annoyed.jpg (5 KB, 220x168)
5 KB
5 KB JPG
>get home from work
>open gedg
>its another fucking ECS thread
>>
>>101516585
>by your text generation system and reuse it until the text changes.
yes and that's the point. You are totally skipping the complexity involved with rendering text like this and simply quoting that "Text is pretty simple to deal with.." when it actually isn't and talking as if its fine if reusing this text generation system is not fast.
>Text in a text editor is static
when is text not static then? when it is in a 3D space? I think the term static text is only valid for menu items like "File", "Edit", etc., as they never change but not to the text inside the editable region.
>when you insert text the whole thing doesn't need to be regenerated
it depends. If what I inserted is a return character, then it needs a lot of regeneration. You seem to be underestimating this a lot.
>>
>>101507442
Wife of Maciej Nowicki, Eve, Stellar Blade
>>
File: consider2.png (264 KB, 1000x1000)
264 KB
264 KB PNG
>>101516653
how about stop wasting time and start making ur GUI system how you want and then if you have problems with that method then you could figure out something else by profiling and debugging how about that
>>
>>101516653
>You are totally skipping the complexity involved with rendering text like this
Generating pixels from text, fully and completely, is enormously complex. It's a field all by itself. That's why you use a library like FreeType instead of doing it yourself.
>when is text not static then?
Typically dynamic means changing every frame. Text is essentially static, in that it rarely changes. A text field in a text editor doesn't change every frame, it changes every time you make an insertion, and most of the text in the text field will still be the same, so there isn't much regeneration you have to do
>You seem to be underestimating this a lot.
No, I've done it before. You're making a rookie mistake in that you're overestimating how complex it is because you don't know the best way to do it
>>
Game guis tend to be pretty simple unless you’re making some sort of rpg or intricate sim I guess. Personally the only real performance issues I’ve really bumped into with them were batching problems due to fonts and memory or fillrate problems with high res textures on terrible platforms.
>>
>>101516660
That's what I do, just do something the best way I know how at the time. If things are successful I can leisurely fix it later if it's even a problem.
>>
>>101516539
>>101516576
>>101516653
You would just use SDFs for this larper-kun
>>
Is godot any good for VR games?
>>
>>101516753
>You would just use SDFs
no. SDFs are not ideal for UI. They remove the font details whenever there are sharp corners. They fit perfectly fine for rendering in 3D space but for UI they are not ideal
>>
>>101516660
I already started and tried several ways. Looking for efficient way to do things as I ran out of ideas.
>>
>>101516679
>No, I've done it before
whatever you've done is mid at most. Rendering font that can change its stroke and size at runtime is not as simple as you are claiming or imagining it to be. It gets as simple it could be when generating a bitmap of character but that will give a hard time with scaling. Which is where freetype like general solutions won't come handy and a custom re-write comes into picture.
>>
>>101516847
Somehow I doubt you actually ran into any performance problems
>>
>>101516902
What have you done? Have you even done anything? Because all you've done is waste space in the thread pretending to have expertise on something you clearly don't. Existing font libraries can do everything you need them to do, have you even used them?
>>
>>101516903
I did, actually. While rendering font from bezier curve using contour data, when drawing 1000 circles and squares and displaying multiple image textures. I never got perfect stroking working, need to working on it. The frame raters were not bad but not good either and its not only about performance.
I'm exploring on how to abstract all this as simple and straight forward as possible. Like interacting with, manipulating and redrawing widgets only when needed. I could do a minimal af abstraction like suggestion by all the fags here till now but that will only give me a minimal af functionality. I already spent a lot of time on this and the last thing I want is for it to look minimal af. Gotta see.
>>
>>101516986
How are you drawing these? Because if you can't even draw 1000 rectangles then you are doing something very wrong
>>
>>101516918
>What have you done?
for the context, font rendering without using any library
>all you've done is waste space in the thread
yeah, its my fault if people kept coming at me assuming I'm talking about Immediate mode UI without reading any prior posts.
>Existing font libraries can do everything you need them to do
yes and they also come with their own bloatware and I never said they were bad. I'm pointing out that they clearly show their limitations and demand more resources to do things they can't provide out of the box.
>>
>>101516831
>They remove the font details whenever there are sharp corners.
You need to do some research. That problem has been solved for years.
>>
>>101517012
>How are you drawing these?
vulkan. Drawing 1000 squares and rectangles did drop the frames decently. I never said I wasn't able to draw them though.
>>
>>101517048
How are you drawing the squares and rectangles?
>>
>>101517037
>You need to do some research
or better, I could just draw them as a svg path instead inside a quad on the GPU. Seems like a more efficient alternative than an SDF and this lets you handle stroking as well.
>>
>>101517063
>Seems like a more efficient alternative than an SDF
It's not. It's far less efficient
Literally everything you say is misinformed
>>
>>101517063
>or better, I could just draw them as a svg path instead inside a quad on the GPU. Seems like a more efficient alternative than an SDF and this lets you handle stroking as well.
Listen, I have been in your shoes before, but you are being an idiot right now. Rendering an SDF is a single texture sample, it is practically free. If you genuinely believe that your bezier curve renderer is more efficient than a single texture sample then you need to go back to doing tutorials and learning the basics before attempting this.
>>
>>101517048
>How are you drawing the squares and rectangles?
my bad. I meant 1000 squares and circles. Square is just a quad and the circle is a SDF circle. I rendered everything within one draw call using only one vertex buffer that has all the quads and circles vertices in it. I know the circle is where the performance hit took place but pixel perfection that rendering through distance fields gives is hard to let go. I'm thinking about replacing this with circular curves in the future if I this becomes a big issue, gotta see.
>>
>>101517082
>>101517086
hm... I'll look into SDFs again then. Thank you.
>>
I've heard SDF can have problems with highly detailed font glyphs like you get for CJK.
>>
>>101516649
And that is the "person" shilling Odin.
>>
>>101517409
I've also heard that it's really not all that great for "normal" text rendering at normal text rendering sizes, and is instead suited for writing shit on walls in 3D or whatever.
>>
>>101517531
at least we can filter him
>>
>>101517557
Please just stop posting until you have some genuine knowledge so this thread isn't completely full of garbage
>>
>>101517569
See >>101517569
>>
this bread is rotten, can't wait for a new bake
>>
>>101517557
Oh it definitely looks better for latin text assuming you store it at a suitable resolution for the point size you are using
>>
>>101515212
kek
I'll take a 1 pixel artifact over what I had before. Hopefully it doesn't bite me in the ass later on...
>>
>>101515318
yeah but specifically for scripting a text-based simulation game, a higher level and more expressive language could make more sense, because most of the code will likely consist in reading/modifying objects/lists plus a bunch of conditionals for stats checking etc., so it could be useful to reduce the ceremony necessary for that sort of stuff relative to JS, e.g.:
https://civet.dev/reference#object-globs
https://civet.dev/reference#prefix-operators
https://civet.dev/reference#array-string-slicing
>I hope they at least have a civet->js compiler and aren't doing civet->ts->js
they obviously are doing civet->ts->js because writing and maintaining a new TS type checker for no good reason would be a dumb move
>>
>>101515212
how does that even happen
>>
>>101517864
having a subset of a subset is a dumb move. webshitters try so hard to put lipstick on the pig it's so funny
>>
>>101518080
if you could go back in 30 years and had a complete freedom to redesign the web platform from scratch with full foresight of how the requirements would evolve, then sure, it would be a dumb move.
but if you're in 2020s and you just want an expressive language with a decent type system that's realistically doable in a few years and compatible with the existing ecosystem, then it's not really a dumb move.
also I guess you can actually transpile it directly to JS but this skips the type-checking step.
>>
>>101516165
for (const auto &child: children) {
child->render();
}
>>
>>101518411
why do you need an "existing ecosystem" for a fucking text adventure
>>
>>101517037
>You need to do some research. That problem has been solved for years.
is it MSDF? Unfortunately, MSDF is producing artefacts if the resizing goes beyond a limit and I'll have to recreate new MSDF texture for all characters by bumping the glyph texture size up but that'll take significant amount of time(a few seconds) and cause a lag while resizing during runtime. I was hoping for a one time setup, smooth resize solution and this unfortunately isn't that. Correct me if I'm wrong.
The last thing I want to do is spend a lot of time on rendering text just to end up with an limited version of it, like not being able to deal with emojis. Even if it is not efficient, I'll stick to rendering glyphs directly as vectors for the time being to avoid any loss of details. Precision is important when doing a text editor or rendering a PDF.
>>101517531
yet, that's me and now you know I'm not perfect. well, I wouldn't be lurking here I was lol
>>
>>101517569
I was ignorant about the SDF textures and I looked into it when people pointed it out. Rest of the time, it wasn't anything like that. Except for the beginning of the thread, fags kept coming at me with immediate mode solutions which are targeted towards providing basic functionality with plain UI and was absolutely what I was not looking for. I'm sorry if it turned out to be a mess, I'll be careful from now on.
>>
>>101518799
You were saying GUIs were hard to render. They are not. Turns out you're making your own font render because you can't use existing solutions for some unknown reason
Immediate mode has nothing to do with rendering, as I've said about 5 times. You're conflating rendering with logic, these should be seperated
>>
>>101518578
I was talking about the developers of the language, not about me.
but if were talking about my use-case, it would be a plus because the existing web ecosystem is the best choice for my UI and therefore for the engine (as this is for UI-based games), and a language being compatible with this ecosystem (by transpiling to pure JS without an extra runtime) makes it a good fit for the game scripting part, because that way the communication between the engine part and the code part can be direct, so that there's no need to convert data structures, code can be moved between game and engine and vice versa as I get more clarity on how they should be demarcated, etc.
but I don't even plan on using it for now. I just brought it up as an example to illustrate that you're not constrained to writing the game itself in JS even if you use the web platform as basis for the engine.
also I wouldn't call it a text adventure, more like a simulator.
>>
>>101518831
>you can't use existing solutions for some unknown reason
The reason is that I want smooth text resizing with no loss of data and perfect anti-aliasing.
>Immediate mode has nothing to do with rendering
okay but Retained mode has a lot to do with rendering. Its fine to separate logic in case of immediate mode and create your abstraction over the rendering API as you are basically recreating the entire thing from scratch for every frame anyway but you can't do that with retained mode because you need to keep track of current state and previous state to figure out the changes in state and which parts of the frame need to be rendered. You are not starting from scratch for every update, you are starting from previously rendered frame and that is a very different thing. Do correct me if I'm wrong, I'd be more than happy.
>>
Do you guys like trees?
>>
>>101518966
Entire operating systems use FreeType, why can't you?
Seperate logic from rendering and immediate / retained makes no difference
>>
>>101518981
is that 3D?
>>
>>101518981
I've already spotted three glitches.
>>
>>101518991
>why can't you?
I don't want my font renderer to be mid af. I wish for my application to render WYSIWYG irrespective of what platform its running on.
>makes no difference
yeah, it doesn't but the way how rendering is done define how immediate/retained mode is structured. The more closer they are the more cache friendly the code can be written. I'm not storing any duplicate data for widget, I'm storing them directly in the vertex buffer with minimal info and that has served me well so far.
>>
Is it normal to have multi-purpose systems on ECS?
Let's say I have 2 systems that need to iterate through every entity, do I combine them into 1 system? what should I do
>>
>>101519146
>I don't want my font renderer to be mid af
Oh you mean you don't want it to be "mid" like Linux, iOS, and chromeOS? Industry standard just isn't good enough for you?
You're a clown
>>
>>101519023
It's a 2D sprite maybe from a 3D mesh in blender.
>>101519096
it's so over.
>>
>>101519254
>Oh you mean you don't want it to be "mid" like Linux
I don't want it to be mid like Windows. Industry standard of OS X is good enough for me.
>>
>>101519348
Windows doesn't use Freetype. Linux does
>>
>>101518411
why do you need all of that for a web scripting language
>>
>>101519373
doesn't matter. I already stated what my requirements are
>Industry standard of OS X is good enough for me
if I'll use freetype or not is up to my requirements and I don't mind putting in additional effort to get what I want if the existing tools don't fit in well
>>
>>101519173
that's against da rulez
>>
>>101519373
wait really?
>>
>>101520115
You're a fucking retard rewriting font rendering libraries when it would literally take you thousands of hours and perfectly good solutions exist already
>>
>>101520155
>You're a fucking retard rewriting font rendering libraries
okay. I wanted write one so I wrote on. Its still not perfect but works fine for latin glyphs. I may be retarded according to you but from what I know, I'm doing exactly what I intended to do.
>it would literally take you thousands of hours and perfectly good solutions exist already
good, use it then. I'll be using harfbuzz since there is no other way to get decent text shaping done. I can write a ttf parser and get the glyph contour data and organize it how I think is efficient for my renderer in and skip linking to freetype because I can and its fun. I don't see why I should be using freetype and why its retarded of me to not use it. Stop forcing me to live by your standards, please.
>>
>>101520155
>reinventing le wheel is... LE BAD!!
>>
>>101520264
It's retarded not to use it because it's hard to do yourself, and what you do yourself will be strictly worse than FreeRype
You started off the discussion by saying "rendering GUIs is hard" and now it's become "rendering text is hard because I refuse to use a library that does exactly what I need"
>>
>>101520330
>It's retarded not to use it because it's hard to do yourself
I see. If that's the case then people should stop making their own game engine since making game engines is hard to do by oneself and whatever they do will be strictly worse than Unreal, Unity or Godot.
>rendering GUIs is hard
yes, rendering GUI is hard, especially if its not complex and rendering text is a part of rendering GUI. Also, text alone doesn't make rendering GUI hard. There are a lot of elements to it like animated icons and responsive user experience that actually make it hard. If you think that I said GUI is hard just because I didn't use freetype2 for rendering text, you are gravely mistaken. In fact, the first question I asked here is me trying to figure out how to structure all this abstraction. Its hard for you to understand if all you are imagining is a basic UI like ImGUI and I won't bother explaining further about this anymore.
>>
>>101520455
*especially if its complex
>>
>>101520455
A game engine is an open-ended problem, you can absolutely make something better than existing engines for your particular use. Not so with closed problems like font rendering
Rendering a GUI is easy if you're not doing stupid shit like writing your own text renderer
>>
>>101520094
this is a very ambiguous question. is it the generic you or do you mean my particular project? and what is "all that"?
>>
>>101520477
*ignored*
>>
File: nft.jpg (219 KB, 1200x900)
219 KB
219 KB JPG
>>
>>101520477
>Rendering a GUI is easy if you're not doing stupid shit like writing your own text renderer
If it was easy then people would be able to just use a handful of libraries and get high quality text in their custom guis. But that never happens, for anything that's not gtk, qt, a browser or OS native stuff, it's always some half-assed garbage. Usually they don't even have any kind of font fallback so you just get squares.
>>
I have some experience reimplementing a retained mode GUI used in commercial games. It's pretty simple really, you're just rendering a hierarchical 2D scene onto a texture and drawing it in front of the game. It's more tedious than difficult.
>>
>>101520967
You can use FreeType which is what Linux the native OS uses
People have posted their GUIs in this very thread that do this
>>
>>101521064
Freetype just renders glyphs. If I paste 和製漢字, حديث مرادف, ( ͡° ͜ʖ ͡°), or emojis into those guis, it won't do you much good, because it doesn't know which glyphs to render and where to render them.
If you want actually good text, which I'm arbitrarily defining as "you can paste any text from a browser and it looks more or less the same", you need more than just freetype. At least text shaping and font fallback, as well as code for finding line breaks and other stuff.
There are libraries for that as well, but it's enough of a mess that this
>Rendering a GUI is easy
is false even if you're not writing everything from scratch, assuming you're talking about a proper GUI which can render arbitrary text at high quality.
For a game GUI you can and should disregard all of this and use freetype and a single font file.
>>
>>101521241
You know that text is just one part of a GUI right?
Like I said, people in this thread have done this, you need FreeType and HarfBuzz or some other bullshit, but you can get quality text on the screen. That's the only difficult part, if you consider using external libraries difficult, the rest is easy
>>
>>101521275
I am 100% sure that nobody in this thread used harfbuzz in their game.
Again it's not a coincidence that nobody ever bothers to go the whole way. Even with harfbuzz, you still need a ton of custom code to deal with font fallback, layout and line breaks, and other bullshit.
You're free to BTFO me by posting a screenshot of your game engine rendering some Japanese and Arabic text and some emojis, though.
>>
>>101521376
>I am 100% sure that nobody in this thread used harfbuzz in their game.
Well you're wrong, because someone made a post about it, he posted a screenshot of his game with some backwards Arabic text
>>
File: file.png (11 KB, 527x49)
11 KB
11 KB PNG
>>101521399
Well, maybe 100% was an exaggeration. If that guy got it working, that's good for him. All I'm really saying is that you shouldn't go around saying it's easy if you've clearly never tried to do it.
Besides, most of what I've said describes the C/C++ situation, nowadays you can just use rust and get it working in 30 seconds. Pic related is glyphon, which uses cosmic-text. Almost nobody uses rust for games and guis so far though.
>>
>>101521487
I'm saying it's easy because I've DONE it
>>
>>101521489
>no screenshots
>>
32 bits float lights, let's see them
>>
>>101521487
Sounds to me like you're just retarded.
>>
File: editor.png (1.54 MB, 1296x974)
1.54 MB
1.54 MB PNG
>>101521495
Here's the editor from an old game I made
>>
>>101521526
is this bait? nothing there shows that you have proper shaping or font fallback or anything.
>>
>>101521548
Who said anything about shaping or font fallback? We're talking about rendering a GUI
I don't have proper shaping, font fallback is completely trivial
>>
>>101521568
>Who said anything about shaping or font fallback?
me????
>>101521241
>>101521241
>>101521241
>>101521241
>>101521241
>>
>>101521602
Well HarfBuzz does shaping for you, someone else has a project that uses that, I don't
Using third party libraries isn't hard
>>
File: plank.jpg (206 KB, 800x450)
206 KB
206 KB JPG
>using harfbuzz
>cant figure out how you're meant to figure out which output glyph matches which input character
>feels more like hardbuzz
>>
>>101512890
SDL2 or Raylib
>>
File: file.gif (98 KB, 800x600)
98 KB
98 KB GIF
Hey /g/uys, I'm back. I did some collision stuff today, also better animation handling. So things are finally looking a bit better, now If I can get an enemy spawn going and HP/health and also enemy projectiles then It gets better. I have some sound added as well(unfortunate gif) for the ship projectile and the explosion.
>>
>>101523730
there's a rule about animation, total volume must persist, that menas, in your case if the thingie is squished then it should grow taller
>>
>>101523774
hmm, very interesting, so do I shear it in the y axis, because the texture itself seems that way.
Either way I can easily swap it out because almost everything is computed except the number of frames in the texture.
>>
Is ECS even suitable for UI?
>>
>>101520136
windows does font rendering in the kernel lol
>>
>>101523730
> progress in /gedg/
Heresy.
Can you give some details about your animation implementation ?
For a version with sound you can go post it in >>5617009
>>
>>101523730
>>101524918
I'm tired, >>>/wsg/5617009
>>
How do linux game devs prevent their game from "rotting". I heard that Linux ports if they were good also tend to break after a while after some revisions to a distro. I've heard the solution to this is just to use the included steam linux runtime libs and don't use anything outside of that.
>>
>>101527279
there's a flag you can pass the linker to make shared libraries work relative to the elf file similarly to how they work on windows
i think the easy way to set it is CMAKE_BUILD_RPATH_USE_ORIGIN which i think makes it look relative to itself but you can do stuff like --rpath='$ORIGIN/../$LIB' (i think that's right i usually do it through cmake, use single quotes, they aren't real shell variables) to make it look in what a local library directory would be
then use ldd? to locate and find all the deps and copy them into the binary's directory
i'm not 100% sure how well this actually works in practice but i've used this a couple of times to isolate some local library and tool installs and it seems fine-ish

otherwise i read on the factorio dev's blog that their strategy is to intentionally minimize dynamic dependencies to a known subset with a stable ABI
i think they were fine linking to SDL but not much else
>>
>>101527279
>don't use anything outside of that
You can, you'd just have to ship them yourself or statically link them in.
It's usually not really an issue, unless you've got some libraries that REALLY like to break their ABIs with new versions.

>>101527454
>i think they were fine linking to SDL but not much else
Dynamically linking libraries is nice because you can theoretically replace the library.
SDL is the perfect example because you could replace it with a new version and gain native Wayland support, if you have a game shipped with an old version before SDL gained that.
>>
>>101527279
>linux game devs
no such thing
>>
File: cddadeps.png (61 KB, 1035x348)
61 KB
61 KB PNG
>>101527279
If you're already talking about a Steam version just ship whatever library you need with it. I think the problem you're talking about is for games in repositories with system dependencies like picrel.
>>
File: 5 Rules.png (101 KB, 760x415)
101 KB
101 KB PNG
>>
>>101524886
Not only text rendering but wasn't there some kernel crash a while ago from the kernel rendering the scrollbars in UI?
>>
File: file.png (32 KB, 1280x748)
32 KB
32 KB PNG
Speaking of GUIs, here is my custom retained mode GUI library in C++/raylib, I posted about it before but it's nearly complete now. Spent the past 2 weeks working more on it, adding missing widgets and stuff.
>>
File: file.png (28 KB, 1280x748)
28 KB
28 KB PNG
>>101532670
Implementing the lists with clipping, offsets, handling mouse/scroll events with offsets in mind and making them cooperate with scrollbars was kinda ass but it wasn't that bad given how modular/dynamic I made the callback/layout system.
>>
>>101532670
>>101532689
Looks really clean, good job. Do you support keyboard navigation/actions ?
I also implemented some UI components with Raylib but in plain C, it's okay in general but I don't have a nice callback mechanism.
>>
>>101509093
you set up a system for rendering immediate mode ui, that's it.
>>
>>101532741
Thanks, by the way, the widget trees are fully dynamically loaded at runtime from JSON, so you can prototype and live reload without rebuilding the code, this is the gallery markup: https://pastebin.com/raw/guse7nua
Currently no keyboard navigation mostly because when I get around to it, I also want to add gamepad support at the same time but I can't be fucked right now, it shouldn't be hard though because I already have methods like "get next focusable child" etc, so if I hooked that to the tab key, I could cycle through focus, and then I could just override handlers, like for a CheckBox, I could just do:
bool UICheckBox::onKeyPressed(const int key)
{
if (key == raylib::KEY_SPACE || raylib::KEY_ENTER)
{
return setChecked(!isChecked());
}

return Widget::onKeyPressed(key);
}


And it would allow you to toggle the focused checkbox with space/enter, so it shouldn't be that hard. Right now I want to finish the Window component to give it proper title/statusbar, and then make it so I can override style properties on a per-widget basis (since currently I have a global stylesheet-like system).
>>
>>101532780
Also, all of the core C++ functionality is exposed to Lua through a usermod system and Widget-specific bindings, so the gallery code can also be loaded at runtime: https://pastebin.com/raw/0QghbGWg

Kind of sucks because it requires a lot of repetitive code though just to bind the functions: https://pastebin.com/raw/GBhvaarA
>>
>>101532808
Impressive. So if you were to use that in a game you would have a json sitting next to your executable ? And how do the callbacks connect to the elements in the json ?
At this point you're just a few features away from html+css+js but with json and lua isn't it ? Your code probably nukes webshit in terms of performances.
>>
File: file.png (26 KB, 1280x748)
26 KB
26 KB PNG
>>101532923
>So if you were to use that in a game you would have a json sitting next to your executable ?
Yes, pretty much, for instance pic related is just:
data/ui/mainmenu.json: https://pastebin.com/raw/T9c9VmVP
data/mods/mainmenu.lua: https://pastebin.com/raw/kQjZV2Z6

>At this point you're just a few features away from html+css+js but with json and lua isn't it
Pretty much yeah, I wanted to mimic something like that with my own take on it.

>Your code probably nukes webshit in terms of performances.
It's hard to say, I feel like I'm mostly bound by raylib's performance (which is actually pretty poor with regards to text rendering, I will need to implement some sort of a class that wraps text and renders it to an FBO, because otherwise raylib calculates all the glyphs each frame).
>>
>>101529450
xonotic works on my machine
>>
>>101523730
sovllll
>>
>>101532923
>And how do the callbacks connect to the elements in the json ?
Oh and to answer this question, you can see in the Lua code that I can basically fetch objects and assign Lua table properties, so basically I have a root Widget * (actually a smart pointer), that has children, who also have children and so on, then I have a find method that returns that, then you can assign a Lua table property that the C++ code will look for, so then UICheckBox::setChecked just does this:
    if (hasLuaField(*this, "onCheckChange")) {
callLuaField(*this, "onCheckChange", checked);
}


So if you do:
window:findCheckBox('foo').onCheckChange = function()
print('checked!')


The C++ part will find that property in its own Lua object and call it.
>>
File: file.png (188 KB, 951x761)
188 KB
188 KB PNG
>>101533005
And the way these are implemented just really depends on the language/library you're using, pic related is how I did it in C++ with Sol2, since you mentioned C it would probably be harder (since you would have to deal with varargs and figuring out their types, don't know if that's a thing because my brain is pretty much all C++ templates at this point).
>>
File: 1566892440602.png (627 KB, 738x466)
627 KB
627 KB PNG
>>101532957
>>101533005
>>101533020
Thanks for all the details, much to learn from.

I definitely agree with the problem of rendering text with Raylib. I started writing code to have multi coloured text before I realized that I was re-implementing the entire DrawText() function and calling DrawText() for each character, so I added a new function at the library level instead. It's still sub-optimal for the reason you pointed out.
>>
>>101532670
If you didn't write your own font shaping / rendering system you didn't beat the game
>>
>>101533252
Fuck, now you made me realize that I will also need multi-color text for things like item and spell tooltips. Thankfully I feel like copy-pasting the DrawTextEx function and mofifying the color param to accept something like:
struct ColorRange
{
size_t start = 0;
size_t end = 0;
Color color;
};

DrawTextEx(..., Color mainColor, std::vector<ColorRange> colorRanges);


Then making the call to DrawTextCodepoint function to check the current codepoint position to match against color range to pass it as a param should work.
>>
>>101509825
>he doesn't understand the importance of +0 and -0.
You really should kill yourself.
>>
>>101533360
Here you go, exactly what I did. Since the code is so similar to the original function I plan to release it as a fork.
>>
>>101533444
I'll probably make it parse a markup text instead of having to manually specify the ranges, so given something like:
"He{red:ll}o, {blue:wo}{green:rld}!"


It would automatically generate the text ranges, so you don't have to actually worry about it.
>>
File: file.png (1 KB, 147x44)
1 KB
1 KB PNG
>>101533360
>>101533466
Ok that was surprisingly simple, the following produces pic related:
raylib::DrawColoredText(*font, "He{red:ll}o, {blue:wo}{green:rld}!", {10, 30}, 20, 2, raylib::WHITE);
>>
>>101527279
Chroot or docker your desired environment for building, deploy the libs along with your application and make a launcher which sets the relevant LD_LIBRARY_PATH.
Usually you'd use either something stable like debian or the steam runtime sdk as a base.
>>
>>101533623
actually oops, looks like I swalloed a letter there
>>
>>101533623
>hellworld
nice DOOM clone
>>
Is putting every loaded model in the same vertex buffer retarded? (vulkan)
>>
>>101533788
for what purpose
>>
>>101533788
Nah it's fine.
>>
>>101533788
I havent used vulkan but that sounds retarded unless you only have 1 draw call
>>
>>101533788
it's fine. You will use buffer index anyway when doing draw calls anyway.
>>
>>101532957
What game are you making?
>>
>>101534758
I'm just trying to make an engine for a 2D top-down, online multiplayer ARPG. The plan is to make an engine that can do all the features such a game would require, then get my friend who's more of a gameplay programmer on board to make spells, item systems and so on (basically the game content).
Ultimately, we would like to make something like Hero Siege, except not run by retards, and not full of bugs and teleport hacks and other bullshit because it was made in GM.
>>
File: pixelshit.webm (2.43 MB, 1920x1080)
2.43 MB
2.43 MB WEBM
>>101534850
I posted it here before like 3 weeks ago but been occupied with working on just the GUI library for the past 2 weeks or so, and still need to spend another week or so on it before I can go back to actual game-related stuff.
>>
>>101534850
>I'm just trying to make an engine for a 2D top-down
Why are 2D bros so competent? They always post updates unlike vulkan homos.
>>
>>101534878
(Also not on the webm because it's a bit outdated, but I have since added item stacking, stack splitting, and equipment slots).
>>
>>101534891
2D is far easier to work with
>>
>>101534902
Stop making excuses.
>>
>>101534902
This, and also because I'm using raylib for rendering, not writing a renderer from scratch, meanwhile most people fucking around with Vulkan etc here are usually just fucking around with writing renderers here. I'm not interested in that, like it's cool if you want to learn modern rendering techniques and stuff but I'm more interested in actually making a game that requires me to make a small 2D engine fit for it, rather than fucking around with a renderer just for the hell of it.
>>
>>101534921
I've done 3D, it's hard
>>
File: physics.webm (2.81 MB, 1600x900)
2.81 MB
2.81 MB WEBM
It's all coming together. Next is implementing inertia and angular velocity.
>>
>>101534953
neat
>>
it should be a requirement to make your own engine to be a game dev
>>
>>101534953
neato, whatcha making?
>>
>>101536504
A physics engine.
>>
>>101536238
just like making your own kernel to call yourself a programmer
>>
it should be a requirement to beat your own game to be a game dev
>>
>>101537214
If it's a simulation, you can't beat it. And it's not a simulation, you're most likely a "game developer", not a game developer
>>
True devs draw their own fonts from scratch
>>
File: 1719929769097209.jpg (89 KB, 900x750)
89 KB
89 KB JPG
real devs are neets
>>
Alright folks time to start learning opengl and not stop until I have my shitty basic renderer that can at least draw most 2d shapes. I'll update progress here.
>>
>>101538115
good luck anon!
>>
>>101538115
see you in 1h.
>>
>>101538098
>picrel
kek
>>
File: rgb.png (44 KB, 910x386)
44 KB
44 KB PNG
>>101533623
dumbest implementation I could come up with, 2 lines changed in DrawTextEx()
> whitespace counts as a character
fml
>>
File: 1715726827808008.webm (1.6 MB, 1920x1014)
1.6 MB
1.6 MB WEBM
Day... 13? OpenGL learning; complete newbie.

Finally got model loading work with texture support. I have 1 VAO per scene, with 1 VBO and 1 EBO per mesh. I keep track of the primitive offsets so I can render it properly, using glDrawElementsBaseVertex to draw each primitive individually. This lets me assign textures per primitive, which is nice. Someone please tell me if this okay, I don't want to be fucking myself over down the road.

Anyway, here is a webm of some goofy looking rings with textures assigned on a per primitive basis. Now I just need to get materials working again.
>>
>>101539914
>I have 1 VAO per scene
why?
>>
Can someone recommend me a book or tutorial series that's about constructing geometry, meshing, topology, etc? Generating and manipulating all the shit to send to the gpu in the first place.

Bonus points if retards like me can digest it.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.