[QUOTE=Fourier;49598916]I use var all the time in C#.[/QUOTE]
I do with collections and classes since it's a lot easier to write something like "var stringDict = new Dictionary<int, string>();" versus "Dictionary<int, string> stringDict = new Dictionary<int, string>();"
I use var for everything local. I accepted ReSharper as my lord and saviour.
I use var everywhere so that Code Cruncher will stop making green squigglies.
[QUOTE=Dr Magnusson;49599245]It would literally be impossible to implement the newest iteration of my Pattern library without it. I'm using it to (among other things) parse Crusader Kings 2 files, and this is one of the resulting types:
[cpp]transform<sequence<between<0,-1,Expr>,ckstr::flags,between<0,-1,Expr>,exact<61>,between<0,-1,Expr>,sequence<between<0,-1,Expr>,exact<123>,sequence<sequence<between<0,-1,Expr>,ckstr::game_start_charlemagne,between<0,-1,Expr>,exact<61>,between<0,-1,Expr>,calendardate>,sequence<between<0,-1,Expr>,ckstr::charlemagne_spain_intervention,between<0,-1,Expr>,exact<61>,between<0,-1,Expr>,calendardate>,sequence<between<0,-1,Expr>,ckstr::saxon_wars,between<0,-1,Expr>,exact<61>,between<0,-1,Expr>,calendardate>,sequence<between<0,-1,Expr>,ckstr::blood_court_of_verden,between<0,-1,Expr>,exact<61>,between<0,-1,Expr>,calendardate>,sequence<between<0,-1,Expr>,ckstr::widukind_spawned,between<0,-1,Expr>,exact<61>,between<0,-1,Expr>,calendardate>,sequence<between<0,-1,Expr>,ckstr::viking_age_started,between<0,-1,Expr>,exact<61>,between<0,-1,Expr>,calendardate>,sequence<between<0,-1,Expr>,ckstr::varangian_guard_founded,between<0,-1,Expr>,exact<61>,between<0,-1,Expr>,calendardate>,sequence<between<0,-1,Expr>,ckstr::ogier_spawned,between<0,-1,Expr>,exact<61>,between<0,-1,Expr>,calendardate>,sequence<between<0,-1,Expr>,ckstr::norse_reformation,between<0,-1,Expr>,exact<61>,between<0,-1,Expr>,calendardate>,sequence<between<0,-1,Expr>,ckstr::christian_crusades_unlocked,between<0,-1,Expr>,exact<61>,between<0,-1,Expr>,calendardate>,sequence<between<0,-1,Expr>,ckstr::muslim_jihads_unlocked,between<0,-1,Expr>,exact<61>,between<0,-1,Expr>,calendardate>,sequence<between<0,-1,Expr>,ckstr::zoroastrian_priesthood_founded,between<0,-1,Expr>,exact<61>,between<0,-1,Expr>,calendardate>,sequence<between<0,-1,Expr>,ckstr::pagan_ghws_unlocked,between<0,-1,Expr>,exact<61>,between<0,-1,Expr>,calendardate>,sequence<between<0,-1,Expr>,ckstr::irminsul,between<0,-1,Expr>,exact<61>,between<0,-1,Expr>,calendardate>,sequence<between<0,-1,Expr>,ckstr::saoshyant_appears,between<0,-1,Expr>,exact<61>,between<0,-1,Expr>,calendardate>>,between<0,-1,Expr>,exact<125>>>,flags>[/cpp]
Without auto I'd have to spell that whole thing out every time I used it :v:[/QUOTE]
Wouldn't it be more appropriate to typedef that? I mean auto is great, but if someone comes along and reads your code you'll have to make verbose variable names or comment about what your datatype actually is.
[QUOTE=Silentfood;49600996]Wouldn't it be more appropriate to typedef that? I mean auto is great, but if someone comes along and reads your code you'll have to make verbose variable names or comment about what your datatype actually is.[/QUOTE]
I've only used auto in for loops just because I'm lazy. For everything else I use typedefs.
[QUOTE=Darwin226;49597602]I haven't posted what I'm actually working on in a while.
For a class project we were assigned to write a solution to the art gallery problem.
You are given a polygon that represents a layout of the art gallery. The task is to place a minimal number of cameras so that every point in the polygon is visible from at least one of the cameras.
The problem is NP-hard so the solution can't be exact. I'm using a genetic algorithm to minimize the number of cameras.
Here's an example with a smallish polygon of a hundred vertices.
I think there was a solution with 1 or 2 less cameras found but it was setup to render only when cam % 10 == 0 for debugging.[/QUOTE]
I'm probably missing numerous posts but.. I think this is the first actual WAYWO post I've seen from you in like 5-6 years of browsing WAYWO lol. I seriously saw that there were images in this post, then noticed your avatar to the side and thought "no way..". What level of schooling are you in?
I got a bit demotivated with my funky visual scripting thing due to a performance issue. I rendered each letter of text as an individual texture, and that obviously killed the framerate due to too many CPU calls. Now I'm just rendering a whole node into a texture instead. The performance gain blows my mind.
You should render each glyph as a UV square in a larger texture, and render the nodes themselves in a framebuffer.
Although regardless of whether or not you render it to an FB, it shouldnt kill performance that much.
[QUOTE=Map in a box;49601885]You should render each glyph as a UV square in a larger texture, and render the nodes themselves in a framebuffer.
Although regardless of whether or not you render it to an FB, it shouldnt kill performance that much.[/QUOTE]
Well, now I just render each glyph into a big texture together with the node background. Works just fine.
[editline]25th January 2016[/editline]
[QUOTE=Map in a box;49601885]You should render each glyph as a UV square in a larger texture, and render the nodes themselves in a framebuffer.
Although regardless of whether or not you render it to an FB, it shouldnt kill performance that much.[/QUOTE]
Oh, also did I mention I'm using pyopengl? I think that is a major contributing factor in killing the performance.
for C++, what do you guys like to do/think is better?
i dunno what to call this thing so ill just give examples
[img]https://facepunch.com/fp/ratings/information.png[/img] for
[code]
namespace ResourceManager
{
//Store variables and functions here
std::map<std::string, Shader> Shaders;
void LoadShader(std::string);
}
[/code]
[img]https://facepunch.com/fp/ratings/heart.png[/img] for
[code]
class ResourceManager
{
public:
//Store variables and functions here
static std::map<std::string, Shader> Shaders;
static void LoadShader(std::string);
};
[/code]
or [img]https://facepunch.com/fp/ratings/wrench.png[/img] for something else
edit:
are there even any real differences between the two?
the only thing I can think of is that you can add to the namespace in different files if you need to
[QUOTE=awcmon;49602021]for C++, what do you guys like to do/think is better?
i dunno what to call this thing so ill just give examples
[img]https://facepunch.com/fp/ratings/information.png[/img] for
[code]
namespace ResourceManager
{
//Store variables and functions here
std::map<std::string, Shader> Shaders;
void LoadShader(std::string);
}
[/code]
[img]https://facepunch.com/fp/ratings/heart.png[/img] for
[code]
class ResourceManager
{
public:
//Store variables and functions here
std::map<std::string, Shader> Shaders;
void LoadShader(std::string);
};
[/code]
or [img]https://facepunch.com/fp/ratings/wrench.png[/img] for something else[/QUOTE]
Without context of what you're trying to do I don't think I can give you a qualified answer.
[QUOTE=DrDevil;49602050]Without context of what you're trying to do I don't think I can give you a qualified answer.[/QUOTE]
i was looking for a general answer/opinion, if any exists
but I'm kinda looking at something like the above for stuff like
mouse and keyboard input
renderer that i can use to draw sprites and shit
resource manager
etc
the way I used to do it when i first started was I would have a class called Mouse or something, instantiate one when the program started and then get mouse inputs from there and whatnot. it's really messy
this is kinda what my stuff used to look like
[code]
AMouse mouse;
int main()
{
AInputEvent input;
mouse.setInputEvent(&input);
bool quit = false;
while (!quit)
{
mouse.think();
if (mouse.m1isDown)
{
quit = true;
}
}
}
[/code]
not a good solution at all as you can see
edit: also no idea why mouse is declared outside of main in that code. i just looked at one of my old projects and it just was. i think there was a reason, but I forgot
edit: nvm i remembered, i had mouse extern'd to other files
edit: dont judge me please i felt bad for it even then
edit: I HAD A BUSY SCHEDULE, OK?
[QUOTE=awcmon;49602021]for C++, what do you guys like to do/think is better?
i dunno what to call this thing so ill just give examples
[/code]
or [img]https://facepunch.com/fp/ratings/wrench.png[/img] for something else
edit:
are there even any real differences between the two?
the only thing I can think of is that you can add to the namespace in different files if you need to[/QUOTE]
For a global singleton, a class is sufficient. You really don't want to be trying to handle get/set operations for static variable data if you're planning to use headers. If you're writing a namespace for a collection of routines that relate but don't plan to allow the developer to interface directly with the variable data, then I'd pick a namespace.
I use a collection of the two sometimes. call the cops?
[code]
namespace NETTIK
{
class ApplicationSingleton
{
private:
static std::string m_sApplicationName;
static uint32_t m_iApplicationId;
public:
//! Initialize the application proxy program (game executable and Steam ID).
static void Initialize(
const std::string appExe,
const uint32_t appId
);
//! Returns the game EXE file.
static const std::string GetGameExe();
//! Returns the game Steam ID.
static const uint32_t GetGameId();
//! Returns the game directory if the game file exists, NULL if otherwise.
static const std::string GetGameDirectory();
};
//! Assists in returning or manipulating Windows applications.
namespace ApplicationHelper
{
//! Creates a system message box on the current process handle.
void ShowMessageOK(const char* fmt, ...);
//! Centers the hWnd argument to the middle of the screen it is rendering on.
void CenterWindowHandle(HWND hWnd);
//! Returns a HWND from a process PID.
HWND GetHWNDFromPid(unsigned int pid);
}
}
[/code]
-- content
I added some lerp onto actor sync on my mod because it looked like ass before because of the packet intervals. Been rewriting most of the network library too, Fraps doesn't like to capture my overlay but I added
some debug information.
[t]http://i.imgur.com/CEH6A8I.jpg[/t]
[media]https://www.youtube.com/watch?v=g-PT-DqPcC4[/media]
[QUOTE=awcmon;49602021]
are there even any real differences between the two?[/QUOTE]
No real difference, although I'm not a fan of storing variables like that in a namespace, but that's just preference. I'd go with the class-variant.
Also, unless you really need those shaders sorted by name, I highly recommend using an [URL=http://stackoverflow.com/a/13799738]unordered_map[/URL] instead, it's faster and more efficient in almost all cases.
[QUOTE=DrDevil;49601916]Well, now I just render each glyph into a big texture together with the node background. Works just fine.
[editline]25th January 2016[/editline]
Oh, also did I mention I'm using pyopengl? I think that is a major contributing factor in killing the performance.[/QUOTE]
python itself will kill your performance because, well, python.
You're limiting yourself if you're rendering only the nodes to a texture, what if you want dynamically changing node text and whatnot?
[QUOTE=awcmon;49602055]the way I used to do it when i first started was I would have a class called Mouse or something, instantiate one when the program started and then get mouse inputs from there and whatnot. it's really messy
[/QUOTE]
That's how i would have kept it. You probably have to initialize these static classes anyway, doesn't matter if you have to instance+initialize them, but you get improved flexibility.
Like should those classes really be static? Will you never have more then 1 instance? 1 type? You might not right now, but you'll box yourself in by opting to make it static.
And even so your dealing with the same arguments as people have against globals you further complicated dependencies, multi-threading, testability.
Globals/Pure-static-classes like this are normally minimally used, and generally reserved to something that should actually be accessable at all times doesn't have an owner like logging and other debugging tools.
[t]http://i.imgur.com/zhWJR0j.png[/t]
i made a basic dialog/cutscene system for my shitty mspaint game. i also implemented the A* algorithm for all my NPC needs
all hail mspaint
[QUOTE=srobins;49601089]I'm probably missing numerous posts but.. I think this is the first actual WAYWO post I've seen from you in like 5-6 years of browsing WAYWO lol. I seriously saw that there were images in this post, then noticed your avatar to the side and thought "no way..". What level of schooling are you in?[/QUOTE]
I got a bachelors in mathematics the last summer. Now working on a masters in CS.
I've posted a lot of visual stuff before when I worked on my graphics engine and game projects.
The last 3-4 years I've mostly done things that most wouldn't find interesting so I don't really post that much about what I'm working on. I just annoy people with my rants.
I do still write code every day. Occasionally I do a post like the one above to see if it's something WAYWOers would find interesting. Then maybe do a few follow ups if they do.
Thanks for taking an interest, though!
[QUOTE=false prophet;49595471]I've been reading a lot of code that uses C++'s auto keyword. If I understand it right, it's a very lazy way to not have to write out a variable or functions type. So it should try to guess the typedef, right? Like from previous definitions? Or something.[/QUOTE]
I just want to point out that auto is in no way guessing the type.
When you use auto you must assign it a value when declaring the variable, and all it really does is make the variable the same type as the value you're assigning to it.
[QUOTE=Map in a box;49602178]python itself will kill your performance because, well, python.
You're limiting yourself if you're rendering only the nodes to a texture, what if you want dynamically changing node text and whatnot?[/QUOTE]
I redraw the whole node.
Okay, I have a weird question:
I want to replicate lag in my singleplayer game. Input lag. Similar to some old multiplayer games which had no clientside prediction.
How can I accomplish that? Should I just store all my input in an array of commands and then read from those with a delay?
[QUOTE=cam64DD;49603700]Okay, I have a weird question:
I want to replicate lag in my singleplayer game. Input lag. Similar to some old multiplayer games which had no clientside prediction.
How can I accomplish that? Should I just store all my input in an array of commands and then read from those with a delay?[/QUOTE]
Setup an event queue with timestamps, from there you can feed them to the engine whenever you feel like.
[QUOTE=Darwin226;49602968]I got a bachelors in mathematics the last summer. Now working on a masters in CS.
I've posted a lot of visual stuff before when I worked on my graphics engine and game projects.
The last 3-4 years I've mostly done things that most wouldn't find interesting so I don't really post that much about what I'm working on. I just annoy people with my rants.
I do still write code every day. Occasionally I do a post like the one above to see if it's something WAYWOers would find interesting. Then maybe do a few follow ups if they do.
Thanks for taking an interest, though![/QUOTE]
Dunno man, it always interests me what you post, it's just that sometimes I don't understand it.
Don't worry man. I don't get it either half of the time.
Played online with some of the GMs today.
[media]https://www.youtube.com/watch?v=8erbw3LTIYo[/media]
Interpolation's a bit fucked but it's getting there.
Been trying to do this alongside my university work and finding placements, so it's been neglected for the past month as I try and get a job. The server code needs a rework and we need a new place to test cause that area's getting really boring. Planning to do an open test near the end of this week, so that should be fun.
So I'm going to try to explain this/rant this out for the sake of my own learning, let me know if it doest make sense cus then I'm clearly not learning-
[QUOTE]
So the whole deal with plasma physics right now is that most stuff is all based on modelling and simulation. It's how we managed to bring the Stellerator design back, for example. And most models are actually within a few % of the experimental values found later.
The greatest difficulty in this problem comes from its complexity, as the core algorithms perform 10^4 time steps of highly complex functions. The size of these steps varies as well, since different phenomena occur at different intervals. Some occur at 10^-6 seconds after fusion reaction, for example, and plenty fall in a middle range. The function itself is a 5-d function accounting for 5 variables of 3 different species (I believe Deuterium, Tritium, and Lithium-6). Sometimes it includes part of the whole 6-d Phase space thing, Phase space is effectively a graph or system of the probability of a particle being at a given coordinate. It's six dimensional as it considers the 3 spatial dimensions for position AND momentum.
The Cray Xt-3 cluster has actually been used to simulate a ton of stuff for ITER. It took 1.5hrs to run a fairly fancy simulation, but that's with 4096 processors and probably code that's a bit better than what I can do. It seems the best way to optimize is to only simulate small volumetric chunks of the overall torus, as this only adds a tiny amount of inaccuracy. Apparently people are starting to cut out the small timescales too, since we've fixed the problems occurring at this timescale. The key seems to be running the function, THEN using linear operators to compute the stability of the solution (if one is found).[/QUOTE]
Quoted to save space and hide it away a bit. I've been busy writing articles for music production stuff and studying for my engineering statics exam, but most of my spare time has been spent reading up on plasma physics. It's a super cool field, and I've dreamt of being able to understand fusion stuff since I was little (I was such a fucking nerd holy shit). Having the ability to study it now and the possibility of working in a lab is just too much, and scientific computing is toooooons of fun.
Coding homework is so much better than regular homework, too. Is it okay to post code snippets here? Nothing I work on is as cool as some of the posts here, and most of it is just tons of math. Right now I've been working in using steepest-descent algorithms to compute orbital motion stuff for the three-body problem, and that's output some neat visualizations! I'm wondering if I could step it up by adding a few more bodies then using genetic algorithms to test the most efficient route, but then I think I have to test in a time domain considering the orbital motion of the various bodies and I'm not sure how to quantify the max Delta-V allowed.
Yeah dude post it now!
[QUOTE=paindoc;49605051]So I'm going to try to explain this/rant this out for the sake of my own learning, let me know if it doest make sense cus then I'm clearly not learning-
Quoted to save space and hide it away a bit. I've been busy writing articles for music production stuff and studying for my engineering statics exam, but most of my spare time has been spent reading up on plasma physics. It's a super cool field, and I've dreamt of being able to understand fusion stuff since I was little (I was such a fucking nerd holy shit). Having the ability to study it now and the possibility of working in a lab is just too much, and scientific computing is toooooons of fun.
Coding homework is so much better than regular homework, too. Is it okay to post code snippets here? Nothing I work on is as cool as some of the posts here, and most of it is just tons of math. Right now I've been working in using steepest-descent algorithms to compute orbital motion stuff for the three-body problem, and that's output some neat visualizations! I'm wondering if I could step it up by adding a few more bodies then using genetic algorithms to test the most efficient route, but then I think I have to test in a time domain considering the orbital motion of the various bodies and I'm not sure how to quantify the max Delta-V allowed.[/QUOTE]
I forgot to say this on your last post but don't feel to pressured to learn OOP.
You seem to be more interested in scientific applications of programming and those rarely consist of architecturally complex systems.
I seriously doubt you'll find someone dumping an OOP heavy project on you in that field of study.
I had a great idea last night while falling asleep, and planned on programming it today when I woke.
The idea was to represent 3-dimensional objects using triangular faces and connected vertexes.
*sigh* oh well I'm sure someone got rich off of it
Hey guys,
So after 4 months of work, I have finally submitted my first game on Greenlight:
[URL="http://steamcommunity.com/sharedfiles/filedetails/?id=608460285"]http://steamcommunity.com/sharedfiles/filedetails/?id=608460285[/URL]
I know it does not have a lot of content by any stretch of the imagination, but my game design professor really pushed me to get it out in the open. If I had my way this game would never have seen the light of day for at least several years. Its probably better this way, really. This game was made solely by 2 programmers, neither of which are qualified artists by any means, which is the main reason content is so scarce.
Anyways, I would greatly appreciate you guys leaving your honest opinions (and votes), and if you like it, please share!
Sorry, you need to Log In to post a reply to this thread.