It's late and this is probably dumb, but I see no reason why C# should prevent me from creating a static function in a class with the same name as the class, provided that the function returns an instance of said class.
ie:
[code]
public class Turn
{
public Point From;
public Point To;
public Boolean Forfeit;
public Turn(Point from, Point to, Boolean forfeit = false)
{
From = from;
To = to;
Forfeit = forfeit;
}
public static Turn(byte[] bytes)
{
using (var memStream = new MemoryStream())
{
var binForm = new BinaryFormatter();
memStream.Write(bytes, 0, bytes.Length);
memStream.Seek(0, SeekOrigin.Begin);
var obj = (Turn)binForm.Deserialize(memStream);
return obj;
}
}
}
[/code]
Instead I have to do
[code]
public static Turn FromBytes(byte[] bytes)
{
using (var memStream = new MemoryStream())
{
var binForm = new BinaryFormatter();
memStream.Write(bytes, 0, bytes.Length);
memStream.Seek(0, SeekOrigin.Begin);
var obj = (Turn)binForm.Deserialize(memStream);
return obj;
}
}
[/code]
or write an ugly constructor where it deserializes the object only to copy each of its properties before throwing it away.
Finally got the corona working for my star, in some vague capacity. The alpha blending here isn't working nearly as well as I'd like, so I need to tune that (by changing the VkColorBlendState structure, probably) and I still need to tune the appearance quite a bit. Plus add the blackbody-curve based coloration back in, so that stars are colored based on their temperature again.
[url]https://gfycat.com/AltruisticJadedHamadryas[/url] (linked because fuck i forget how to embed these without it being fuckhuge)
I really do like how easy it is to expand ImGui though: adding those tabs was as simple as including [URL="https://github.com/fuchstraumer/VulpesRender/blob/master/include/util/imguiTabs.h"]this[/URL] one header, and then just defining my tab names and an array with tab indices. I use a switch statement to check which tab is active, and then just render that tab. It works quite well and helps organize things better (imo) than the usual method of using ImGui's tree nodes and such.
Made my first real pr to openmw
[url]https://github.com/OpenMW/openmw/pull/1377[/url]
[editline]6th August 2017[/editline]
I thought this would be easy but it's hard when none of the apis are documented and you gotta find usage examples yourself.
Thank god for peek definition I too I guess
[QUOTE=Kybalt;52544598]It's late and this is probably dumb, but I see no reason why C# should prevent me from creating a static function in a class with the same name as the class, provided that the function returns an instance of said class.[/QUOTE]
If you're going to be serializing/deserializing objects from a buffer a lot, maybe you should look into marshaling. Nothing gets thrown away and you can convert a buffer into a structure/class. It's also incredibly easy to write an extension method for Stream instances where you can use [code]memStream.Read<Turn>()[/code] without needing to use a BinaryFormatter or other crap like that.
Some people say marshaling has a performance impact, but I've been using it heavily in my projects lately and it works perfectly.
A while back I spent two weeks making a space game. It turned out that it was pretty cool, so I've been working on it again for a couple of weeks
This is probably the nicest thing I've made for a while, here's some screenshot spam:
[IMG]https://i.imgur.com/AcavY6v.png[/IMG]
[IMG]https://i.imgur.com/Vo7McBC.png[/IMG]
[IMG]https://i.imgur.com/5d6Po6F.png[/IMG]
[IMG]https://i.imgur.com/TLUe4QH.png[/IMG]
[IMG]https://i.imgur.com/Hd701jd.png[/IMG]
[IMG]https://i.imgur.com/SRAhzpf.png[/IMG]
[IMG]https://i.imgur.com/I0S9TjM.png[/IMG]
[IMG]https://i.imgur.com/ZD9tlE1.png[/IMG]
I hope you like masses of pictures. This means that bad chemistry game and 2d game are in the bin, because this one is actually kind of nice looking
Still ill as fuck sadly
Implemented glTF support in my World of Warcraft model exporter for one of the model types yesterday. 2 more to go after this but I'm already quite happy with glTF as a format and hope it gets picked up by more applications!
Here's one of the largest models from the game in glTF format (~60MB download): [url=http://marlamin.com/u/dalaran_gltf_v2.zip]Download[/url]
Drag and drop the zip (or extracted folder) [url=https://gltf-viewer.donmccurdy.com/]here[/url] and wait a few moments for it to load. Again, it's a big model and might take a minute on low-end configurations.
Screenshot of model loaded in viewer:
[t]http://marlamin.com/u/glTF_Viewer_-_Google_Chrome_2017-08-07_11-54-24_744738.png[/t]
Today's work was on ship customisation, now you can put together your own custom ships with custom sized components and do battle with them which is nice
[IMG]https://i.imgur.com/3uj9W8T.png[/IMG]
The UI is currently... a tad hideous, so that's first on the list of things to be fixed!
Edit:
OK. This looks a little nicer, and while I'm not sure on the popout window thing this is at the very least 8000% more easily digestible
[IMG]https://i.imgur.com/TGTMCW4.png[/IMG]
Edit 2:
Whelp. Who loves user interfaces part 9999999
What's this sexy button over here?
[IMG]https://i.imgur.com/OwQ2jCA.png[/IMG]
Sexy beast of a button, you
[IMG]https://i.imgur.com/5FehnWu.png[/IMG]
I'm trying to cut down the amount of useless information presented to the player so you can check ship stats at a glance, while also still being able to access it easily. Who loves having far too much information to present to the user!
The actual aesthetics of the UI as such is still very ugly, but I can start to work on that once I get the functional aspects of it in place
Edit:
Apparently WAYWO is now spacegame awareness thread
Today I've been improving the ship customisation systems which has been fun, here's a video of it in action. Its now completely functional hooray!
[media]https://www.youtube.com/watch?v=bdjBvou_bBA[/media]
Condensed ship UI's have also received a helpful colouring in treatment to show the damaged components which is super helpful as well, as now you very rarely need to dip into the components window
[thumb]https://i.imgur.com/kwP2Eey.png[/thumb]
Who was the person that wrote that twitter bot that would tweet the titles of any threads that were more popular than LMAO Pics?
I've been working on a Magical Survival game for the last week with low poly procgen worlds. Still working on it but I have something to show currently:
[IMG]http://i.imgur.com/AYgxrym.gif[/IMG]
Just got details to generate on a new noise map using a Matrix4x4 list and DrawMeshInstanced to render everything. (Currently only one grass mesh hence the reason for very little grass shown).
[U][I](Older iteration testing out item drop animations)[/I][/U]
[IMG]https://glyphgame.files.wordpress.com/2017/08/dropables.gif?w=1100[/IMG]
All the models and images are [B]temporary[/B], still need an artist to help out.
Inventory/crafting/building system is working. Going to being implementing the farming system.
I've graduated from [URL="http://i.imgur.com/5QTyGQY.png"]simple data corruption[/URL] to this:
[t]http://i.imgur.com/K4d1Tml.png[/t]
I'm loading chunks in now as the camera moves, and deleting chunks as necessary. I think memory is getting fragmented, so instead of being able to bind to regions used by now-deleted chunks my allocator spawns a new one.
Beyond that, I have [I]zero[/I] fucking clue how this is happening. I got a [URL="https://youtu.be/Z4a7Rn7vE00?t=12"]video of it[/URL] when it really goes crazy :V
On the upside, I've been totally copying the hell out of how ImGui handles changing settings and program values and its working quite well. I've exposed a lot of the inner tweakable settings of my renderer, including things like MSAA toggles and sample counts (requires rebuilding the swapchain though) and simple stuff like movement speed and camera types. Its simple stuff, but compared to my previously awful attempts at rendering engines this one is starting to suck less and less every day.
[editline]10th August 2017[/editline]
oh here's something else that is fun: in debug mode, my noise generator makes really really noisy terrain like that. But in release mode, it looks like this:
[t]http://i.imgur.com/CQKqLdb.png[/t]
Settings aren't changed. No uninitialized values or other common release/debug errors so uhhh... :what:
[t]http://i.imgur.com/7VtBBHM.jpg[/t]
Turning my portal asset into a mirror and screenspace reflection (on flat surfaces :^) ) asset that works with forward rendering
I'd like to think that it's turning out well
What's the UI library everyone seems to be using? I see it here a lot but I've never seen it elsewhere.
[QUOTE=BAZ;52557756]What's the UI library everyone seems to be using? I see it here a lot but I've never seen it elsewhere.[/QUOTE]
imgui
[QUOTE=BAZ;52557756]What's the UI library everyone seems to be using? I see it here a lot but I've never seen it elsewhere.[/QUOTE]
IMGUI
[editline]s[/editline]
oh shit I was late
[QUOTE=BAZ;52557756]What's the UI library everyone seems to be using? I see it here a lot but I've never seen it elsewhere.[/QUOTE]
The one in Icedshot's post? That's Imgui ([url]https://github.com/ocornut/imgui[/url]) I believe.
edit: man i need to refresh the fucking page before posting
[QUOTE=awcmon;52557840]The one in Icedshot's post? That's Imgui ([url]https://github.com/ocornut/imgui[/url]) I believe.
edit: man i need to refresh the fucking page before posting[/QUOTE]
For the sake of accuracy, it's dear imgui in full as IMGUI is also the acronym for the design behind it (immediate gui).
Speaking of which, the dev behind it just merged the sexy color picker branch a few days ago and I decided to abuse it to implement mesh painting similiar to what Ziks did in Unity some time ago:
[t]https://puu.sh/x6y1Q/453e53087e.png[/t]
Quite pleased with how it turned out. Just added paint rate adaption to brush move speed for consistent brush strokes at any speed which is quite nice. Also thanks to Ziks for helping me work out some details with blending.
[QUOTE=JWki;52558065]For the sake of accuracy, it's dear imgui in full as IMGUI is also the acronym for the design behind it (immediate gui).
Speaking of which, the dev behind it just merged the sexy color picker branch a few days ago and I decided to abuse it to implement mesh painting similiar to what Ziks did in Unity some time ago:
[t]https://puu.sh/x6y1Q/453e53087e.png[/t]
Quite pleased with how it turned out. Just added paint rate adaption to brush move speed for consistent brush strokes at any speed which is quite nice. Also thanks to Ziks for helping me work out some details with blending.[/QUOTE]
For the sake of... not really anything really I thought i'd spell it out in giant capital letters (I'm having a break ok)
[IMG]https://i.imgur.com/JX7l6nS.png[/IMG]
On the plus side I've spent today rebalancing the economy, now components express their desired rarity and price rather than a components function expressing its price and resources needed. EG before all power generation systems shared a price, whereas now a power core and solar panel can respectively request rarity common and rarity expensive. This determines the materials composition and price!
I've also finished up most of the rest of the systems that are available. You can now build a ship that will request resources from your empire stash (while in friendly territory), itll be supplied from your backlog, and then those resources can be used to construct ships. The reverse works as well with mining devices, any excess resources will get dumped into cargo first, then your empires holds. Neat!
[QUOTE=JWki;52558065]For the sake of accuracy, it's dear imgui in full as IMGUI is also the acronym for the design behind it (immediate gui).
Speaking of which, the dev behind it just merged the sexy color picker branch a few days ago and I decided to abuse it to implement mesh painting similiar to what Ziks did in Unity some time ago:
[t]https://puu.sh/x6y1Q/453e53087e.png[/t]
Quite pleased with how it turned out. Just added paint rate adaption to brush move speed for consistent brush strokes at any speed which is quite nice. Also thanks to Ziks for helping me work out some details with blending.[/QUOTE]
Is imgui actually the GUI system behind Unity?
[QUOTE=RockyTV;52561384]Is imgui actually the GUI system behind Unity?[/QUOTE]
No, this kind of confusion is why I mentioned the full name. IMGUI is nothing but an acronym for immediate gui which is a kind of API design that stands in contrast to a retained gui.
Unity uses AN immediate GUI system that they just called IMGUI in their docs iirc, but there's many implementations of the principle - dear imgui being the most popular one atm probably.
FWIW, one of the first publications that explicitly describe the approach behind an immediate GUI is this:
[url]https://www.youtube.com/watch?v=Z1qyvQsjK5Y[/url]
It's often considered as the talk that popularized the principle althought there have been implementations of the idea before.
Expression trees in C# feel like witchcraft. I just wrote a class that dynamically generates a method for any delegate your heart could ever desire, which neatly prints out the values of all arguments passed to it.
It works so well that it's mildly unsettling. I'm expecting the CLR to start demanding sacrificial goats/virgins/kidneys any minute. Its thirst for fresh blood cannot be satiated forever.
Hooray! Window blurryness!
[IMG]https://i.imgur.com/Bbj9751.png[/IMG]
[IMG]https://i.imgur.com/gw3QoRc.png[/IMG]
It turned out to be a fairly protracted fight with ImGui/SFML to get this to work ;_;
On the plus side, one of the big issues with the UI was high frequency detail floating around in the background of the UI windows, which there was a lot of because there's asteroids absolutely everywhere. This makes the UI much more legible under normal conditions. Hooray!
Tooltip windows and popup windows (ie anything imgui) aren't yet dealt with by this system... but that's pretty tricky to solve so I may pretend it doesn't exist for the time being
[QUOTE=Icedshot;52562931]Hooray! Window blurryness!
[IMG]https://i.imgur.com/Bbj9751.png[/IMG]
[IMG]https://i.imgur.com/gw3QoRc.png[/IMG]
It turned out to be a fairly protracted fight with ImGui/SFML to get this to work ;_;
On the plus side, one of the big issues with the UI was high frequency detail floating around in the background of the UI windows, which there was a lot of because there's asteroids absolutely everywhere. This makes the UI much more legible under normal conditions. Hooray!
Tooltip windows and popup windows (ie anything imgui) aren't yet dealt with by this system... but that's pretty tricky to solve so I may pretend it doesn't exist for the time being[/QUOTE]
Nice - how did you approach it?
[QUOTE=Berkin;52562131]Expression trees in C# feel like witchcraft. I just wrote a class that dynamically generates a method for any delegate your heart could ever desire, which neatly prints out the values of all arguments passed to it.
It works so well that it's mildly unsettling. I'm expecting the CLR to start demanding sacrificial goats/virgins/kidneys any minute. Its thirst for fresh blood cannot be satiated forever.[/QUOTE]
I'm always curious about the performance of expression trees at run-time. Is it as performant as the equivalent compiled code?
I've been using Dear ImGUI for my projects aswell, and it raised my productivity considerably. It takes nearly zero effort to integrate.
[QUOTE=JWki;52562964]Nice - how did you approach it?[/QUOTE]
While waiting for the answer to this I decided to try it out myself - didn't take all too long and supports pop ups and tooltips!
[t]https://puu.sh/x7Lxm/8ec7dd6d0e.png[/t]
The kernel used for the blur is way too expensive and shitty, just wanted to try out my idea of how to make it work - I was already rendering my UI to an offscreen buffer so pretty much all I had to do was to take the main render target, blur it and add it back on top of the main image using a shader that discarded every fragment that was at the same spot as something with nonfull or nonzero alpha in the UI target before composing the UI in, et voila there we go.
Thanks for the challenge! :D
WAYWO v67 - ImGui is love, ImGui is life?
[QUOTE=JWki;52562964]Nice - how did you approach it?[/QUOTE]
[cpp]
void ImGui::DoFrosting(sf::RenderWindow& win)
{
ImGuiContext& g = *GImGui;
static sf::Shader shader;
static bool has_shader;
if(!has_shader)
{
shader.loadFromFile("gauss.fglsl", sf::Shader::Type::Fragment);
shader.setUniform("texture", sf::Shader::CurrentTexture);
has_shader = true;
}
static sf::Texture texture;
//static sf::Texture ntexture;
if(texture.getSize().x != win.getSize().x || texture.getSize().y != win.getSize().y)
{
texture.create(win.getSize().x, win.getSize().y);
texture.setSmooth(true);
//ntexture.create(win.getSize().x, win.getSize().y);
//ntexture.setSmooth(true);
}
texture.update(win);
texture.generateMipmap();
sf::RenderStates states;
states.shader = &shader;
sf::BlendMode mode(sf::BlendMode::Factor::One, sf::BlendMode::Factor::Zero);
states.blendMode = mode;
for (int i = 0; i != g.Windows.Size; i++)
{
ImGuiWindow* window = g.Windows[i];
if (window->Active && window->HiddenFrames <= 0 && (window->Flags & (ImGuiWindowFlags_ChildWindow)) == 0)
{
if(strncmp(window->Name, "Debug", strlen("Debug")) == 0)
continue;
bool skip = false;
for(auto& str : to_skip_frosting)
{
if(strncmp(window->Name, str.c_str(), strlen(str.c_str())) == 0)
{
skip = true;
break;
}
}
if(skip)
continue;
auto pos = window->Pos;
ImVec2 dim = window->Size;
sf::Sprite spr;
spr.setTexture(texture);
spr.setPosition(pos.x, pos.y);
spr.setTextureRect(sf::IntRect({pos.x, pos.y}, {dim.x, dim.y}));
auto backup_view = win.getView();
win.setView(win.getDefaultView());
win.draw(spr, states);
/*for(int kk=0; kk<5; kk++)
{
ntexture.update(win);
spr.setTexture(ntexture);
win.draw(spr, states);
}*/
win.setView(backup_view);
}
}
to_skip_frosting.clear();
ImGui::Render();
win.display();
}[/cpp]
So you just take a backup of the renderwindow, iterate through imgui windows, and then blit from the backup of the renderwindow to the real window just with the size and position of the windows, but with a blurring shader applied. ImGui windows then get drawn on top of the blurred patches
Works pretty great. Text is like 99% more legible now
[IMG]https://i.imgur.com/yARz6Fs.png[/IMG]
[QUOTE=Icedshot;52563083]WAYWO v67 - ImGui is love, ImGui is life?
[cpp]
void ImGui::DoFrosting(sf::RenderWindow& win)
{
ImGuiContext& g = *GImGui;
static sf::Shader shader;
static bool has_shader;
if(!has_shader)
{
shader.loadFromFile("gauss.fglsl", sf::Shader::Type::Fragment);
shader.setUniform("texture", sf::Shader::CurrentTexture);
has_shader = true;
}
static sf::Texture texture;
//static sf::Texture ntexture;
if(texture.getSize().x != win.getSize().x || texture.getSize().y != win.getSize().y)
{
texture.create(win.getSize().x, win.getSize().y);
texture.setSmooth(true);
//ntexture.create(win.getSize().x, win.getSize().y);
//ntexture.setSmooth(true);
}
texture.update(win);
texture.generateMipmap();
sf::RenderStates states;
states.shader = &shader;
sf::BlendMode mode(sf::BlendMode::Factor::One, sf::BlendMode::Factor::Zero);
states.blendMode = mode;
for (int i = 0; i != g.Windows.Size; i++)
{
ImGuiWindow* window = g.Windows[i];
if (window->Active && window->HiddenFrames <= 0 && (window->Flags & (ImGuiWindowFlags_ChildWindow)) == 0)
{
if(strncmp(window->Name, "Debug", strlen("Debug")) == 0)
continue;
bool skip = false;
for(auto& str : to_skip_frosting)
{
if(strncmp(window->Name, str.c_str(), strlen(str.c_str())) == 0)
{
skip = true;
break;
}
}
if(skip)
continue;
auto pos = window->Pos;
ImVec2 dim = window->Size;
sf::Sprite spr;
spr.setTexture(texture);
spr.setPosition(pos.x, pos.y);
spr.setTextureRect(sf::IntRect({pos.x, pos.y}, {dim.x, dim.y}));
auto backup_view = win.getView();
win.setView(win.getDefaultView());
win.draw(spr, states);
/*for(int kk=0; kk<5; kk++)
{
ntexture.update(win);
spr.setTexture(ntexture);
win.draw(spr, states);
}*/
win.setView(backup_view);
}
}
to_skip_frosting.clear();
ImGui::Render();
win.display();
}[/cpp]
So you just take a backup of the renderwindow, iterate through imgui windows, and then blit from the backup of the renderwindow to the real window just with the size and position of the windows, but with a blurring shader applied. ImGui windows then get drawn on top of the blurred patches
Works pretty great. Text is like 99% more legible now
[IMG]https://i.imgur.com/yARz6Fs.png[/IMG][/QUOTE]
Yeah that's pretty equivalent to my approach except I do the blit in one step and let the pixel shader decide which fragments to actually blit - guess you could even modulate the blur based on the pixel alpha value so you get stronger frosting for less transparent elements.
And yeah I guess this waywo is dominated by dear imgui.
Sorry, you need to Log In to post a reply to this thread.