VizionEck

Off-Topic => Off-Topic Community => Topic started by: the-pi-guy on Mar 13, 2016, 10:39 PM

Title: Programming Thread
Post by: the-pi-guy on Mar 13, 2016, 10:39 PM
I love programming, and I know a handful of people here also enjoy programming (or at least they do it), so why not have a thread for it?  



C++ will kill me.  
Title: Re: Programming Thread
Post by: kitler53 on Mar 13, 2016, 10:47 PM
what languages does everyone know?

i learned on c and basic but my work mostly uses c# which i spent some time getting acquainted with but i don't really know it. 
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 13, 2016, 10:52 PM
-Decent at Java
-Learning C++
-Probably doesn't count, but "TI-BASIC" it's for calculators.  :P
Title: Re: Programming Thread
Post by: Legend on Mar 13, 2016, 10:56 PM
I use PHP, Javascript, C#, and Cg/HLSL on a regular basis. 100% self taught with these so I only know what I've needed to use.

Took classes involving Python, C++, matlab, and excel's stuff but saying I'm rusty would oversell my abilities.
Title: Re: Programming Thread
Post by: darkknightkryta on Mar 14, 2016, 01:31 PM
I love programming, and I know a handful of people here also enjoy programming (or at least they do it), so why not have a thread for it?  



C++ will kill me.  

As I say to my students: "Be kind to C and C will be kind to you."
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 24, 2016, 03:57 AM
Testing code:
*list works, adds in for loop*
*stops working*
*takes out loop*
*works*
*puts loop back in*
*stops working*
*takes out loop*
*works*
*puts loop back in*
*works*

I'm not sure what happened, but it works!  
Title: Re: Programming Thread
Post by: ethomaz on Mar 24, 2016, 05:15 PM
Right now I'm planning to create a Pilates Manegement System for my girlfriend in PHP (just because she can access from any device via Internet).

:)
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 28, 2016, 03:34 AM
If anyone has C++ knowledge, I'd like some help.  

I'm getting an error that says "does not define this operator or a conversion", but I have defined the operator, and Visual Studio even takes me to the operator when I ask for it.  

Figured it out.  
It likes it this ++way, and not this way++.  
Title: Re: Programming Thread
Post by: Legend on Mar 28, 2016, 04:21 AM
What's the difference between c++ and c#?

++way seems foreign to me.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 28, 2016, 04:32 AM
What's the difference between c++ and c#?
Haven't used C#, but from what I've seen it looks a lot like Java.

Some random person says this:
Quote
C# and Java discard C for C++. They take C++, throw away the pointer notation, and all variables become hidden pointers (except for the value types, primitive types, due to performance reasons). They add forcibly garbage collection, metadata to your classes, all the objects will be derived from a base class, called object or Object, which adds automatically virtual methods to objects, and they never compile to native code
++way seems foreign to me.
Same.  :P
I spent like half an hour, only to find the fix is putting it on the other side.  
I pretty much always write it like foo++, but this apparently needed to be written ++foo.  Not exactly sure why.  
Title: Re: Programming Thread
Post by: darkknightkryta on Mar 28, 2016, 01:04 PM
Haven't used C#, but from what I've seen it looks a lot like Java.

Some random person says this:Same.  :P
I spent like half an hour, only to find the fix is putting it on the other side.  
I pretty much always write it like foo++, but this apparently needed to be written ++foo.  Not exactly sure why.  
The ++var notation needing to be necessary seems very weird.
Title: Re: Programming Thread
Post by: ethomaz on Mar 28, 2016, 04:16 PM
Haven't used C#, but from what I've seen it looks a lot like Java.

Some random person says this:Same.  :P
I spent like half an hour, only to find the fix is putting it on the other side. 
I pretty much always write it like foo++, but this apparently needed to be written ++foo.  Not exactly sure why. 
There are differences.

++var add first and return the val after

var++ return the val first and add after

Eg.

a = 1
b = ++a 
// result b = 2 ; a = 2

a = 1
b = a++
// result b = 1; a = 2

It is weird but that is what happen in most modern languages.

And the languages are dropping this ++ -- notation... this sintax will be deprecated soon.

Edit - A good explanation why modern languages are dropping ++ --

https://github.com/apple/swift-evolution/blob/master/proposals/0004-remove-pre-post-inc-decrement.md

Swift 2.0 didn't compile with ++ or -- code anymore.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 28, 2016, 04:20 PM
There are differences.
Yep I know all about the differences.  I just tend to try to make it work with foo++;
But in this case, it wasn't working at all with foo++;
Saying the operator wasn't defined for the class, even though it clearly was.  
Title: Re: Programming Thread
Post by: ethomaz on Mar 28, 2016, 04:22 PM
Yep I know all about the differences.  I just tend to try to make it work with foo++;
But in this case, it wasn't working at all with foo++;
Saying the operator wasn't defined for the class, even though it clearly was. 
I like them... how the code looks with these operators but there are movement in the dev scheme to drop them from all languages.

I'm not using them anymore just for the sake to don't need to review my code in the future.
Title: Re: Programming Thread
Post by: Legend on Mar 28, 2016, 04:41 PM
I like them... how the code looks with these operators but there are movement in the dev scheme to drop them from all languages.

I'm not using them anymore just for the sake to don't need to review my code in the future.
So instead they want us to write out foo+=foo?
Title: Re: Programming Thread
Post by: ethomaz on Mar 28, 2016, 04:46 PM
So instead they want us to write out foo+=foo?
:P

foo += 1

To increase 1.

foo += foo will increase the foo value to foo.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 28, 2016, 04:47 PM
So instead they want us to write out foo+=foo?
foo = foo + goo;
Title: Re: Programming Thread
Post by: Legend on Mar 28, 2016, 04:57 PM
:P

foo += 1

To increase 1.

foo += foo will increase the foo value to foo.
Oh yeah duh...  :P


foo++ is so much nicer though
Title: Re: Programming Thread
Post by: kitler53 on Mar 28, 2016, 05:07 PM
https://www.kickstarter.com/projects/primotoys/cubetto-hands-on-coding-for-girls-and-boys-aged-3

Title: Re: Programming Thread
Post by: darkknightkryta on Mar 28, 2016, 08:18 PM
Yea I saw that.  We need more of that.
Title: Re: Programming Thread
Post by: Legend on Apr 01, 2016, 09:34 PM
I froze my computer the other day.  ::)

Tried procedurally generating an 8K texture when my program already had issues at 256*256.
Title: Re: Programming Thread
Post by: ethomaz on Apr 01, 2016, 10:16 PM
I froze my computer the other day.  ::)

Tried procedurally generating an 8K texture when my program already had issues at 256*256.

Vizioneck sub 256p confirmed.
Title: Re: Programming Thread
Post by: Xbro on Apr 02, 2016, 03:12 PM
Anyone here know Ruby?
Title: Re: Programming Thread
Post by: Legend on Apr 02, 2016, 03:17 PM
Anyone here know Ruby?
Nope.
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 02, 2016, 04:45 PM
No, but why?

On another note, I'm really liking C++, even though some things are a bit bleh.  
Title: Re: Programming Thread
Post by: Legend on Apr 02, 2016, 04:49 PM
Urgh, I'm going to have to learn multithreading. Most Unity games are CPU bottlenecked, and VizionEck's no different.


Also I have a memory leak. Optimizing is fun!
Title: Re: Programming Thread
Post by: ethomaz on Apr 02, 2016, 10:05 PM
Anyone here know Ruby?
Just what I learned on university... Ruby is one of most OO languages.
Title: Re: Programming Thread
Post by: Xbro on Apr 03, 2016, 03:03 AM
Just what I learned on university... Ruby is one of most OO languages.
Well would you happen to know how to send a Get request to a site with custom headers and retrieve the response?
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 03, 2016, 03:52 AM
I'm implementing multithreading into my searching program.  :)
Title: Re: Programming Thread
Post by: Legend on Apr 03, 2016, 05:15 AM
I'm implementing multithreading into my searching program.  :)
What does it search for?
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 03, 2016, 05:55 AM
What does it search for?
Nothing too exciting.  
It checks a webpage for the number of occurrences of a string is all.

For example, I could search vizioneck.com/forums./index.php?topic=5000
For all occurrences of "Pi".

Or even all the pages of a thread here.  

I used it once to count how many posts you made in the million thread.
Title: Re: Programming Thread
Post by: Legend on Apr 03, 2016, 06:06 AM
Nothing too exciting.  
It checks a webpage for the number of occurrences of a string is all.

For example, I could search vizioneck.com/forums./index.php?topic=5000
For all occurrences of "Pi".

Or even all the pages of a thread here.  

I used it once to count how many posts you made in the million thread.
That's cool.

Title: Re: Programming Thread
Post by: the-pi-guy on Apr 03, 2016, 06:17 AM
That's cool.


If you say so. :)
Title: Re: Programming Thread
Post by: ethomaz on Apr 03, 2016, 04:57 PM
Well would you happen to know how to send a Get request to a site with custom headers and retrieve the response?
Not that depth.

We just had a overview of the language sintax.
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 04, 2016, 12:03 AM
For some reason, I'm having issues with C++.

Defining something in the .h file works perfectly.  Defining it in the cpp file stops working.  
Title: Re: Programming Thread
Post by: ethomaz on Apr 04, 2016, 12:39 AM
For some reason, I'm having issues with C++.

Defining something in the .h file works perfectly.  Defining it in the cpp file stops working. 
I don't get at all what you are saying... in easy terms I use:

myclass.hpp // declaration of my class
myclass.cpp // my class body code with #include "myclass.hpp"
main.cpp // my main programs with #include "myclass.hpp"

I can use myclass in main.cpp fine doing this way.
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 04, 2016, 12:47 AM

For some reason, when I moved the constructor/destructor to the .h file, it started working.  But the other methods still do not. 
Title: Re: Programming Thread
Post by: the-pi-guy on Nov 03, 2016, 07:39 PM
Bump. 

Programming is too much fun to not have this thread for it.  lol

These 2 code segments look the same, but for some reason one is working.  And the other is not. 

Nope, it seems even weirder, it's working with some inputs but not others. 
Title: Re: Programming Thread
Post by: darkknightkryta on Nov 03, 2016, 08:02 PM
For some reason, when I moved the constructor/destructor to the .h file, it started working.  But the other methods still do not.  
I was having issues with this too with regular C.  I had to end up just doing all definitions in the H file.  I can't remember how to not do it that way.

Almost done making solutions to my student's assignments.
Title: Re: Programming Thread
Post by: Legend on Nov 03, 2016, 08:05 PM
A few weeks ago I copied some shader code and it had compile errors. Turns out I needed to retype a section of it myself since the webpage screwed up the characters even though they looked correct.
Title: Re: Programming Thread
Post by: the-pi-guy on Nov 03, 2016, 08:17 PM
I really don't like a lot of the Visual Studio errors. 

When I program in Java using eclipse, an error like "Expect ';' here.  Now it works. 

Right now, I'm getting an error that says "cannot open (insert file name) for writing"

What does this even mean?
This is like the 20th time for me to run the program, and only now it stops working. 

----------
Started working again after restarting my computer... 
Title: Re: Programming Thread
Post by: the-pi-guy on Nov 03, 2016, 10:26 PM
(http://imgs.xkcd.com/comics/wisdom_of_the_ancients.png)
Title: Re: Programming Thread
Post by: Legend on Nov 03, 2016, 10:46 PM
(http://imgs.xkcd.com/comics/wisdom_of_the_ancients.png)
I hate/love it when I have a problem and there aren't any results on google, so I just kinda give up and work on something else. Then later on I get back to it and find a ton of results on google, only to realise it's been over a year since I first tried it.
Title: Re: Programming Thread
Post by: the-pi-guy on Jan 20, 2017, 11:32 PM
Been working on a project every so often, the past few days.
Basically I made a text file that contains the unicodes for Japanese characters (at least hiragana and katakana).
The text file was supposed to make it easy for expansion, so I could start adding Kanji characters very easily.  

Been having troubles implementing this in Java.  Was reading up about better ways to implement the text file reader.  I was having issues, because the IDE that I'm using wasn't able to show the characters, so without implementing something, there was no way to find out if the program was working.  
So I implemented a little drawing interface, and found a really easy way to make the character importer worked (a few days after I started....)  Would have been nice to find out about that earlier.  
Then I was able to quickly make a thing that would convert the hexadecimal to the characters they needed to be.  
So the character importer is now working!  
Title: Re: Programming Thread
Post by: Legend on Jan 21, 2017, 12:52 AM
Been working on a project every so often, the past few days.
Basically I made a text file that contains the unicodes for Japanese characters (at least hiragana and katakana).
The text file was supposed to make it easy for expansion, so I could start adding Kanji characters very easily.  

Been having troubles implementing this in Java.  Was reading up about better ways to implement the text file reader.  I was having issues, because the IDE that I'm using wasn't able to show the characters, so without implementing something, there was no way to find out if the program was working.  
So I implemented a little drawing interface, and found a really easy way to make the character importer worked (a few days after I started....)  Would have been nice to find out about that earlier.  
Then I was able to quickly make a thing that would convert the hexadecimal to the characters they needed to be.  
So the character importer is now working!  
What's your end goal?

I use monodevelop with Unity and so far it has every foreign character. Can also change its font if you need support for something specific.


When you mention hexadecimal, are you talking about Unicode encoding? Like 6F22 being the code for 漢?
Title: Re: Programming Thread
Post by: the-pi-guy on Jan 21, 2017, 05:26 AM
What's your end goal?
Make some sort of vocabulary game.  
Either flashcards or make one of those falling word games.  I'm not sure exactly yet.  

I use monodevelop with Unity and so far it has every foreign character. Can also change its font if you need support for something specific.
The IDE itself utilizes unicode, but it doesn't output in the console part of it.  
System.out.println( "漢");
Would work fine, but it would output a "?"

When you mention hexadecimal, are you talking about Unicode encoding? Like 6F22 being the code for 漢?
Yeah, unicode encoding.
In java, you have to do it like \u6F22, but it wasn't working through the text file.  
But there's an easy way to just cast it into a character.  (char)6F22
Except I had to change to decimal, because the integer parser worked only for decimal.  
Title: Re: Programming Thread
Post by: Legend on Jan 21, 2017, 07:21 AM
The IDE itself utilizes unicode, but it doesn't output in the console part of it.  
System.out.println( "漢");
Would work fine, but it would output a "?"
Did the ? look like this REMOVED or � ? (I have no idea what that will look like to you) In my experience the problem is that the font doesn't support that character.

Yeah, unicode encoding.
In java, you have to do it like \u6F22, but it wasn't working through the text file.  
But there's an easy way to just cast it into a character.  (char)6F22
Except I had to change to decimal, because the integer parser worked only for decimal.  
Clever solution. ;D  I was doing some testing a long while back and came up with such a convoluted mess to get the job done. I'd be embarrassed having to show my code to others.


EDT: had to remove the first symbol. It confused the forum and erased the rest of my post.
Title: Re: Programming Thread
Post by: the-pi-guy on Jan 21, 2017, 12:57 PM
Did the ? look like this REMOVED or � ? (I have no idea what that will look like to you) In my experience the problem is that the font doesn't support that character.
It is literally just the ? mark.  
Might have been that something wasn't working quite right or that there's a setting that needed to be changed in eclipse.  Not exactly sure, I tried messing with a few.

Clever solution. ;D
Thanks!  
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 03, 2017, 01:08 AM
We are using Python for my Artificial Intelligence class.  
Did a little over view the past 2 class periods of python.  
It's kind of ludicrous.  

No semicolons, use indentation instead of braces for things.
Loosely typed madness.

Declare two variables like this:
x,y=50,100

Swap statement:
x,y=y,x

return a,b,c

def method(a,b=10,c=12)

call the method in any of these ways:
method(c = 15, a=16)
method(12, b=15,c=17)
method(c=12,b=12,a=7)
Title: Re: Programming Thread
Post by: Legend on Feb 03, 2017, 02:13 AM
We are using Python for my Artificial Intelligence class.  
Did a little over view the past 2 class periods of python.  
It's kind of ludicrous.  

No semicolons, use indentation instead of braces for things.
Loosely typed madness.

Declare two variables like this:
x,y=50,100

Swap statement:
x,y=y,x

return a,b,c

def method(a,b=10,c=12)

call the method in any of these ways:
method(c = 15, a=16)
method(12, b=15,c=17)
method(c=12,b=12,a=7)

I used python a few times in college. Their method system is something I liked a lot  ::)
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 03, 2017, 01:58 PM
I used python a few times in college. Their method system is something I liked a lot  ::)
The language is like mystical.  A lot of features that seem like bad ideas in other languages.  
Totally different from Java, C++.  
Title: Re: Programming Thread
Post by: Xevross on Feb 03, 2017, 10:17 PM
My tutors said we used python because it's clear and tidy
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 15, 2017, 04:30 PM
My tutors said we used python because it's clear and tidy
It is.  

P = "hello world"
Print(P)


Java:
String P= "hello world";
System.out.print(P);
Title: Re: Programming Thread
Post by: Xevross on Feb 15, 2017, 05:42 PM
It is.  

P = "hello world"
Print(P)


Java:
String P= "hello world";
System.out.print(P);
Yeah when I used it for our project it was super easy to pick up different concepts and use them. I'm quite happy with it.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 25, 2017, 10:42 PM
Programming Languages Influence Network | Exploring Data (https://exploringdata.github.io/vis/programming-languages-influence-network/)
Title: Re: Programming Thread
Post by: darkknightkryta on Mar 26, 2017, 12:28 AM
I wanted to use Python to teach, but the lack of braces and semi colons put me off.  I don't want my students coding like bedsprings.  I want them to get gud, so I'm teaching them Java.  I'm actually contemplating teaching them C next year.
Title: Re: Programming Thread
Post by: the-pi-guy on May 12, 2017, 02:07 PM
I am starting to really hate python.  

Code that I haven't touched in the past 8 runs of my program just randomly decided that the spacings were wrong.  
Title: Re: Programming Thread
Post by: darkknightkryta on May 12, 2017, 04:01 PM
I am starting to really hate python.  

Code that I haven't touched in the past 8 runs of my program just randomly decided that the spacings were wrong.  
I don't like Python's structure.  It's why I'm not really teaching with it.
Title: Re: Programming Thread
Post by: Legend on May 14, 2017, 01:09 AM
I made a time tracker for Unity. Now I can know every 10-millisecond I spend working.

Time to track my non-productivity!
Title: Re: Programming Thread
Post by: the-pi-guy on May 14, 2017, 03:21 AM
(https://pics.me.me/using-git-to-distribute-and-manage-code-using-google-docs-19973310.png)
Title: Re: Programming Thread
Post by: Legend on May 15, 2017, 12:25 AM
(https://forum.unity3d.com/attachments/image-jpg.107559/)
Title: Re: Programming Thread
Post by: darkknightkryta on May 15, 2017, 12:35 AM
I think I have to learn php...
Title: Re: Programming Thread
Post by: Legend on May 15, 2017, 01:19 AM
I think I have to learn php...
I Like php.

I Write it in a text editor.
Title: Re: Programming Thread
Post by: darkknightkryta on May 15, 2017, 01:43 AM
I Like php.

I Write it in a text editor.
I forgot to mention sql.
Title: Re: Programming Thread
Post by: Legend on May 15, 2017, 02:22 AM
I forgot to mention sql.
I Like sql.

THe forum software handles the integration part so I can't help with that, but I do a lot of queries myself.
Title: Re: Programming Thread
Post by: the-pi-guy on May 15, 2017, 02:33 AM
(http://i.imgur.com/ojUc2Ui.png)

https://www.reddit.com/r/rails/comments/6b2zlw/are_trains_still_running_in_maltby_rotherham_uk/
Title: Re: Programming Thread
Post by: Legend on May 15, 2017, 02:37 PM
(http://i.imgur.com/ZCqw2oL.jpg)
Title: Re: Programming Thread
Post by: the-pi-guy on May 15, 2017, 03:50 PM
I really don't like those brackets though.  

If coding doesn't work, apply algorithms.  
If algorithms don't work, make some code.  
If you're dealing with the halting problem, you're dead.  
Title: Re: Programming Thread
Post by: darkknightkryta on May 16, 2017, 12:52 PM
I Like sql.

THe forum software handles the integration part so I can't help with that, but I do a lot of queries myself.
I was introduced into a web based teaching tool.  It lays out units and lessons as if they were RPG battles.  So you complete a lesson, you gain experience.  I wanted to program my own.  Which is why I think I need to learn php and SQL.
Title: Re: Programming Thread
Post by: Legend on May 16, 2017, 02:20 PM
I was introduced into a web based teaching tool.  It lays out units and lessons as if they were RPG battles.  So you complete a lesson, you gain experience.  I wanted to program my own.  Which is why I think I need to learn php and SQL.
Making the lessons may be harder but overall sounds easy. Php and sql would be perfect for that.
Title: Re: Programming Thread
Post by: darkknightkryta on May 16, 2017, 03:19 PM
Making the lessons may be harder but overall sounds easy. Php and sql would be perfect for that.
I have the lessons done.  It's more of creating a way to upload the files, create a "user" in SQL with specific data, creating a json or xml generator to use to create webpages, etc.
Title: Re: Programming Thread
Post by: Legend on May 16, 2017, 03:32 PM
I have the lessons done.  It's more of creating a way to upload the files, create a "user" in SQL with specific data, creating a json or xml generator to use to create webpages, etc.
PHp creates webpages directly? Use echo.
Title: Re: Programming Thread
Post by: the-pi-guy on May 16, 2017, 05:43 PM
I messed up my search engine.  :P
Breaks if you try searching a word that isn't in any of the documents. 
Would have been nice if I tried that before turning it in....
Title: Re: Programming Thread
Post by: DerNebel on May 16, 2017, 05:46 PM
Any of you guys know ABAP?
Title: Re: Programming Thread
Post by: Legend on May 16, 2017, 06:06 PM
Any of you guys know ABAP?
Nope. Never heard of it even.

Are you needing to learn it?
Title: Re: Programming Thread
Post by: DerNebel on May 16, 2017, 06:26 PM
Nope. Never heard of it even.

Are you needing to learn it?
Yeah, I just got out of a 5 day training session as part of my work traininig, now I knoe the basics at least.

It's the programing language used in SAP, not all that sexy honestly,  ;D
Title: Re: Programming Thread
Post by: darkknightkryta on May 16, 2017, 11:17 PM
PHp creates webpages directly? Use echo.
You can embed php into html.  I like it better than Ruby.
Title: Re: Programming Thread
Post by: Legend on May 16, 2017, 11:58 PM
You can embed php into html.  I like it better than Ruby.
EMbeding html in php is so much nicer. Gives you a lot more control.
Title: Re: Programming Thread
Post by: the-pi-guy on May 28, 2017, 04:09 PM
(https://imgs.xkcd.com/comics/workflow.png)
Title text: There are probably children out there holding down spacebar to stay warm in the winter! YOUR UPDATE MURDERS CHILDREN.



This will never not be funny.  
Title: Re: Programming Thread
Post by: Legend on May 28, 2017, 09:53 PM
IN Unity I was doing some custom rendering stuff. I could have merely put a script on each camera that needed it, but that would have been annoying. Instead I just set it up to auto work on every camera.

TUrns out this really ment every camera. Even the little preview images for materials in the editor were getting the custom rendering. I break Unity a lot.
Title: Re: Programming Thread
Post by: the-pi-guy on May 31, 2017, 01:38 PM
(https://i.redd.it/zg2r8snhgt0z.jpg)
Title: Re: Programming Thread
Post by: Legend on May 31, 2017, 04:08 PM
Oooh I just learned about "ref." That works so much better than "out" for lots of things.  ::)
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 05, 2017, 03:57 PM
(https://i.redd.it/012cukejqs1z.png)
Title: Re: Programming Thread
Post by: Legend on Jun 05, 2017, 04:04 PM
(https://i.redd.it/012cukejqs1z.png)
These volume memes have been amusing.

(https://thumbs.gfycat.com/PassionateOddballBlueandgoldmackaw-size_restricted.gif)
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 06, 2017, 12:06 PM
Game developers who have worked on terrible games, when and why did you realize the game was going to flop? : AskReddit (https://www.reddit.com/r/AskReddit/comments/6fjxym/game_developers_who_have_worked_on_terrible_games/)
Title: Re: Programming Thread
Post by: darkknightkryta on Jun 06, 2017, 01:16 PM
Game developers who have worked on terrible games, when and why did you realize the game was going to flop? : AskReddit (https://www.reddit.com/r/AskReddit/comments/6fjxym/game_developers_who_have_worked_on_terrible_games/)
I hate that you fail upwards in life.  You honestly need to pass some kind of sanity test before you're allowed to move into any management position.
Title: Re: Programming Thread
Post by: Legend on Jun 09, 2017, 03:20 AM
wowowowowowowowowowoowwowowowoow oh my gosh


YOU CAN CHANGE AN INDIVIDUAL VECTOR NUMBER!!!!!

vectorname.x=5 is valid!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Holly mothballs that's incredible!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


I'm pretty sure what happened is back when I was learning Unity in 2013 I saw that transform.position.x could not be set directly, so I just assumed that was a way vectors worked instead of how position works. Blows my mind. Instead I've been doing stuff like vectorname=new Vector3(5, vectorname.y, vectorname.z). Really doesn't affect the results of the code, but it's a great quality of life feature to know about.
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 11, 2017, 01:49 PM
(https://i.redd.it/xwlb42y2nx2z.gif)
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 14, 2017, 12:23 PM
(https://i.imgur.com/FoQ0hUA_d.jpg?maxwidth=640&shape=thumb&fidelity=high)

"It is a bit of a problem. I'm British and I still often type 'colour' rather than the American 'colour' in css, or forget to use the American spelling 'true' rather than 'indubitably'"
Title: Re: Programming Thread
Post by: Legend on Jun 14, 2017, 02:46 PM
How does programing work in other languages?

Is it common practice to just do everything in English like it's designed, or is the local language sprinkled in when possible?
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 14, 2017, 02:53 PM
How does programing work in other languages?

Is it common practice to just do everything in English like it's designed, or is the local language sprinkled in when possible?
Lol, thats actually what that post comes from.
programming languages - Do people in non-English-speaking countries code in English? - Software Engineering Stack Exchange (https://softwareengineering.stackexchange.com/questions/1483/do-people-in-non-english-speaking-countries-code-in-english)

Basically they use English or some combination of English and their native language.  

I do know there are some programming languages in other languages but they are not always very popular.  
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 20, 2017, 02:28 PM
Trying Android Studio, but it's not really cooperating with me. 
Took an hour to start up certain aspects of it.  It had to redownload some things, but it was still troublesome. 

Also I think this is just such a weird setup. 
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 20, 2017, 06:30 PM
So I'm going to make a vocabulary game on my android.  Probably going to make a couple.  
All to learn japanese vocab.  

Starting out with some matching.  I have been putting some thoughts together about a few other apps, that I might finally decide to put together.  

I have an idea of using what I know of Japanese to make a text based RPG kind of game, but we will see about that.  

Also thinking I will make some conjugation practicers.  
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 21, 2017, 12:53 PM
Was trying to take this page:
List of jōyō kanji - Wikipedia (https://en.wikipedia.org/wiki/List_of_j%C5%8Dy%C5%8D_kanji)
Take all the Kanji and their meanings and map them up to a database.  Was having a lot of trouble.  There were a few entries that would break.  Like that one with 3 kanji in the box.  
I spent  a few hours and a few hundred lines of code trying to get it to work.  
Anyways it turned out to be much easier, just to use excel and take out all the stuff pretty easily.  

Matching each kanji and counting the unicode from this page was much easier.
 Unicode Kanji Code Table (http://www.rikai.com/library/kanjitables/kanji_codes.unicode.shtml)

But one of the characters still seems to be breaking..
Title: Re: Programming Thread
Post by: Legend on Jun 21, 2017, 02:12 PM
ARe you parsing the raw html? Fetching it with an xml parser might help. That's how our bot system searches websites for content.
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 21, 2017, 03:28 PM
ARe you parsing the raw html? Fetching it with an xml parser might help. That's how our bot system searches websites for content.
Wouldn't really fix the issues I'm working with.  
Now, I'm getting some kind of weird error.  The output shows that a character is the first one, and I removed all the spaces.  Yet the character isn't grabbed unless I grab the second character...
Title: Re: Programming Thread
Post by: Legend on Jun 21, 2017, 03:40 PM
Wouldn't really fix the issues I'm working with.  
Now, I'm getting some kind of weird error.  The output shows that a character is the first one, and I removed all the spaces.  Yet the character isn't grabbed unless I grab the second character...
I love those errors. Can you force your system to tell you the value of the first character for debugging?
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 21, 2017, 03:44 PM
I love those errors. Can you force your system to tell you the value of the first character for debugging?
Yep, I figured it out.
Why is  appearing in my HTML? - Stack Overflow (https://stackoverflow.com/questions/9691771/why-is-65279-appearing-in-my-html)
'ZERO WIDTH NO-BREAK SPACE'
And it has been fixed!
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 21, 2017, 04:27 PM
That was probably the worst project I've ever done.  Really should have been a few hour project at worst, but quickly became a day and a half thing.  Wasn't working on it the whole time, but eh.  
I had a bunch of difficulties.  

The one part of the project was to grab each listing from Wikipedia.  This was hard because the table wasn't consistent. Some boxes were empty, other boxes had three things in them, each on it's own line.  Plus the first two boxes were usually identical.
Ultimately I did this manually.  Got rid of all those boxes as they were all in the same line.  Excel and the formatting Wikipedia used ultimately made this a few minute process at most.  

Second difficulty was using that site to match up the kanji to a Unicode.  So I used a counter to start with 0 and go all the way up to f using the first part of the string as the number.  
This was actually pretty easy.  Just had to be careful of spaces and double spaces while counting.  The solution is of course to get rid of all the spaces.  

Third difficulty - deleting lots of my code thinking I would never use it anymore.  Then finding that there was a one off error in the character database.  But this time I made it much more optimized.  Originally it just continually combed the kanji Unicode website, refetching it every time I wanted to match a character.  
Now it just keeps it on for usage.  


Voila a few minutes later. And I have a database of 2300 characters.  
And me wondering at what point would it have been more efficient to just have done it manually, with the starter code I had.  
The starter code asked me for each character, and then fetched the kanji Unicode as before.  

(https://imgs.xkcd.com/comics/the_general_problem.png)

This xkcd comic is painfully true sometimes.  
Title: Re: Programming Thread
Post by: Legend on Jun 21, 2017, 05:48 PM
Yup it's just so fun to over engineer things. I do that every week  :P


Biggest problem I have is accepting that rapid iteration is so much faster than doing something perfect the first time. I've gotten better in the last year at least.
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 22, 2017, 06:19 PM
Has anyone made an Android app?
Title: Re: Programming Thread
Post by: Legend on Jun 22, 2017, 06:35 PM
Has anyone made an Android app?
No.

Are you making your vocab learner into one?
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 22, 2017, 06:40 PM
No.
Are you making your vocab learner into one?
That's my plan.  
It's different than what I'm used to.
Title: Re: Programming Thread
Post by: darkknightkryta on Jun 22, 2017, 08:22 PM
Trying Android Studio, but it's not really cooperating with me.  
Took an hour to start up certain aspects of it.  It had to redownload some things, but it was still troublesome.  

Also I think this is just such a weird setup.  
Yeah... Still better than Eclipse
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 22, 2017, 08:30 PM
Yeah... Still better than Eclipse
I haven't had problems with eclipse.  :p
This on the other hand....
Title: Re: Programming Thread
Post by: darkknightkryta on Jun 22, 2017, 11:06 PM
I haven't had problems with eclipse.  :p
This on the other hand....
You haven't Blackberry programmed in Eclipse.  I have... shudders...

But yeah I think you just have to get used to the xml programming.  Or getting used to the UI tools and then hooking them into Activities.
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 23, 2017, 01:47 PM
Obviously there are vocabulary apps on Android.  There are like a ton of them, but the vast majority of them either cost money, or they have in-app purchases.  Some of them aren't very feature filled.  

So, benefits are that I can control what the vocab list is, and I'd be able to expand into some new things.

You haven't Blackberry programmed in Eclipse.  I have... shudders...
But yeah I think you just have to get used to the xml programming.  Or getting used to the UI tools and then hooking them into Activities.
Yeah, I wouldn't want to use Eclipse for this.  

I'm having issues with this.  It comes with a fair amount of auto generated code, but there were two lines of which that the compiler can't match up anything to.  I tried removing the lines, and I tried doing some other things with those lines.  But I'm not sure if I'm missing something on the xml side or if I'm missing something on the java android side of things.  
Title: Re: Programming Thread
Post by: darkknightkryta on Jun 23, 2017, 03:23 PM
Obviously there are vocabulary apps on Android.  There are like a ton of them, but the vast majority of them either cost money, or they have in-app purchases.  Some of them aren't very feature filled.  

So, benefits are that I can control what the vocab list is, and I'd be able to expand into some new things.
Yeah, I wouldn't want to use Eclipse for this.  

I'm having issues with this.  It comes with a fair amount of auto generated code, but there were two lines of which that the compiler can't match up anything to.  I tried removing the lines, and I tried doing some other things with those lines.  But I'm not sure if I'm missing something on the xml side or if I'm missing something on the java android side of things.  
XML.  You have to make sure you rmanifest file is right.  Plus you have to add all your activities to your manifest, or something.  It's been a while so I don't quite remember.
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 26, 2017, 02:03 AM
It's not very fun when I don't know where an error is.  
Android Studio isn't reporting any error right now, but my app keeps crashing.  :P
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 26, 2017, 08:42 PM


  Log | Android Developers

 (https://developer.android.com/reference/android/util/Log.html)

lol, there's a log.wtf for logging messages.  
Title: Re: Programming Thread
Post by: Legend on Jun 27, 2017, 02:55 AM
It's not very fun when I don't know where an error is.  
Android Studio isn't reporting any error right now, but my app keeps crashing.  :P
I'm practically all self taught so welcome to my world! I would never know where an error is or what the error even is.

I'd use a freakton of print statements to breakup the code so I can track down which section the error occurred. If it's a problem where the program just crashes or can't run, I'd comment out all the newish code and slowly add it back until it breaks again. Also involved a lot of just general trial and error.

Wasn't until fairly later that I actually started learning about the "correct" way to fix bugs.
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 27, 2017, 10:50 AM
I'm practically all self taught so welcome to my world! I would never know where an error is or what the error even is.

I'd use a freakton of print statements to breakup the code so I can track down which section the error occurred. If it's a problem where the program just crashes or can't run, I'd comment out all the newish code and slowly add it back until it breaks again. Also involved a lot of just general trial and error.

Wasn't until fairly later that I actually started learning about the "correct" way to fix bugs.
Eclipse would show where the error occurred.  
It'll say what line and give a general reason why it broke.  Then I'd pack that area with prints to see what the trouble variable was doing, unless the problem was obvious.  

Android Studio doesn't seem to do the same thing.  Even though it uses Java System.out.print doesn't work.  Had to look up how to do it.  I still wasn't sure it was working. The thing it prints out to is filled with stuff, and nothing sticks out.  

The problem is, it'd compile and everything.  But if I tried running a certain activity, it'd break.  I had no idea where.  I tried the debug thing and it at one point didn't even seem to be teaching my code.  :P
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 27, 2017, 02:51 PM
Everything seems to be working.  
Now to see if I can break it.  
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 27, 2017, 05:37 PM
"How to read from a file"
Make sure it's in the asset folder. 
"It works! "

"how to write to the file"
You can't write to the asset folder during runtime. 
:o >:(

Now I have to redo the reading.  :P
Title: Re: Programming Thread
Post by: the-pi-guy on Jul 02, 2017, 01:00 AM
My app is "finished".
Everything seems to be functional.  I have  around 500 vocab words on there.  A matching game works, and the translation game works.  

My complaints are:. The text is hard to read.  It's dim. Theres also some weird view issues.  When the app starts up, it starts in a full screen that is blank.  Touching the screen causes the full screen to go away, and the buttons to appear.  Not exactly sure what the issue is.  

Also in the matching game, the buttons change size with different words, which is fine.  But the buttons are aligned with the one below it.  The alignment means that longer words will push both boxes into the ones on the left.  
Problems aren't so bothersome that I will fix them, I don't think.  

On another note.  
I really enjoy discovering tricks.  
I did this a lot when programming my calculator.  
For example, there wasn't a way to append a number to a string.  The way to get around this was to basically turn the number into a function and then transfer that function to a string, then you could append it.  

Also graphics tricks were fun.  They were pretty obvious, but the results were pretty cool. So I was making a menu.  And originally, I had it set up to output every time the cursor moved.  Which is ludicrous.
Instead I just erased where the cursor was, and Drew it in the new place.  Ran faster, and looked better (because it wasn't flashing while drawing).
Title: Re: Programming Thread
Post by: Legend on Jul 02, 2017, 01:52 AM
For example, there wasn't a way to append a number to a string.  The way to get around this was to basically turn the number into a function and then transfer that function to a string, then you could append it.  
Strings suck. The standard ones in C# are so inefficient to change or modify. Appending a letter to the end of a string actually generates a new string and tosses the old one.

What do you mean you turned the number into a function?
Title: Re: Programming Thread
Post by: the-pi-guy on Jul 02, 2017, 02:29 AM
What do you mean you turned the number into a function?
The TI-83 is basically all preset variables.  A,B,C,etc for numbers.  
Str0, Str1, Str2, all the way to Str9

They also have y1, y2, etc are the functions that the calculator graphs.  The only variables that can be made are lists.  

But something like "A"+6 doesn't work.  It gives a data type error.  

You have to convert the 6 to a string using this code.  (Where N=6)

 {0,1→L₁
:{0,N→L₂
:LinReg(ax+b) Y₁
:Equ►String(Y₁,Str1
:sub(Str1,1,length(Str1)-3→Str1

Basically it makes 2 lists one for the domain and one for the range of the function.  
From these two lists, the next line makes the function
Y1=Nx+0
It then transfers from the function y1 to the string str1.
At which point substring cuts off the "x+0".  

How's that for inefficient!
Title: Re: Programming Thread
Post by: Legend on Jul 08, 2017, 04:35 PM
(https://i.imgur.com/fbrxjMk_d.jpg?maxwidth=640&shape=thumb&fidelity=high)
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 02, 2017, 05:26 PM
This next semester, I have Operating Systems, Software Engineering I and Computer Organization.  

SE I is all about practices.  How to design stuff, how to test stuff, how to communicate with a client.  This one has a major project.  
"This course will provide an in-depth study and analysis of at least one large scale software
system. Students will analyze, design, and partially implement an extensive software
project. Case studies will address major system concerns such as specification,
classification, inter-relationships, validation, and evaluation. Other topics include the use of
UML, prototyping, data flow diagrams, etc."


Computer Organization "This course focuses on the design of microprocessors, especially
the Arithmetic and Logic Unit and the Control Unit, as well as the memory hierarchy, especially registers,
DRAM-based main memory and caches"

Operating Systems. "
An introduction to operating systems concepts. Topics covered include: interrupts,
memory allocation, virtual memory techniques, process scheduling and synchronization,
deadlocks, resource allocation, and file systems. A major programming project will be
assigned to provide experience with operating system design."

From what I hear is, Computer Organization is probably the hardest class in the major.  
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 07, 2017, 03:04 AM
My app is "finished".
Everything seems to be functional.  I have  around 500 vocab words on there.  A matching game works, and the translation game works.  

My complaints are:. The text is hard to read.  It's dim. Theres also some weird view issues.  When the app starts up, it starts in a full screen that is blank.  Touching the screen causes the full screen to go away, and the buttons to appear.  Not exactly sure what the issue is.  

Also in the matching game, the buttons change size with different words, which is fine.  But the buttons are aligned with the one below it.  The alignment means that longer words will push both boxes into the ones on the left.  
Problems aren't so bothersome that I will fix them, I don't think.  
Tomorrow my plan is to update my app.  
Already fixed the matching button issue.  Probably won't fix the previous one.

The biggest thing will be the vocab will be greatly expanded.  I finally found an awesome vocab list that has something like 1400-1500 words in it.  Just have to build something to go through the excel file I guess...  
Would be nice if there was already a program built that could make it easy...
Title: Re: Programming Thread
Post by: Legend on Aug 07, 2017, 06:14 AM
I Learned ++int is not thread safe. Seems I had two different threads doing ++int and --int on the same value at the exact same time and only one or the other would be applied.

Explains why the glitch I was noticing was so rare.
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 07, 2017, 09:07 PM
Someone actually made a huge vocab list from this other textbook I have.  Which has ~7200 words.  This is going to be huge.  :o

I Learned ++int is not thread safe. Seems I had two different threads doing ++int and --int on the same value at the exact same time and only one or the other would be applied.

Explains why the glitch I was noticing was so rare.
In my second programming class, there was a little bit about multithreading. 
We had to use "synchronized", a keyword in Java.  Otherwise if we assigned one thread to add 2500 to a number, and another thread to add 2500 to the same number, it usually wouldn't quite make it up to 5000. 
Both threads would access the number, and change it at the same time.  Which would cause it to only go up by 1 instead of 2. 

"synchronized" made sure that the other thread would wait for the thread to finish accessing it. 

Although it was funny, because when the teacher tried demonstrating it, without the keyword (so he was expecting something like 4800 something.)  It actually got really lucky and made it all the way to 5000, 2 out of the first 5 times.  Only 2 times it actually worked. 
Title: Re: Programming Thread
Post by: Legend on Aug 07, 2017, 09:29 PM
Someone actually made a huge vocab list from this other textbook I have.  Which has ~7200 words.  This is going to be huge.  :o

In my second programming class, there was a little bit about multithreading.  
We had to use "synchronized", a keyword in Java.  Otherwise if we assigned one thread to add 2500 to a number, and another thread to add 2500 to the same number, it usually wouldn't quite make it up to 5000.  
Both threads would access the number, and change it at the same time.  Which would cause it to only go up by 1 instead of 2.  

"synchronized" made sure that the other thread would wait for the thread to finish accessing it.  

Although it was funny, because when the teacher tried demonstrating it, without the keyword (so he was expecting something like 4800 something.)  It actually got really lucky and made it all the way to 5000, 2 out of the first 5 times.  Only 2 times it actually worked.  
Yeah in C# it's called "lock." I'm needing my code to run as fast as possible so I tried to design it with as few locked parts as possible.

However I'm probably still going to switch it over to the GPU. I'm rendering 100s of thousands of lines and issuing the draw call can take so much CPU time. Instead I figure I could store the lines in a compute buffer and render them in a more direct fashion.
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 08, 2017, 03:04 AM
I was thinking about my raspberry Pi project.  And I think right now I'm going to scale down the hardware part of it.  I don't think I really have the art skills to build the case that I'd want.  Instead I think I can probably make something decent, just by making a case for the screen and the Pi itself (Actually found one made, that I plan on paying Tacos to make for me.)  

It'll be a bit lame, but I think it'll be fairly cool and get some actual usage out of it.  Then I could use the battery to connect to the Pi outside of the case.  And have a controller of some sort.  I don't like having to carry around 3 parts, but it'll be something at least...  Maybe just have a little bag or something to make it more manageable.

I also want to look into making some sort of OS for it.  I have that class coming up, and it'd be really cool to have something substantial to show for it.  
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 19, 2017, 08:49 PM
(https://i.redd.it/thv46yzpcpgz.png)
Title: Re: Programming Thread
Post by: Legend on Aug 20, 2017, 09:45 PM
(https://i.redd.it/5u8fw0stmvgz.jpg)
Title: Re: Programming Thread
Post by: Legend on Aug 29, 2017, 11:54 PM
"A different error message! Finally some progress!"
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 04, 2017, 03:08 PM
(()(())+())(+())(++(+())(+())) is "n" in javascript : ProgrammerHumor (https://www.reddit.com/r/ProgrammerHumor/comments/6xzcgb/is_n_in_javascript/)
Title: Re: Programming Thread
Post by: Legend on Sep 04, 2017, 05:13 PM
(()(())+())(+())(++(+())(+())) is "n" in javascript : ProgrammerHumor (https://www.reddit.com/r/ProgrammerHumor/comments/6xzcgb/is_n_in_javascript/)
That's kinda awesome!
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 04, 2017, 05:20 PM
That's kinda awesome!
It's awesome and horrifying at the same time.
Title: Re: Programming Thread
Post by: Legend on Sep 19, 2017, 08:08 AM
(https://i.redd.it/6ikzrki1jrmz.gif)
Title: Re: Programming Thread
Post by: Legend on Sep 21, 2017, 12:11 AM
YOU MUST BE LOGGED IN TO SEE THIS CONTENT
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 21, 2017, 01:54 PM
Have a virtual machine so I can program C with all the special features.  
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 22, 2017, 09:38 PM
It's been pretty cool learning how an OS works. How it manages processes and threads.
Title: Re: Programming Thread
Post by: Legend on Sep 23, 2017, 12:09 AM
It's been pretty cool learning how an OS works. How it manages processes and threads.
How good is windows in regards to that stuff?
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 23, 2017, 12:29 AM
How good is windows in regards to that stuff?
We aren't doing so much with how specific OS do things.  
Just the how, why threads/processes work the way they do, and how to implement them.  

The professor has sometimes mentioned tidbits about certain OS's, but it's not the focus.  
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 23, 2017, 06:36 PM
The OS has to basically switch from a process to itself to a process every time interval.  
There's also special permissions that the OS has to manage to ensure that software is limited to it's own space, but also able to expand that space to look infinite.
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 25, 2017, 10:25 PM
A lot of newbie programmers are really bad.  Like I was never this bad.
Title: Re: Programming Thread
Post by: Legend on Sep 25, 2017, 11:01 PM
A lot of newbie programmers are really bad.  Like I was never this bad.
I was bad.

On one of my first school projects I didn't understand functions yet and just copy/pasted code inside itself to nest it...
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 25, 2017, 11:10 PM
I was bad.

On one of my first school projects I didn't understand functions yet and just copy/pasted code inside itself to nest it...
Lol. That's not too bad. 

Some of these people are in their second programming class, and they still seem to have trouble understanding some pretty basic stuff. 
Like some still have trouble understanding different data types and stuff.

Maybe part of it is I'm kinda biased towards my skill now, but some people seem to have a struggle with it.
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 26, 2017, 02:50 PM
Have to program a shell. :o
Title: Re: Programming Thread
Post by: darkknightkryta on Sep 26, 2017, 03:56 PM
How good is windows in regards to that stuff?
Not sure now, but it was terrible before.  Windows didn't really properly multi task until recently.

The OS has to basically switch from a process to itself to a process every time interval.  
There's also special permissions that the OS has to manage to ensure that software is limited to it's own space, but also able to expand that space to look infinite.
I don't remember it that much, but memory management was interesting.  The OS, heap, etc.  So much stuff I forgot but vaguely remember.

Have to program a shell. :o
Command prompt?  
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 26, 2017, 04:15 PM
Not sure now, but it was terrible before.  Windows didn't really properly multi task until recently.
I don't remember it that much, but memory management was interesting.  The OS, heap, etc.  So much stuff I forgot but vaguely remember.
Command prompt?  
Yeah, a command prompt.
Title: Re: Programming Thread
Post by: Legend on Sep 26, 2017, 04:46 PM
My brother is taking programing 101 classes but for one class they're using C++. Good opportunity for me to learn it through helping him  ::)


The other day he was using an int instead of a bool in his homework. I tried to help him switch it to a bool, but then he got upset and reverted to an int because he didn't want to change how the variable was assigned  :P
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 26, 2017, 06:06 PM
My brother is taking programing 101 classes but for one class they're using C++. Good opportunity for me to learn it through helping him  ::)


The other day he was using an int instead of a bool in his homework. I tried to help him switch it to a bool, but then he got upset and reverted to an int because he didn't want to change how the variable was assigned  :P
Well that's not the worst thing to do.

I convinced someone to switch their Boolean to an int, because they were trying to use a loop to find out if a move was valid and another loop for figuring out what move is valid.  

So like, the first loop says yes you can put it in this column, the second one says this is where it goes if you put it in this column.  Put the loops together, and used -1 to say that it wasn't valid.  

Some languages aren't too picky with letting you use ints as a boolean.  Pretty sure C++ let's you use 0 as false, and anything else is true.  

Title: Re: Programming Thread
Post by: darkknightkryta on Sep 26, 2017, 08:42 PM
Yeah, a command prompt.
We never got to that.  We just had to simulate stuff in C.  Like thread dispatching, file management, etc.  We never had to make a command prompt.  Sounds like fun.
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 26, 2017, 09:14 PM
Computer Organization is pretty cool.

It's like okay, we are going to use NAND gates to build Or/And/Not gates.  
Now we are going to use these gates to make Mux chips.

And now we built ALU's, which you can use Much chips to make.  
Title: Re: Programming Thread
Post by: darkknightkryta on Sep 26, 2017, 10:50 PM
Computer Organization is pretty cool.

It's like okay, we are going to use NAND gates to build Or/And/Not gates. 
Now we are going to use these gates to make Mux chips.

And now we built ALU's, which you can use Much chips to make. 
Yeah that stuff was fun.  I'm going to be teaching them soon to my grade 11s.  I still need to learn how to make an 8 bit cpu out of logic gates.
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 29, 2017, 10:09 AM
(https://imgs.xkcd.com/comics/still_in_use_2x.png)
Title: Re: Programming Thread
Post by: darkknightkryta on Sep 29, 2017, 07:15 PM
(https://imgs.xkcd.com/comics/still_in_use_2x.png)
I would get so frustrated with the way Objective C handled their garbage collector.  I had this exact issue and there was nothing I could do about it.
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 29, 2017, 09:57 PM
So, people.  

What was a bad programming mistake you made?  
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 08, 2017, 09:33 PM
I'm having some issues with C.  
I'm trying to compare two strings...  And the stack overflow solution isn't working at all.  

For some reason trying to print out:
Char s[100];
print(s[0]);

This code prints the entire array.
Title: Re: Programming Thread
Post by: Legend on Oct 08, 2017, 10:37 PM
So, people.  

What was a bad programming mistake you made?  
I make infinite loops far too commonly.

I'm having some issues with C.  
I'm trying to compare two strings...  And the stack overflow solution isn't working at all.  

For some reason trying to print out:
Char s[100];
print(s[0]);

This code prints the entire array.
Does s[1] also print the whole array?
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 08, 2017, 10:44 PM
I make infinite loops far too commonly.
Does s[1] also print the whole array?
I figured out part of it.  
I was misusing pointer stuff.
s[1] prints out the whole array minus the first character.  
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 10, 2017, 08:54 PM
For some reason one print line executes and the one underneath it doesn't. 
C is upsetting... 
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 26, 2017, 11:04 PM
It's really crazy all the things that an OS does.  

Basically every time period, the OS basically does a "context switch", the OS gets reloaded into the computer many, many times a second.  
Learning about the program counter in a few different classes.  Like the computer stores what line of code it is reading.  

It just feels so weird to think about with how nice OS's are, that basically every second, every program stops running for a very tiny portion of time, gets switched to something else, and back again before anyone notices.  

This semester seems like a lot of obvious things that still seem weird to think about.  Like it's obvious the OS has to work that way, but then it seems crazy at the same time.  

Another thing that is obvious, but just seems so counter to experience, is that programming languages vary from compiler and OS.  

Usually you work in 1 compiler, 1 OS, so you don't notice these things all the time.  
But it's just weird sometimes how little things can completely wreck your program on someone else's computer.  (Obvious.)  

Like this:
for(int i=0; i<20; i++)

Works perfectly fine on my computer at home on a Linux OS.  It doesn't work on the school computers.  Instead this does:
int i;
for(i=0; i<20; i++)
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 26, 2017, 11:14 PM
I spent a while working on my assignment and was frustrated.  

Spent 20 minutes looking at someone else's code, also frustrated.  Then it suddenly made complete sense.  

Walked back to my own assignment, and suddenly for no reason it suddenly made sense.  I suddenly came up with an idea on the spot that fixed my issues from the past few hours.  
Title: Re: Programming Thread
Post by: the-pi-guy on Nov 04, 2017, 01:25 PM
Computers be like:
"10+10=100"
"11+11=110"
"101*1101=1000001"
Title: Re: Programming Thread
Post by: Legend on Nov 04, 2017, 03:16 PM
Computers be like:
"10+10=100"
"11+11=110"
"101*1101=1000001"
I mean yes that be factual.
Title: Re: Programming Thread
Post by: the-pi-guy on Nov 04, 2017, 03:44 PM
I mean yes that be factual.
I think someone who doesn't know binary would be very confused that 10+10 =100.
Title: Re: Programming Thread
Post by: darkknightkryta on Nov 04, 2017, 04:24 PM
I'm having some issues with C.  
I'm trying to compare two strings...  And the stack overflow solution isn't working at all.  

For some reason trying to print out:
Char s[100];
print(s[0]);

This code prints the entire array.
Why not sure printf?
printf("%c",s[0]);
Title: Re: Programming Thread
Post by: the-pi-guy on Nov 04, 2017, 05:33 PM
Why not sure printf?
printf("%c",s[0]);
I meant printf.  
But that's probably why it was outputting the whole array.  
Title: Re: Programming Thread
Post by: darkknightkryta on Nov 04, 2017, 05:47 PM
I meant printf.  
But that's probably why it was outputting the whole array.  
Yeah the way you were using printf was just all kinds of wrong so I wasn't sure if there was an actual print command in C.
Title: Re: Programming Thread
Post by: the-pi-guy on Nov 09, 2017, 04:25 PM
Increasing cache memory can actually decrease performance if using a FIFO algorithm.  

It never hurts performance in least frequent or least recent algorithms.

But for FIFO, there are work loads where having a smaller cache gives better results.  
Title: Re: Programming Thread
Post by: Tachikoma on Nov 09, 2017, 04:38 PM
So, people.  

What was a bad programming mistake you made?  
I once ported some code to the wiiu, what a waste.
Title: Re: Programming Thread
Post by: darkknightkryta on Nov 09, 2017, 05:31 PM
Increasing cache memory can actually decrease performance if using a FIFO algorithm.  

It never hurts performance in least frequent or least recent algorithms.

But for FIFO, there are work loads where having a smaller cache gives better results.  
What are you?  An Engineer?  Call it a queue like a normal computer scientist!
Title: Re: Programming Thread
Post by: the-pi-guy on Nov 09, 2017, 06:01 PM
What are you?  An Engineer?  Call it a queue like a normal computer scientist!
I see FIFO all the time in CS books.
My OS book calls a lot of things FIFO.  

A queue is a "FIFO data structure" is usually how they call it.
Title: Re: Programming Thread
Post by: darkknightkryta on Nov 09, 2017, 06:59 PM
I see FIFO all the time in CS books.
My OS book calls a lot of things FIFO.  

A queue is a "FIFO data structure" is usually how they call it.
Those CS books were made by engineers.

On another note, when I had an interview with Capcom and I said "I'd store the files with a stack" he was like "No, have you heard of Filo?"  I wanted to slap him since he didn't know they were the same thing.
Title: Re: Programming Thread
Post by: the-pi-guy on Nov 09, 2017, 07:19 PM
Those CS books were made by engineers.
No. ::P
First in, first out is the official name for the algorithm in the context of scheduling.
Title: Re: Programming Thread
Post by: darkknightkryta on Nov 09, 2017, 09:19 PM
No. ::P
First in, first out is the official name for the algorithm in the context of scheduling.

That's scheduling, not compsci

(https://vignette.wikia.nocookie.net/roblox/images/3/38/Transparent_Troll_Face.png/revision/latest?cb=20120713214853)

Anyways, I have to write lessons for all the sorting algorithms in textbooks.  I'm arbitrarily starting with quicksort.  Does it "have" to be recursive?  I can't find a non-recursive algorithm and I'd rather not write one.
Title: Re: Programming Thread
Post by: the-pi-guy on Nov 09, 2017, 09:31 PM
That's scheduling, not compsci

(https://vignette.wikia.nocookie.net/roblox/images/3/38/Transparent_Troll_Face.png/revision/latest?cb=20120713214853)

Anyways, I have to write lessons for all the sorting algorithms in textbooks.  I'm arbitrarily starting with quicksort.  Does it "have" to be recursive?  I can't find a non-recursive algorithm and I'd rather not write one.
No. Nonrecursive
Optimized QuickSort -- C Implementation (Non-Recursive) (http://alienryderflex.com/quicksort/)



Usually it's possible to change an implementation from recursive to iterative.  
Title: Re: Programming Thread
Post by: darkknightkryta on Nov 09, 2017, 09:40 PM
No. Nonrecursive
Optimized QuickSort -- C Implementation (Non-Recursive) (http://alienryderflex.com/quicksort/)



Usually it's possible to change an implementation from recursive to iterative.  

It is, I just didn't want to write one from scratch.
Title: Re: Programming Thread
Post by: the-pi-guy on Nov 11, 2017, 11:47 PM
Hmmm this code isn't getting the right answer. Let's track what's going on with a print statement.  

What.. now I got the right answer.  
*Runs it a few more times*.
Okay, half the time I get the right answer of 94, the other half I get 109.

This makes no sense.
Title: Re: Programming Thread
Post by: Legend on Nov 11, 2017, 11:51 PM
Hmmm this code isn't getting the right answer. Let's track what's going on with a print statement.  

What.. now I got the right answer.  
*Runs it a few more times*.
Okay, half the time I get the right answer of 94, the other half I get 109.

This makes no sense.
Is it somehow not starting with a clean slate before each test?
Title: Re: Programming Thread
Post by: the-pi-guy on Nov 11, 2017, 11:58 PM
Is it somehow not starting with a clean slate before each test?
It's starting with a clean state every time.  But half the time it keeps counting even though it shouldn't. 

There's nothing in it that depends on time or randomness, so it doesn't make a lot of sense. 

Every time it comes to the wrong value, it's because it is adding up another value that it shouldn't even be reaching.

Like I'm passing in an array of 10 values, but half the time it adds an 11th value that seems to come out of nowhere.
Title: Re: Programming Thread
Post by: darkknightkryta on Nov 14, 2017, 06:48 PM
It's starting with a clean state every time.  But half the time it keeps counting even though it shouldn't.  

There's nothing in it that depends on time or randomness, so it doesn't make a lot of sense.  

Every time it comes to the wrong value, it's because it is adding up another value that it shouldn't even be reaching.

Like I'm passing in an array of 10 values, but half the time it adds an 11th value that seems to come out of nowhere.
At least your while loop based quick sort isn't bugging out when a zero is on the right side.
Title: Re: Programming Thread
Post by: the-pi-guy on Nov 21, 2017, 12:25 PM
That moment when you are testing your program, not sure why it isnt passing your "test cases", when you realize your test cases are what's wrong.  
Title: Re: Programming Thread
Post by: the-pi-guy on Dec 09, 2017, 09:21 PM
Finally got my (simulated) multiplication chip working. 

Was kind of a pain. 
Title: Re: Programming Thread
Post by: Legend on Dec 10, 2017, 12:24 AM
(https://i.redd.it/glm9twiqvq201.jpg)
Title: Re: Programming Thread
Post by: the-pi-guy on Dec 15, 2017, 03:39 PM
Working on an assignment due tonight.

I have a variable that is being changed between print statements, despite the fact the only time that variable gets changed is when it gets set originally.
Title: Re: Programming Thread
Post by: Legend on Dec 16, 2017, 12:58 AM
Working on an assignment due tonight.

I have a variable that is being changed between print statements, despite the fact the only time that variable gets changed is when it gets set originally.
I just had an issue like that!

In c# I replaced the variable with a function that acted like a variable. Then it could print a message everytime it was changed and tell me who changed it. Does c++ have similar?
Title: Re: Programming Thread
Post by: the-pi-guy on Dec 16, 2017, 02:26 AM
I just had an issue like that!

In c# I replaced the variable with a function that acted like a variable. Then it could print a message everytime it was changed and tell me who changed it. Does c++ have similar?
I think it's possible to have a pointer variable, that points to a function. 
Never tried it, but I recall reading something about it. 


I just had an issue like that!

In c# I replaced the variable with a function that acted like a variable. Then it could print a message everytime it was changed and tell me who changed it. Does c++ have similar?
I've been messing around some more. 

For some reason, this method is changing the value.  literally one line:
Code: [Select]

int getSize(int i)
return list[i].size;
Title: Re: Programming Thread
Post by: the-pi-guy on Dec 16, 2017, 03:53 PM
I just had an issue like that!

In c# I replaced the variable with a function that acted like a variable. Then it could print a message everytime it was changed and tell me who changed it. Does c++ have similar?
So what the assignment is, is to implement malloc (memory allocation).
But it requires a data structure to keep track of data locations.  

I was using an array that would change length, by getting reassigned basically.  

But apparently assigning the arrays that way has some unusual behaviors.  

I changed all the declarations to utilizing malloc, which feels wrong.  Now it works great.  

It's apparently fine if the data structure uses malloc, but eh I don't like it.  
Title: Re: Programming Thread
Post by: darkknightkryta on Dec 16, 2017, 06:56 PM
I think it's possible to have a pointer variable, that points to a function.  
Never tried it, but I recall reading something about it.  

I've been messing around some more.  

For some reason, this method is changing the value.  literally one line:
Code: [Select]

int getSize(int i)
return list[i].size;

Yes you can make a variable point to a function.  I vaguely recall it being in a lab.  Not sure why'd you would use it.

So what the assignment is, is to implement malloc (memory allocation).
But it requires a data structure to keep track of data locations.  

I was using an array that would change length, by getting reassigned basically.  

But apparently assigning the arrays that way has some unusual behaviors.  

I changed all the declarations to utilizing malloc, which feels wrong.  Now it works great.  

It's apparently fine if the data structure uses malloc, but eh I don't like it.  
Memory related issues are the hardest to debug.  C's memory system isn't that good either (Was at the time I guess).  Though as I tell all my students "Be kind to C and C will be kind to you"  So use malloc and like it :P
Title: Re: Programming Thread
Post by: the-pi-guy on Dec 16, 2017, 07:18 PM
Yes you can make a variable point to a function.  I vaguely recall it being in a lab.  Not sure why'd you would use it.
Memory related issues are the hardest to debug.  C's memory system isn't that good either (Was at the time I guess).  Though as I tell all my students "Be kind to C and C will be kind to you"  So use malloc and like it :P
How can I use malloc if I'm trying to implement malloc?  
Title: Re: Programming Thread
Post by: darkknightkryta on Dec 16, 2017, 08:23 PM
How can I use malloc if I'm trying to implement malloc?  

Implement malloc?  You have to inline assembly for that...
Title: Re: Programming Thread
Post by: Legend on Dec 20, 2017, 01:30 AM
I'm having a stupid thing and I don't understand.

In Unity objects have a forward vector, a right vector, and an up vector. These are the calculus kind, not the c++ kind. I have a custom vector that's defined by a quaternion*vector, then multiplied by the object's rotation.

Something is screwing up because through testing I've realised that even if an object has two of these custom vectors defined, it can be in multiple rotations. Should be mathematically impossible but I really don't understand where my mistake is. Visually my custom vectors seem to function properly.

edt: figured it out!!!!!!!! my custom vectors were 180 degrees opposite of eachother so the system had issues. I should have checked on that possibility sooner.

edt2: well now it's not creating the full amount of vectors! I shouldn't program when this tired...
Title: Re: Programming Thread
Post by: the-pi-guy on Dec 20, 2017, 04:37 AM
What do you mean multiple rotations?  Why is it impossible?
Title: Re: Programming Thread
Post by: Legend on Dec 20, 2017, 04:40 AM
What do you mean multiple rotations?  Why is it impossible?
If you define an object's forward direction and it's upwards direction, then you've fully defined its rotation. There is only one state it can be in. My forward and upward directions were accidentally opposite so the second vector didn't actually define anything new.
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 02, 2018, 03:56 AM
Pi created his first server!

It plays a code breaking game with a client.
It's cool.
Title: Re: Programming Thread
Post by: Legend on Feb 02, 2018, 12:05 PM
Pi created his first server!

It plays a code breaking game with a client.
It's cool.
So are you hosting it?
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 02, 2018, 01:07 PM
So are you hosting it?
Well the server and the client are both being run on the same machine.  

Right now it's only set up to take one client, and then it shuts down.  
Title: Re: Programming Thread
Post by: darkknightkryta on Feb 03, 2018, 10:52 PM
Yeah I need to get back into figuring out server programming.  I need to make my "gameification" of learning.  I have a whole JRPG idea for going through lessons and completing quizzes.  Gonna take me a while though.
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 09, 2018, 03:49 PM
Next server is multithreaded!
Many threads. Many clients.
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 10, 2018, 12:12 AM
So are you hosting it?
It seems to be as easy as changing the hostname in the server program to be able to do it over the internet.  

Would someone like to try?  :D

Actually maybe it doesn't work yet.  

I'm not sure how much of my errors is because something isn't set up right or because the computers aren't allowing it on campus.  

And I'm not sure how much trouble I could get into.  
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 10, 2018, 09:22 PM
The first week of compilers seems like Automata + Programming Languages.
That class is fairly intimidating.  The final project will be a few thousand lines of code, and will be a fully working compiler.  

It's kind of cool to see stuff show up again and again.  This semester I've seen it a lot in my CS courses.   Like automata have been showing up in both my classes.  
Title: Re: Programming Thread
Post by: darkknightkryta on Feb 11, 2018, 01:25 AM
The first week of compilers seems like Automata + Programming Languages.
That class is fairly intimidating.  The final project will be a few thousand lines of code, and will be a fully working compiler.  

It's kind of cool to see stuff show up again and again.  This semester I've seen it a lot in my CS courses.   Like automata have been showing up in both my classes.  
We bailed translators once it turned into a math class.  But I'm sure you'll love it.
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 12, 2018, 03:13 PM
Getting into peer to peer vs server client.  
Title: Re: Programming Thread
Post by: darkknightkryta on Feb 12, 2018, 03:43 PM
Getting into peer to peer vs server client.  
I still remember when we learned about Web 2.0.  P2P was supposed to replace servers.  To save, millions from piracy, corporate america is spending billions in servers.
Title: Re: Programming Thread
Post by: Legend on Feb 12, 2018, 04:27 PM
I still remember when we learned about Web 2.0.  P2P was supposed to replace servers.  To save, millions from piracy, corporate america is spending billions in servers.
How would p2p work with anything but static html though? 99% of websites nowadays are custom generated just for the person visiting.
Title: Re: Programming Thread
Post by: darkknightkryta on Feb 12, 2018, 06:17 PM
How would p2p work with anything but static html though? 99% of websites nowadays are custom generated just for the person visiting.
I mean for sharing data.  Like instead of Sony spending god knows how much money on servers, all your DLC/Patches/Updates are all downloaded from each other.
Title: Re: Programming Thread
Post by: Legend on Feb 12, 2018, 06:57 PM
I mean for sharing data.  Like instead of Sony spending god knows how much money on servers, all your DLC/Patches/Updates are all downloaded from each other.
Ok yeah for just specific files that's more usable. How would that theoretically handle PS4s turning off or going into a game and shutting off the upload?
Title: Re: Programming Thread
Post by: darkknightkryta on Feb 12, 2018, 07:38 PM
Ok yeah for just specific files that's more usable. How would that theoretically handle PS4s turning off or going into a game and shutting off the upload?
You need servers still.  You just don't need huge server farms.  It brings down costs significantly.  Hell I think even Netflix could work off of P2P to an extent.  Like it wouldn't replace servers, it' just make server load way smaller.
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 12, 2018, 08:41 PM
Technically you could probably do just about anything with P2P, whether it makes any sense to do it that way is a different question.  

P2P email exists for example.  But to make it work well, you either have to allow emails to be lost, or you have to go to extraordinary lengths to be secure.  

Centralized servers makes more sense for big companies though.  Netflix could do a hybrid like DKK mentioned.

Have clients upload to the movies to other clients.  
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 16, 2018, 04:14 AM
Just did a networking homework that was about testing out the school website for packets.  

Really sucked.  My computer would get like 1000's of other packets, so I had no idea how many came from the school.  

No idea what to do about it.  
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 20, 2018, 11:02 PM
Pros of working with someone else:
-Work can get done twice as fast.

Cons:
- When they like things formatted differently than you do.  So they spend several minutes reformatting even though it was already exactly how you liked it.
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 25, 2018, 08:36 PM
Fellow programmers, how do you like your brackets?
Code: [Select]

public void name(){

}

public void name()
{


}
public void name() {


}

Something else?

What about other stylistic preferences?
Title: Re: Programming Thread
Post by: darkknightkryta on Feb 26, 2018, 03:15 AM
Fellow programmers, how do you like your brackets?
Code: [Select]

public void name(){

}

public void name()
{


}
public void name() {


}

Something else?

What about other stylistic preferences?
Line them up
{
}
It'll save you headaches later when you go down the rabbit hole.
Title: Re: Programming Thread
Post by: Legend on Feb 26, 2018, 06:38 AM
First one duh!

Also I do:

if (){

}
else {

}

Really annoying having the else statement on the same line as the if's bracket.
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 26, 2018, 01:22 PM
First one duh!

Also I do:

if (){

}
Me too!!!


else {

}

Really annoying having the else statement on the same line as the if's bracket.
Uh oh...  
I like the else kind of packed in with the if.  


Line them up
{
}
It'll save you headaches later when you go down the rabbit hole.
A lot of IDEs magically connect them, regardless.
Title: Re: Programming Thread
Post by: Legend on Feb 26, 2018, 03:12 PM
(https://i.redditmedia.com/ERBSzGTC935D2MVi7ZGWsehKTRvKAcmZB_FqMv1aqD0.png?w=696&s=c7cd899dea5cf78d6291c589840e4e15)
Title: Re: Programming Thread
Post by: darkknightkryta on Feb 26, 2018, 05:53 PM
Me too!!!


Uh oh... 
I like the else kind of packed in with the if. 

A lot of IDEs magically connect them, regardless.
The problem isn't the connecting, the problem is trying to find when you're missing one.  A lot of time I spend helping my students debug their programs have to do with a missing bracket.  Having them lined up let's you know what's missing since they're lined up, you can just follow down and see where it's missing.
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 26, 2018, 06:04 PM
The problem isn't the connecting, the problem is trying to find when you're missing one.  A lot of time I spend helping my students debug their programs have to do with a missing bracket.  Having them lined up let's you know what's missing since they're lined up, you can just follow down and see where it's missing.
You can do the same thing with the other format.  You just match it with the start of the line that connects it.


Code: [Select]

public static void main(stuff){
      for(stuff){
             if(stuff){

             }


      }
}


A lot of IDEs still tell you if one is missing.  Not always accurately, albeit. 
Title: Re: Programming Thread
Post by: darkknightkryta on Feb 27, 2018, 03:03 AM
You can do the same thing with the other format.  You just match it with the start of the line that connects it.


Code: [Select]

public static void main(stuff){
      for(stuff){
             if(stuff){

             }


      }
}


A lot of IDEs still tell you if one is missing.  Not always accurately, albeit.  
Look very carefully at your first example.  The top doesn't line up at all with the bottom.  Now imagine programs with worse formatting.  I've spent more time hunting down brackets than anything.  Having them lined up helps a ton.
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 27, 2018, 12:20 PM
Look very carefully at your first example.  The top doesn't line up at all with the bottom.  Now imagine programs with worse formatting.  I've spent more time hunting down brackets than anything.  Having them lined up helps a ton.
It lines up with the p.  

I personally haven't spent very much time looking for brackets.  9/10 times the editor tells me where the issue is.  
Title: Re: Programming Thread
Post by: Legend on Mar 01, 2018, 02:50 AM
How realistic is it to have an incredibly large memory object in graphics memory for rendering? Would say a 1 gigabyte object be fine or is there some restriction and something like that would have to be split into multiple objects? Xbox One uses ESRAM so that's problematic but would it work on say the GTX 970?
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 01, 2018, 03:23 AM
How realistic is it to have an incredibly large memory object in graphics memory for rendering? Would say a 1 gigabyte object be fine or is there some restriction and something like that would have to be split into multiple objects? Xbox One uses ESRAM so that's problematic but would it work on say the GTX 970?
Not aware of any issues, should work.
Title: Re: Programming Thread
Post by: Legend on Mar 01, 2018, 05:11 AM
Not aware of any issues, should work.
Good. Wouldn't think it'd be a problem but I know relativly little about the hardware side and the way memory actually works.
Title: Re: Programming Thread
Post by: darkknightkryta on Mar 01, 2018, 03:03 PM
How realistic is it to have an incredibly large memory object in graphics memory for rendering? Would say a 1 gigabyte object be fine or is there some restriction and something like that would have to be split into multiple objects? Xbox One uses ESRAM so that's problematic but would it work on say the GTX 970?
Your space in your card is your space.  1 gigabyte will fit in a 2 gig card.  Now trying to put more after that 1 gig object...
Title: Re: Programming Thread
Post by: Legend on Mar 01, 2018, 03:23 PM
A 512x512x512 buffer might be possible after all :)

Now if only i could figure out my AI issues with VizionEck and get that released.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 01, 2018, 03:37 PM
Here comes first compiler test.  
Title: Re: Programming Thread
Post by: darkknightkryta on Mar 01, 2018, 06:41 PM
Here comes first compiler test.  
You'll do fine, you're good at the math behind compilers.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 01, 2018, 06:55 PM
I felt really good about 95% of the test.  
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 02, 2018, 03:54 PM
"2.2, just like 2.1 just no more NAKs"
Title: Re: Programming Thread
Post by: Legend on Mar 05, 2018, 08:36 AM
Unity uses floats for time. This works since game sessions don't last that long.

However, modern consoles can suspend games. Going 50 hours without restarting is common. At that length of time, anything based off floats would be super screwed and probably crash. So I wonder if future unity versions will use doubles.

Supposedly unity internally uses doubles but they want to keep it easy for devs.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 05, 2018, 02:41 PM
I'm sure you've read this.
What happens when Time.time gets very large in Unity? - Game Development Stack Exchange (https://gamedev.stackexchange.com/a/141811)
Title: Re: Programming Thread
Post by: Legend on Mar 05, 2018, 03:19 PM
I'm sure you've read this.
What happens when Time.time gets very large in Unity? - Game Development Stack Exchange (https://gamedev.stackexchange.com/a/141811)
Haha yup that's the page I found last night when I was thinking about it.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 06, 2018, 01:56 AM
I now have books on databases.  

The only subject matter that I can think in CS, that I don't have a textbook is security.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 06, 2018, 03:20 PM
.
Did you start off with any tutorials in Unity?  

Or did you just read documentation?
Title: Re: Programming Thread
Post by: Legend on Mar 06, 2018, 03:56 PM
Did you start off with any tutorials in Unity?  

Or did you just read documentation?
I happened upon this simple FPS tutorial and was just going through that to learn Unity and scripting.



(was a new video the last time I watched it  :P )

Before finishing that series, I started working on VizionEck and then just learned through documentation/google.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 06, 2018, 04:03 PM
I gotta find time to do that.
Title: Re: Programming Thread
Post by: Legend on Mar 06, 2018, 04:26 PM
I gotta find time to do that.
Are you trying to learn Unity, or do you mean for Lumberyard?
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 06, 2018, 04:31 PM
Are you trying to learn Unity, or do you mean for Lumberyard?
Well either one.   ;D

Would like to do Lumberyard, but Unity might be a better segue. 

Being familiar with Unity is probably a plus whether I use unity or lumberyard at some point. 
Title: Re: Programming Thread
Post by: Legend on Mar 06, 2018, 04:37 PM
Well either one.   ;D

Would like to do Lumberyard, but Unity might be a better segue.  

Being familiar with Unity is probably a plus whether I use unity or lumberyard at some point.  
Unity is fairly easy especially if you like programing. You could probably pick it up in less than a day.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 06, 2018, 04:38 PM
Unity is fairly easy especially if you like programing. You could probably pick it up in less than a day.
Just have to find a day when I can work on stuff.  :D
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 06, 2018, 08:18 PM
Here comes first compiler test.  
First one done, and got the highest score.  96.5%
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 07, 2018, 12:20 AM
@Yo

Do you remember how to do precedence in a recursive descent parser?  
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 20, 2018, 05:20 PM
(https://i.redd.it/fpv90jjx4wm01.jpg)


I wonder if there are two stacks in the Bible.  That'd make it Turing Complete!  

@Yo

Do you remember how to do precedence in a recursive descent parser?  
Got 100% on it!  
Title: Re: Programming Thread
Post by: Legend on Mar 24, 2018, 04:42 AM
Shader programming is hard/fun. It's really unique withh how it runs.
Title: Re: Programming Thread
Post by: darkknightkryta on Mar 24, 2018, 12:52 PM
Shader programming is hard/fun. It's really unique withh how it runs.
Did they make shader compilers?  Last time I looked at them was about 10 years ago.
Title: Re: Programming Thread
Post by: Legend on Mar 24, 2018, 02:07 PM
Did they make shader compilers?  Last time I looked at them was about 10 years ago.
Yeah I thought they always had them?

Most shaders are instant but if you use newer features it can take a good few minutes to compile them.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 24, 2018, 02:28 PM
Shader programs are a little different because they don't run by themselves.  Instead they are run with C++, Java or a few others.  
Title: Re: Programming Thread
Post by: darkknightkryta on Mar 24, 2018, 03:02 PM
Yeah I thought they always had them?

Most shaders are instant but if you use newer features it can take a good few minutes to compile them.
They didn't.  Maybe Direct X had them, but OpenGl didn't.  
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 25, 2018, 07:13 PM
I haven't used stack overflow that much, but I am reading a thing about how bad they've gotten.  
Stackoverflow has a mod election going on:

2018 Moderator Election - Stack Overflow (https://stackoverflow.com/election?cb=1)

Several of them are bragging about how they delete and close many questions.  

That's just ludicrous.  

On another note.  I should make an American compiler for funsies.  

Arrays start at 1776.  Accessing 1775 will give a "the Redcoats are coming" error.  

The keyword for "class" will be "americanDream" .
There will only be one number type, doubles.  Numbers smaller than 1 will be switched for their greater/less than, so 1/4th will correctly be considered bigger than 1/3rd.  

I could do all kinds of terrible things.  
Title: Re: Programming Thread
Post by: Legend on Mar 25, 2018, 07:25 PM
I haven't used stack overflow that much, but I am reading a thing about how bad they've gotten. 
Stackoverflow has a mod election going on:

2018 Moderator Election - Stack Overflow (https://stackoverflow.com/election?cb=1)

Several of them are bragging about how they delete and close many questions. 

That's just ludicrous. 
Reddit devs dislike stack overflow a lot for that and I agree. I google and find links from them a lot and so often the question has been closed as a duplicate. Or people say the op is wrong and give a useless answer and mark it closed. Like if a person asks about speeding up the loops in a raymarch shader, the solution is not to get rid of the loops and use a different method! (I encountered something like that a few days ago)
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 26, 2018, 01:58 AM
How ludicrous would it be to learn how Unity works without being able to use it?  On the weekdays, I spend almost all day at school.  But they don't have any kind of unity at school of course.
Title: Re: Programming Thread
Post by: Legend on Mar 26, 2018, 03:00 AM
How ludicrous would it be to learn how Unity works without being able to use it?  On the weekdays, I spend almost all day at school.  But they don't have any kind of unity at school of course.
Since you already know programming, not that hard. You could definitely get a hang of how the scripting works at the very least.

Do you know about general game dev concepts from Lumberyard? That'd also help. Update() vs FixedUpdate() for example are just functions that are called either every frame or every n milliseconds.

Newer versions of Unity are trying to be more dev friendly and have pre-built methods of doing most things and learning those would really benefit from having access to Unity, but most of the time I use my own scripts for things.




Have you tried installing Unity on a flash drive? You could then use it at school without installing anything on their computers.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 26, 2018, 03:10 AM
Have you tried installing Unity on a flash drive? You could then use it at school without installing anything on their computers.

Thank you!  I didn't even think of doing this!  
Do you know about general game dev concepts from Lumberyard? That'd also help. Update() vs FixedUpdate() for example are just functions that are called either every frame or every n milliseconds.
I don't have too much from Lumberyard unfortunately.  
I did try starting a unity tutorial that my brother in law bought me from Udemy.  It's really slow paced though, because its made with the expectation that the watcher doesn't know any coding.  (I tried skipping all of that, but then they started diving into projects with code made.)
Title: Re: Programming Thread
Post by: darkknightkryta on Mar 26, 2018, 01:59 PM
I agree about the stack overflow.  They'll close unanswered questions, and the answer would be wrong.  

Talking about Stack Overflow reminded me of this comic:

(https://imgs.xkcd.com/comics/wisdom_of_the_ancients.png)
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 26, 2018, 02:24 PM
I agree about the stack overflow.  They'll close unanswered questions, and the answer would be wrong.  

Talking about Stack Overflow reminded me of this comic:

(https://imgs.xkcd.com/comics/wisdom_of_the_ancients.png)
Love that comic.  
Another problem: only question, OP says they figured it out. No answer posted.  
Title: Re: Programming Thread
Post by: darkknightkryta on Mar 26, 2018, 05:20 PM
Love that comic.  
Another problem: only question, OP says they figured it out. No answer posted.  
I fudgy hate that.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 28, 2018, 02:32 AM
Each project of my compilers class has been to implement something from scratch.  But then the next project, we use a tool to do that for us. It doesn't do exactly what our project did, it's for a far more complex grammar.  

Even the simple projects though, pretty easily become 1,000 lines of code.  

That's pretty what we've done so far, but the rest of the projects literally build on each other.  

The first one is about completing the parser.  Last two projects we have are pretty similar.  They will basically take something resembling java code, and output a MIPS program.  The last project includes stuff about getting classes to work.  Oh boy.  
Title: Re: Programming Thread
Post by: darkknightkryta on Mar 28, 2018, 04:01 AM
Each project of my compilers class has been to implement something from scratch.  But then the next project, we use a tool to do that for us. It doesn't do exactly what our project did, it's for a far more complex grammar.  

Even the simple projects though, pretty easily become 1,000 lines of code.  

That's pretty what we've done so far, but the rest of the projects literally build on each other.  

The first one is about completing the parser.  Last two projects we have are pretty similar.  They will basically take something resembling java code, and output a MIPS program.  The last project includes stuff about getting classes to work.  Oh boy.  
There's a reason why I dropped translators =D
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 07, 2018, 01:39 PM
These are pretty neat:
Shadertoy BETA (https://www.shadertoy.com/view/XtlSD7)
Shadertoy BETA (https://www.shadertoy.com/view/4sfGWX)

It'd be nice if there was a place to try Super Mario Bros in VR.  That one's not set up for it, and it's horrid.  
Title: Re: Programming Thread
Post by: Legend on Apr 07, 2018, 04:02 PM
These are pretty neat:
Shadertoy BETA (https://www.shadertoy.com/view/XtlSD7)
Shadertoy BETA (https://www.shadertoy.com/view/4sfGWX)

It'd be nice if there was a place to try Super Mario Bros in VR.  That one's not set up for it, and it's horrid.  
Shadertoy is a great website to spend way too much time at  ::)

Wouldn't Super Mario Bros be pretty standard in VR? Just a big flat wall?
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 07, 2018, 04:41 PM
Wouldn't Super Mario Bros be pretty standard in VR? Just a big flat wall?
Depends on how they set up the display.  Having the game display directly on the headset without simulating a TV feels very weird though.  Shadertoy has a VR mode for those, so I was able to try it out.  Ish.  Kind of didn't feel like a TV, but it didn't feel like VR either.  

New Super Mario Bros or LittleBigPlanet would be pretty awesome though.  
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 08, 2018, 01:42 AM
(https://i.redd.it/qghb61z3zhq01.png)
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 08, 2018, 03:55 AM
This networking assignment is a lot bigger than the previous ones.  Already at 650 lines of code.  

Not the biggest thing I've done this semester at least.  :P
Title: Re: Programming Thread
Post by: Legend on Apr 08, 2018, 04:12 AM
(https://i.redd.it/qghb61z3zhq01.png)
I heard about those tweets and loved it. Like if someone wanted to hack us we'd be screwed, but we do the standard things. Crazy how many companies have poor systems.

This networking assignment is a lot bigger than the previous ones.  Already at 650 lines of code.  

Not the biggest thing I've done this semester at least.  :P
Is that split up into separate files? I've always kinda prefered sticking lots of code together vs making unnecessary extra files so I'm a bad judge of what the industry considers large or not. (probably helps that no one but me has to read my code.)
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 08, 2018, 12:44 PM
I heard about those tweets and loved it. Like if someone wanted to hack us we'd be screwed, but we do the standard things. Crazy how many companies have poor systems.
Yeah, I'm just really hoping that person has no idea what they are talking about.

I don't have a whole lot of knowledge about security, there is a class about it next semester.  Not likely I'll be taking it, though.

But not storing passwords is like rule 0, I know that much.  

Is that split up into separate files? I've always kinda prefered sticking lots of code together vs making unnecessary extra files so I'm a bad judge of what the industry considers large or not. (probably helps that no one but me has to read my code.)
Separate files are all about putting stuff together that makes sense to put together. So there's not really a size.  Sometimes small makes sense, sometimes gigantic makes sense. I'm sure you're doing things the usual way.  

It's in 3 separate files, and they are all pretty tiny.  The files are server, client and game.  

We are making a Scrabble spin off.  

The server is only like 55 lines.  Servers are pretty easy.  

The game was a pain though, have to check 5 different conditions and like 3 of them required for loops, which needed their own if statement.  And two of those for loops we're actually embedded in the other.  
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 09, 2018, 02:43 AM
Servers and Clients feel weird to program.  

It just feels weird to have your server keep running, fix the client program, compile it, and then return to playing the game; all without doing anything to the server.  Server has no idea.  

It's obvious it can work this way, but actually doing it just feels weird.
Title: Re: Programming Thread
Post by: Legend on Apr 09, 2018, 04:02 AM
Servers and Clients feel weird to program.  

It just feels weird to have your server keep running, fix the client program, compile it, and then return to playing the game; all without doing anything to the server.  Server has no idea.  

It's obvious it can work this way, but actually doing it just feels weird.
How does the server not notice the client disappearing during the compile?
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 09, 2018, 11:22 AM
How does the server not notice the client disappearing during the compile?
The server and client are completely separate programs that just happen to connect to each other.  The only time the server knows about any of the clients is when they successfully make a connection, which only needs an IP address and a socket number.  

It feels weird.  You could make several different client programs connect to the server, even if each one is doing something completely different from the rest.  

You could end up connecting completely different clients, one that's trying to play the game and another that could be sending random messages.  
Title: Re: Programming Thread
Post by: Legend on Apr 11, 2018, 04:58 AM
The server and client are completely separate programs that just happen to connect to each other.  The only time the server knows about any of the clients is when they successfully make a connection, which only needs an IP address and a socket number.  

It feels weird.  You could make several different client programs connect to the server, even if each one is doing something completely different from the rest.  

You could end up connecting completely different clients, one that's trying to play the game and another that could be sending random messages.  
It's not real time I guess, that's what I was meaning.

Yeah I remember how weird it was learning about networking. Back in 2013 when VizionEck was still a PC game I was setting up multiplayer and it kinda shocked me how "fake" it is. I just kinda assumed multiplayer games would run on all systems as a shared program of sorts, instead of each system running a unique version of the game for that player. Like it blew my mind that one player they could see everyone as cubes yet the other player could see everyone as spheres by just building the executables separately.



I watched a GDC talk about light field rendering and it really made me nostalgic for my old work. ~10 years ago when I was building my light field displays I didn't know a thing about programing and actually rendered my first light fields manually over the course of a few weeks. Then I eventually set up an animation in Blender that could render the lightfield piece by piece as a video and then I'd composite every frame together. You have no idea how happy I was to be able to set up a light field within half an hour!

Nowadays it'd be almost trivial to setup Unity to run in real time on one of my light field displays.
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 11, 2018, 12:11 PM
It's not real time I guess, that's what I was meaning.

The server is set up not to care about the connection.  

If one of the players leaves, the server has no way of informing the other player.  But the other player can come back and start playing a different game.  

Yeah I remember how weird it was learning about networking. Back in 2013 when VizionEck was still a PC game I was setting up multiplayer and it kinda shocked me how "fake" it is. I just kinda assumed multiplayer games would run on all systems as a shared program of sorts, instead of each system running a unique version of the game for that player. Like it blew my mind that one player they could see everyone as cubes yet the other player could see everyone as spheres by just building the executables separately.

It's just weird and really cool.  On the one hand, it makes sense that it can be done that way and on the other hand it's so bizarre to actually do it that way.  
Title: Re: Programming Thread
Post by: darkknightkryta on Apr 11, 2018, 12:24 PM
It's not real time I guess, that's what I was meaning.

Yeah I remember how weird it was learning about networking. Back in 2013 when VizionEck was still a PC game I was setting up multiplayer and it kinda shocked me how "fake" it is. I just kinda assumed multiplayer games would run on all systems as a shared program of sorts, instead of each system running a unique version of the game for that player. Like it blew my mind that one player they could see everyone as cubes yet the other player could see everyone as spheres by just building the executables separately.



I watched a GDC talk about light field rendering and it really made me nostalgic for my old work. ~10 years ago when I was building my light field displays I didn't know a thing about programing and actually rendered my first light fields manually over the course of a few weeks. Then I eventually set up an animation in Blender that could render the lightfield piece by piece as a video and then I'd composite every frame together. You have no idea how happy I was to be able to set up a light field within half an hour!

Nowadays it'd be almost trivial to setup Unity to run in real time on one of my light field displays.
That's how networking has to be though.  Sending vertices is way cheaper on bandwidth than sending textures.
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 13, 2018, 06:51 PM
@Legend
Do you know much about formal grammars?

I feel like that's probably one of the bigger topics that programmers that are mostly self taught don't know about.  It's basically a central topic in like 3 CS courses.
Theory, Compilers, and PL.  It's not something that I really knew about before taking Theory.  I've seen a grammar before, when you shared the link about L-systems, but I wasn't really familiar with them until I took Theory.
Title: Re: Programming Thread
Post by: Legend on Apr 13, 2018, 10:51 PM
@Legend
Do you know much about formal grammars?

I feel like that's probably one of the bigger topics that programmers that are mostly self taught don't know about.  It's basically a central topic in like 3 CS courses.
Theory, Compilers, and PL.  It's not something that I really knew about before taking Theory.  I've seen a grammar before, when you shared the link about L-systems, but I wasn't really familiar with them until I took Theory.
Well to be frank, what is a grammar?
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 13, 2018, 10:59 PM
Well to be frank, what is a grammar?
They're a collection of rules that make words.  

S -> SS
S -> a

The words this grammar produces are a, aa, aaa, aaaa, aaaaa, aaaaaa, aaaaaa, etc onto infinity.  
Title: Re: Programming Thread
Post by: Legend on Apr 13, 2018, 11:26 PM
They're a collection of rules that make words.  

S -> SS
S -> a

The words this grammar produces are a, aa, aaa, aaaa, aaaaa, aaaaaa, aaaaaa, etc onto infinity.  
Well outside of programing stuff for conlangs then no I don't know much about them.
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 22, 2018, 07:02 PM
One of my slides for class:

Scoping Issues

Same name can be declared multiple times if the declarations occur in different scopes.  


This is a valid Java program:
public class Test{
     int Test;
     public void Test(){
         double Test;
    }
}

This is allowed in C++:
int Test(){

double Test;

  {
  bool Test;
  }

}
Title: Re: Programming Thread
Post by: darkknightkryta on Apr 24, 2018, 03:08 PM
I remember those grammars.  I learned about them in my formal langauges math course.
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 26, 2018, 08:02 PM
So in the next two weeks, I basically have to:
Finish a compiler, and finish a P2P file transfer program.  

All while keeping up with my other classes.  Ugh.
Title: Re: Programming Thread
Post by: darkknightkryta on Apr 26, 2018, 11:30 PM
So in the next two weeks, I basically have to:
Finish a compiler, and finish a P2P file transfer program.  

All while keeping up with my other classes.  Ugh.
There's a reason I dropped compilers  8)
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 27, 2018, 12:28 AM
There's a reason I dropped compilers  8)
It's so awful.  
Title: Re: Programming Thread
Post by: darkknightkryta on Apr 27, 2018, 12:38 AM
It's so awful.  
It's weird cause before the math teacher took over it wasn't bad.  You'd kind of brute force your compiler and just parse with if statements. That's how a programmer would go about it.  Once you add formal languages and the rest of the math it becomes a nightmare.
Title: Re: Programming Thread
Post by: the-pi-guy on May 02, 2018, 04:31 AM
So I'm working on the peer to peer file transfer program.  

Struggled for a few hours, with some issue that a third peer wouldn't respond to the first one:
1-->2-->3
Wasn't sure if the message wasn't getting sent or if the message wasn't getting delivered.  

Decided to not worry about it for a little bit, worked on something else.  Tried it again, randomly it worked.  what.  

I'm tired.
Title: Re: Programming Thread
Post by: the-pi-guy on May 09, 2018, 02:44 PM
The best language is lol code
HAI 1.2
CAN HAS STDIO?
PLZ OPEN FILE "LOLCATS.TXT"?
    AWSUM THX
        VISIBLE FILE
    O NOES
        INVISIBLE "ERROR!"
KTHXBYE
Title: Re: Programming Thread
Post by: Legend on May 09, 2018, 04:55 PM
The best language is lol code
HAI 1.2
CAN HAS STDIO?
PLZ OPEN FILE "LOLCATS.TXT"?
    AWSUM THX
        VISIBLE FILE
    O NOES
        INVISIBLE "ERROR!"
KTHXBYE
It hurts
Title: Re: Programming Thread
Post by: the-pi-guy on May 10, 2018, 11:51 AM
It hurts
I like it, because it's so stupid:

I didn't see example 3:
Code: [Select]

HAI 1.0
CAN HAS STDIO?
I HAS A VAR
IM IN YR LOOP
   UP VAR!!1
   VISIBLE VAR
   IZ VAR BIGGER THAN 10? KTHX
IM OUTTA YR LOOP
KTHXBYE


"IM OUTTA YR LOOP"   ....  wow.


I'd hate to use it though....  
Title: Re: Programming Thread
Post by: darkknightkryta on May 10, 2018, 12:51 PM
The best language is lol code
HAI 1.2
CAN HAS STDIO?
PLZ OPEN FILE "LOLCATS.TXT"?
    AWSUM THX
        VISIBLE FILE
    O NOES
        INVISIBLE "ERROR!"
KTHXBYE
I cried when my students showed me this a few years ago.  Good ol' lolcat langauge.
Title: Re: Programming Thread
Post by: the-pi-guy on May 11, 2018, 04:01 PM
https://www.reddit.com/r/gamedev/comments/8iivkj/7_months_progress_of_working_on_opengl_rts_engine/
Title: Re: Programming Thread
Post by: the-pi-guy on May 13, 2018, 07:28 PM
Compilers are huge beasts. 

I can't wait to be done.
Title: Re: Programming Thread
Post by: the-pi-guy on May 15, 2018, 03:24 AM
A compiler works in phases.  

There's the scanning(lexing) phase, the parsing phase, and then the code generation phase.  Technically you can split it up more.  The code generation phase is actually an intermediate phase, which gets followed by an optimization phase, which gets followed by another code generation phase.  That can get even more complicated than that.  

Lexing is done with a simple DFA.  
It's basically set up with 1000 if statements to match the input character by character.  
Read an i, that means it can be either:
-int
-identifier
-if
etc.  
Read an f, that means it can now be either a:
-if
-identifier

Read an = sign, take the input as an if.  But if you read a t, take the input as an identifier.  

Okay, it's probably usually closer to 100 if statements.  (Although it's not hard to imagine it blowing up even more.)

That's the scanning phase.  The output will be something like
if leftparen id equals id rightparen
etc, where each word is some meaningful thing in regards to the input.

Then that gets passed to the parser.  

The parser can be worked a few different ways.  
Some work really nicely with recursion.  Other's don't work as nice.

The way a language is set up is with a grammar.
Something like this:

Statement -> assign    
Statement -> print
assign -> id = value
print -> print(id)

Then the way the parser works, is that it'll basically check if the first thing is a print or an id.  Then it knows what should come next.  


The parser gives a tree for the code generation.  The bottom of the tree is whatever the first thing that needs to be done is.  

The tree is especially useful for statements like this:

x = x+5*y-3

It'll basically change it to something like:
sub(add(x,mul(5,y)),3)

Although it's not exactly obvious how that's a tree.  

Then the code generation uses that to make something like this:
li $t0, 5
lw $t1, y
mul $t1,$t1,$t0
etc.


Even a very simple 3 phase compiler, can quickly become a massive project.  

For the most part, they are not difficult to make.  

But even very simple ones are huge projects.  Very time consuming.

It does get a little tricky, need to set up some things to manage registers and memory locations.  But for the most part, they are time consuming more than difficult.  
Title: Re: Programming Thread
Post by: Legend on May 21, 2018, 04:31 AM
(https://i.redd.it/tfgiebsqa2z01.png)
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 02, 2018, 02:11 AM
Code: [Select]


public class Driver{
  public static void main(String[] args)
  {
   List l = new List();
    for(int i=0; i<12; i++){
     l.display();
     l.getNext();
     
    }
    System.exit(0);
  }
}

public class List{
  int[] current;
  int[] next;
 
  public List(){
    current = new int[1];
    next = new int[0];
    current[0] = 1;
  }
 
  public void add(int i){
    expand();
    next[next.length-1] = i;
   
  }
  public void expand(){
   int[] temp = new int[next.length+1];
    for(int i=0; i<next.length; i++){
      temp[i] = next[i];
    }
    next = temp;
  }
  public void getNext(){
    next = new int[0];
    for(int i =0; i<current.length; i++){
      if(current[i]>4 && (current[i]-4)%6==0){
       add(current[i]*2);
       add((current[i]-1)/3);
      }else{
        add(current[i]*2);
      }
     
    }
    current = next;
  }
 
  public int[] getCurr(){
   return current;
  }
 
  public void display(){
    for(int i =0; i<current.length; i++){
      System.out.print(current[i] + "   ");
    }
    System.out.println("");
   
  }
}


I threw together some code on my chromebook for the collatz conjecture.  And I don't really want to lose it.
It makes the tree of successors for where each values can go. 
Title: Re: Programming Thread
Post by: Legend on Jun 04, 2018, 02:47 AM
Microsoft Will Acquire Coding Site GitHub - Bloomberg (https://www.bloomberg.com/news/articles/2018-06-03/microsoft-is-said-to-have-agreed-to-acquire-coding-site-github)
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 04, 2018, 04:33 PM
Microsoft Will Acquire Coding Site GitHub - Bloomberg (https://www.bloomberg.com/news/articles/2018-06-03/microsoft-is-said-to-have-agreed-to-acquire-coding-site-github)
Microsoft confirms it will acquire GitHub for $7.5 billion - The Verge (https://www.theverge.com/platform/amp/2018/6/4/17422788/microsoft-github-acquisition-official-deal)

$7.5 billion
Title: Re: Programming Thread
Post by: Legend on Jun 05, 2018, 10:21 PM
(https://i.redd.it/fowf2ewub7211.png)
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 09, 2018, 01:54 AM
spl/fibonacci.spl at master · flowerhack/spl · GitHub (https://github.com/flowerhack/spl/blob/master/examples/fibonacci.spl)

This is the worst programming language.  
Title: Re: Programming Thread
Post by: darkknightkryta on Jun 09, 2018, 02:20 AM
spl/fibonacci.spl at master · flowerhack/spl · GitHub (https://github.com/flowerhack/spl/blob/master/examples/fibonacci.spl)

This is the worst programming language.  
I don't know, Python exists.
Title: Re: Programming Thread
Post by: Legend on Jun 09, 2018, 03:13 AM
I don't know, Python exists.
Hehe

I like python. Never really used it, but Blender uses it.

spl/fibonacci.spl at master · flowerhack/spl · GitHub (https://github.com/flowerhack/spl/blob/master/examples/fibonacci.spl)

This is the worst programming language.  
What does that example do?
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 09, 2018, 03:36 AM
I don't know, Python exists.
There are so many worse.  
Python is great. ::P

What does that example do?
I don't even know.  
I have a good idea of what a few lines do, but the whole thing is just bizarre.
Title: Re: Programming Thread
Post by: darkknightkryta on Jun 09, 2018, 12:16 PM
Python is terrible.  I would honestly rather program in x86.
Title: Re: Programming Thread
Post by: Legend on Jun 09, 2018, 04:08 PM
Python is terrible.  I would honestly rather program in x86.
Is that even doable?
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 09, 2018, 04:21 PM
Python is terrible.  I would honestly rather program in x86.
No it isn't.  
Is that even doable?
I'm assuming he means assembly.  
Unless he means binary.  Then he's way wrong.  
Title: Re: Programming Thread
Post by: Legend on Jun 09, 2018, 04:38 PM
No it isn't.  I'm assuming he means assembly.  
Unless he means binary.  Then he's way wrong.  
(https://imgs.xkcd.com/comics/real_programmers.png)
Title: Re: Programming Thread
Post by: darkknightkryta on Jun 09, 2018, 04:47 PM
Yes I would rather cornver x86 assembly into binary than program Python
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 23, 2018, 08:52 PM
So a while ago, I made up a matching game for Android for Japanese words.  
I kind of gave up on it.  There was a weird blue screen that im not sure where it comes from and loading the words takes way too long.

 
I want to go back and fix it up though.  
Title: Re: Programming Thread
Post by: Legend on Jun 25, 2018, 04:57 PM
So a while ago, I made up a matching game for Android for Japanese words.  
I kind of gave up on it.  There was a weird blue screen that im not sure where it comes from and loading the words takes way too long.

 
I want to go back and fix it up though.  
How were you loading the words?
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 25, 2018, 05:26 PM
How were you loading the words?
The least efficient way possible. (Literally)

Made an encoding so that I didn't have to worry about the encoding type not saving or reading properly.  

And every code has to be decoded to the correct character.  
Title: Re: Programming Thread
Post by: Legend on Jun 30, 2018, 02:30 AM
Maybe I should make my own server at home. It could be a cheaper way to store slow data.
Title: Re: Programming Thread
Post by: Legend on Jul 08, 2018, 11:28 PM
I'm updating from Unity 5.6 to 2018.1

Hopefully doesn't break too much  :P
Title: Re: Programming Thread
Post by: the-pi-guy on Jul 09, 2018, 12:42 AM
I'm updating from Unity 5.6 to 2018.1

Hopefully doesn't break too much  :P
Narrator: everything did.
Title: Re: Programming Thread
Post by: the-pi-guy on Jul 10, 2018, 09:23 PM
It feels kinda weird where im at with things.  

Like in a lot of areas, I have a really good amount of experience. Then there's other stuff where I have an idea but I don't exactly know the best thing to do there.

Like one thing I wonder about is how do open world games manage their characters and other objects.

You could have a giant list of all characters.
Or you could have smaller lists of characters in your vicinity.  It's all about trade offs, but sometimes one way is better enough to never bother with the second way.

Or maybe there's some other super brilliant way to do that kind of thing.  
Title: Re: Programming Thread
Post by: Legend on Jul 10, 2018, 09:33 PM
Narrator: everything did.
Well I did just waste a lot of time debugging only to realise their new set matrix function doesn't work correctly.  :P
It feels kinda weird where im at with things.  

Like in a lot of areas, I have a really good amount of experience. Then there's other stuff where I have an idea but I don't exactly know the best thing to do there.

Like one thing I wonder about is how do open world games manage their characters and other objects.

You could have a giant list of all characters.
Or you could have smaller lists of characters in your vicinity.  It's all about trade offs, but sometimes one way is better enough to never bother with the second way.

Or maybe there's some other super brilliant way to do that kind of thing.  
It's all about streaming that content in and out of memory. Essentially once you leave an area everything is deleted.

When you return, people and objects are loaded up again and placed based off time of day/weather.
Title: Re: Programming Thread
Post by: the-pi-guy on Jul 10, 2018, 09:35 PM
It's all about streaming that content in and out of memory. Essentially once you leave an area everything is deleted.

When you return, people and objects are loaded up again and placed based off time of day/weather.
Cool. That's what I figured.
Title: Re: Programming Thread
Post by: Legend on Jul 10, 2018, 11:24 PM
Cool. That's what I figured.
It'd be pretty cool if a game didn't work like that.

Imagine if every NPC was run off the GPU and kept active during the entire game. IE if there was some super immortal enemy it could just be slowly roaming around killing full cities while you're off on side quests.
Title: Re: Programming Thread
Post by: the-pi-guy on Jul 12, 2018, 04:03 AM
Forgot about this:
Become one with Legend: a software development thread Game Jam SIGNUP!  (http://gamrconnect.vgchartz.com/thread.php?id=179312&page=1)

Quote
GAME JAM!!!  (Sharing) Genre/topic:  Flappy bird clones!  
think-manJoeTheBro
Still not entirely sure how this game jam will be run, I'm accepting ideas!  

  

 With that said, if you want to make it a competition, make it a friendly one.  

 ---------------------------------------

 "Are people interested in non technical software/game development help as well? Level design, game mechanics, etc."

 Those who are interested speak up!  

 ----------------------------------------

  As this is a gaming forum, there are many of us who have dreams of doing something related to software.  And many of us specifically want to develop games.  I am making this to assist those that have an interest in developing software, whether that be games, or just software in general.  If you feel that a tutorial is not up to par, or have a tutorial for replacement, that would be much appreciated.  I'd like this to be an awesome resource for software developer enthusiasts or something.  There are so many tutorials, so much software available, so I can't put it all, but I'd like to put in as much that would be useful.  Any suggestions, compliments, insults would be very much appreciated.  Please and thank you!  

  

  

 
C++


 
http://www.cplusplus.com/doc/tutorial/ 
http://www.learncpp.com/ 
http://www.tutorialspoint.com/cplusplus/ 
http://www.pluralsight.com/training 

 
http://www.cprogramming.com/tutorial.html  


 
 

 
Java


 
http://www.learnjavaonline.org/ 
http://docs.oracle.com/javase/tutorial/java/ 
http://www.tutorialspoint.com/java/ 
http://www.pluralsight.com/training 
  
  
 


 
C#


 
http://www.tutorialspoint.com/csharp/ 
http://msdn.microsoft.com/en-us/library/aa288436(v=vs.71).aspx 
http://www.csharp-station.com/tutorial.aspx 
http://www.completecsharptutorial.com/ 
http://csharp.net-tutorials.com/ 
http://www.pluralsight.com/training 
Python 


 
http://docs.python.org/2/tutorial/ 
http://www.learnpython.org/ 
http://www.codecademy.com/tracks/python 
http://learnpythonthehardway.org/book/ 
http://www.pluralsight.com/training 
  
OpenGL


 
http://glprogramming.com/red/ 
http://www.arcsynthesis.org/gltut/ 
http://www.opengl.org/wiki/Getting_Started 
http://www.learnopengles.com/ 
  
  
Game Development Software


 
Development KitWeb SiteUsable languages
Game Makerhttp://www.yoyogames.com/ GameMakerLanguage
Unityhttp://unity3d.com/UnityScript, C#, Boo
Unreal Development Kithttp://www.unrealengine.com/en/udk/
 UnrealScript

 http://www.unrealengine.com/en/features/unrealscript/    http://wiki.beyondunreal.com/UnrealScript_overview

 
JmonkeyEnginehttp://jmonkeyengine.org 
   
   
  
Video tutorials!  

 http://thenewboston.org/tutorials.php

  

 IDE

 There's a bunch of IDEs, many of them support multiple languages.  It is best to download some that are more recent in updating.  If you need any help feel free to ask.  

 http://en.wikipedia.org/wiki/Comparison_of_integrated_development_environments

 http://www.codeblocks.org/

 https://www.eclipse.org/downloads/

 https://xamarin.com/   - mobile development.  

 Other softwares:  

 http://www.notepad-plus-plus.org/ 

 Notepad++ is a free "source code" editor.

 http://www.sublimetext.com/2

 Text editor for code, free as long as you don't register.  

 http://www.blender.org/

 Blender is a free and open source 3D computer graphics software used for creating animated films, visual effects, art, 3D printed models, interactive 3D applications and video games.    [/font][/size]

 Programming on the go with Android. - Haven't used either one, let me know your thoughts.  [/color][/size]

 https://play.google.com/store/apps/details?id=com.aide.ui&hl=en

 C/C++/Java

 https://play.google.com/store/apps/details?id=x.compiler&hl=en

  [/font][/size]This one apparently supports a whole bunch.  

 -------------------------------------------------------------------------------------[/font][/size]

 (http://www.streamhead.com/wp-content/uploads/2011/02/what_programming_language_to_learn.png/)

 Recommendation:

 Do NOT set out to make a game engine!  Make a game first. 

Title: Re: Programming Thread
Post by: the-pi-guy on Jul 14, 2018, 01:33 PM
A One-Letter Typo is (in Part) the Reason Aliens: Colonial Marines Sucked (https://gizmodo.com/a-one-letter-typo-is-in-part-the-reason-aliens-colon-1827595643/amp)
Title: Re: Programming Thread
Post by: Legend on Jul 14, 2018, 03:45 PM
A One-Letter Typo is (in Part) the Reason Aliens: Colonial Marines Sucked (https://gizmodo.com/a-one-letter-typo-is-in-part-the-reason-aliens-colon-1827595643/amp)
Oops.

How would that not throw an error message?
Title: Re: Programming Thread
Post by: the-pi-guy on Jul 23, 2018, 01:04 AM
(https://i.redd.it/1drzv99kdib11.jpg)
Title: Re: Programming Thread
Post by: Legend on Aug 01, 2018, 06:18 PM
I updated to the new version of Unity and Unity breaks all my models by forcing me to re-import them (even though they literally work perfectly fine without being re-imported).

Unity can be really dumb.
Title: Re: Programming Thread
Post by: Legend on Aug 06, 2018, 11:09 PM
I know I don't need it, but I really want to set up arbitrarily precise floating point numbers in Unity.

IE floats are 4 bytes and doubles are 8 bytes, but I want 16 bytes and 32 bytes!!!
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 07, 2018, 12:51 AM
I know I don't need it, but I really want to set up arbitrarily precise floating point numbers in Unity.

IE floats are 4 bytes and doubles are 8 bytes, but I want 16 bytes and 32 bytes!!!
I really like playing with the bigdecimal class in Java. Although I wish it was a little friendlier.  
Title: Re: Programming Thread
Post by: Legend on Aug 07, 2018, 12:59 AM
I really like playing with the bigdecimal class in Java. Although I wish it was a little friendlier.  
I'm jealous of bigdecimal. If I was in Java I could just use that.

What makes it unfriendly? I only know it exists but I don't know how it's used.
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 07, 2018, 03:41 AM
I could have swore there was something awful about it.  

But maybe I just didn't like that operations were done like:
One.add(two);
Title: Re: Programming Thread
Post by: Legend on Aug 07, 2018, 06:11 AM
I could have swore there was something awful about it.  

But maybe I just didn't like that operations were done like:
One.add(two);
Oh yuck why would you ever set something up like that!?
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 07, 2018, 04:33 PM
Oh yuck why would you ever set something up like that!?
I don't like it.  It gets messy with bigger programs.
Title: Re: Programming Thread
Post by: Legend on Aug 12, 2018, 04:29 PM
(https://i.redd.it/3whkjaq68mf11.jpg)
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 12, 2018, 05:37 PM
Sometimes I like working inside my limits even when it makes no sense to do so.  

Like I'm really tempted to make my RPG from scratch, instead of learning how to use a game engine.  
Title: Re: Programming Thread
Post by: Legend on Aug 12, 2018, 06:07 PM
Sometimes I like working inside my limits even when it makes no sense to do so.  

Like I'm really tempted to make my RPG from scratch, instead of learning how to use a game engine.  
Well making your own game engine could look pretty good on a resume.  :)
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 12, 2018, 06:46 PM
Well making your own game engine could look pretty good on a resume.  :)
Yeah.  That's pretty much the only good reason to, though.  
I've thought about it.
Title: Re: Programming Thread
Post by: Legend on Aug 12, 2018, 06:55 PM
Yeah.  That's pretty much the only good reason to, though.  
I've thought about it.
Well are there any cool features you'd want your RPG to have that'd make it unique? If you do make your own engine, then it'd be nice if players could tell it wasn't just an off the shelf solution.
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 12, 2018, 07:24 PM
Well are there any cool features you'd want your RPG to have that'd make it unique? If you do make your own engine, then it'd be nice if players could tell it wasn't just an off the shelf solution.
This is for my language learning game.  I want to flesh it out and make it awesome. 

But I don't know of any very unique features to make it stand out. 
Title: Re: Programming Thread
Post by: Legend on Aug 12, 2018, 07:34 PM
This is for my language learning game.  I want to flesh it out and make it awesome.  

But I don't know of any very unique features to make it stand out.  
Oh I guess I just jumped in to assuming a 2D rpg.

If you're making a 3d game engine, that's just so much freaking work. (or is your language game 2d?)
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 12, 2018, 07:43 PM
Oh I guess I just jumped in to assuming a 2D rpg.

If you're making a 3d game engine, that's just so much freaking work. (or is your language game 2d?)
I was thinking 2d like early Pokemon.

We cover this in a graphics course:

1. Graphics hardware, specifically the somewhat obsolete fixed function pipeline (OpenGL) and the programmable pipeline
(WebGL and GLSL) that has replaced it.
2. Two-dimensional graphics
3. Math necessities beyond the course prerequisites
4. Transformations in two- and three-dimensions
5. 3-D Viewing with the synthetic camera
6. Modeling 3-D shapes with polygon meshes
• Meshes obtained from various data collections
• Meshes obtained from "pure" mathematical surfaces, that is, surfaces with coordinates defined strictly from (paramet-
ric) functions.
• Approximating/interpolating curves and surfaces
7. Hierarchical modeling of 3-D objects
8. Lighting and Shading - the algorithmic rendering ladder
• The Phong reflection model and its variations, the Lambertian and Phong-Blinn models
• Gouraud shading
• Phong shading
• Texture mapping
• Bump mapping
• Reflection mapping
• Ray tracing
• Photon mapping
• Radiosity
9. Raster Algorithms - as time allows
Title: Re: Programming Thread
Post by: Legend on Aug 30, 2018, 12:12 AM
(https://i.imgur.com/KWiBfbZ.jpg)
Title: Re: Programming Thread
Post by: darkknightkryta on Sep 11, 2018, 01:51 PM
So I was looking to create a joypad to jamma interface with a Raspberry Pi.  Turns out Python is the only way to do it without stabbing yourself in the face with a soldering iron.  But since I'd rather stab myself in the face with a soldering iron than use Python, I've been looking at the memory mapped code used in C.  dang macros.  Took me about an hour, but I figured out the justs of it.  There's still some things I need to figure out with what it's doing with the memory addresses and how macros work(In my 4.5 years in university I never had to use a macro).  I'm almost in a state where I can use the code, but I still need to figure out how input works since the programmers felt an example using the built in resistors is more important than an example with input.
Never mind, I found the input code.
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 13, 2018, 07:00 PM
Do you ever run a program, and then it runs way faster or better than you expected, and you're totally convinced something must be up?

I wrote a program to check 500 billion combinations of numbers , and it finished in like 5 minutes.  That didn't seem so bad.
Title: Re: Programming Thread
Post by: Legend on Sep 13, 2018, 07:01 PM
Do you ever run a program, and then it runs way faster or better than you expected, and you're totally convinced something must be up?

I wrote a program to check 500 billion combinations of numbers , and it finished in like 5 minutes.  That didn't seem so bad.
Every day!

But normally that's because something actually is messed up.
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 16, 2018, 02:57 AM
So I have 5 graphics books (each that I got free/super cheap), and at least 2 other books that talk about graphics, but aren't their main subject.

It is kind of interesting looking over what topics each book covers.  

There's a lot of standard material like viewing, transformations, and lighting.  

But some of the books go much more in depth with a subject than the others.  And some seem to cover things the others don't at all.  Which is pretty cool.  
Like one of these books dedicates a full 20 page chapter to AA, whereas most of the other books only have about a page on it.  
One of these also has a chapter on fluid simulation and another on rotational physics.  

A couple of these books also dedicate a lot of space to things like fractals and ray tracing.  

One of them spends like 8 pages on hidden surface removal, and another spends like 30.  


I really want to get into all the material in these books.  Going to be a lot, I don't know when i'll have time.  

It's pretty cool, nonetheless.  
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 19, 2018, 06:33 PM
Quote
Twitch plays visual studio. That ought to be good.
https://www.reddit.com/r/AskReddit/comments/9h45ae/comment/e69jxyf

I've thought about something like this before.

It'd be awesome to make something that actually works this way.  
Title: Re: Programming Thread
Post by: Legend on Sep 19, 2018, 06:41 PM
https://www.reddit.com/r/AskReddit/comments/9h45ae/comment/e69jxyf

I've thought about something like this before.

It'd be awesome to make something that actually works this way.  
How would you get it to even produce viable code?
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 19, 2018, 06:54 PM
How would you get it to even produce viable code?
Honestly, I don't even think it could.  
Not that it's impossible, but it's close enough...  

But that's part of why it'd be cool to get something like that to actually work.
Title: Re: Programming Thread
Post by: Legend on Oct 03, 2018, 05:31 PM
I am so tired and I should not be programing. I was super confused debugging something since the output seemed impossible, but then I realised I had written Debug.Log instead of Debug.LogError on one line which was causing me to miss those reports. It had me pulling my hair out trying to figure out how the error didn't exist until the later section.

Then a couple minutes ago I was just using a Vector2 to calculate an angle instead of a Vector3, and was weirded out why I kept getting seemingly impossible results.
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 09, 2018, 02:40 PM
It's fun to figure out why things are going so slow. 

So I am making a program to calculate the partition function. 

I made an oversight while building it.

So basically it's a recursive function that depends on the results of smaller values.  So I figured a way to make it fast, would be to save the value in an array.  It basically checks if the value is 0, and then if it isn't it'll return the value.  This is nice, as the array starts off with all 0's, so any value that hasn't been calculated should be 0.

A problem here is that since I'm doing this function (mod 11), any function is likely to be 0 quite a bit of the time.  And it looks like this function is 0 (mod 11) a large portion of the time.  So the function sees that f(N) is apparently still 0 (figuring that it hasn't been calculated), and it decides to calculate it, returning 0. 

So I fixed it, by giving the array a number it can't have.  So a -1 means it hasn't been calculated yet, and a 0 is a 0. 

Way faster. 

Just to have a picture of how much faster:

In the improved function,
F(100) looks something like this:
 F(100) =F(99) + F(98) - F(95)-F(93)+F(88) + F(85)-F(78)-F(74)+F(65)+F(60)-F(49)-F(44)+F(33)+F(27)-F(14)-F(7)

For F(100), it should be 16 additions.

Instead, for the old function:
It would recalculate most of those, so for F(100), it was closer to 188 additions instead of 16. 
And actually it gets so, so, so, so much worse than that, because it would still have to recalculate all the values for F(99) in a similar fashion. 
And it would have to recalculate F(98) for both F(99) and F(100).  That might be another ~380 additions.
And it would have to recalculate F(95) for F(100), F(97), and F(96).  That might be another ~570 additions. 

We're likely at around 1000 additions to calculate 3 numbers, F(100), F(98), F(95), and that is basically assuming that we don't calculate any of the smaller numbers. 


So that should give you a picture of how stupidly, monstrously inefficient this one small error made for.

And if it does not.  I decided to put everything back, add in a variable to count how many additions it took to calculate F(100) and only F(100).

And it is a fricken monster of a number. 

Spoiler for Hidden:
<br>F(100) took 271196898 additions<br>


Like wtf. 


The new function gives me this output for 100:  (assuming all the previous values are calculated)
Spoiler for Hidden:
<br>F(100) took 16 additions<br>

Assuming none of the values are previously calculated, it comes to 1054 additions. 
Spoiler for Hidden:
<br>This program literally runs 16,949,806.13 times faster for F(100).&nbsp; <br>



So yeah, I'm feeling pretty giddy right now.
Title: Re: Programming Thread
Post by: Legend on Oct 09, 2018, 04:39 PM
I love when optimizations work out like that.

It's also amusing how the inefficiencies can sneak up on you. F(50) might be a blip on your computer so you assume it's all fine so then you try F(100) and get stuck waiting.
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 09, 2018, 04:51 PM
I love when optimizations work out like that.

I'm so giddy, this just feels insane.  
That's just an insane improvement.  

It's also amusing how the inefficiencies can sneak up on you. F(50) might be a blip on your computer so you assume it's all fine so then you try F(100) and get stuck waiting.
And that's exactly what happened.  
I was just doing 1 - 200, and the first 25 were almost instant.  And the next group was pretty fast.  But then I was waiting like 20 minutes, still wasn't done and the new values were taking a while to show up.  

That's when I realized something was up.  
Title: Re: Programming Thread
Post by: Legend on Oct 10, 2018, 05:20 AM
Unity has been so annoying as of late. Half the time I feel like I'm having to fight it. If I could just go into the source code and make a change things would be trivial, but no. Instead I have to make inefficient workarounds that are laughably stupid.
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 11, 2018, 02:29 AM
So a while ago, I made up a matching game for Android for Japanese words. 
I kind of gave up on it.  There was a weird blue screen that im not sure where it comes from and loading the words takes way too long.

 
I want to go back and fix it up though. 
And today, I finally did it.
 
Took about an hour to fix up the vocab importer. 
Got rid of all the inefficiencies.  Rebuilt the entire vocab list so the vocab importer could just take every word and save it.  I also strangely found a major error that somehow went unnoticed.  In my character importer when converting the unicode, I have a hexadecimal converter.  The issue is that the converter was built to manage 10=A, 11=B, 12=C, etc.  But the character list had a mix of lower case and upper case letters (not sure why I would have done that.)  So any characters that had a lower case in their encoding, did not get evaluated correctly. 

Instead of having to match every single character.  I knew this was super inefficient, but it had a good benefit at the time.  But the benefit doesn't outweigh the gigantic loading times.  Basically it would be on the order of 180,000,000 matches.  (Assuming 9000 vocab words * 2500 characters to match * 8 (made up average) average word length)   

So yeah.  That many matches on the computer is easy, but for a phone, it's ludicrous. 
Now it doesn't do any matching. 


To do:
-keyboard access for typing game (maybe just having a user text box would automatically open it.  Gotta figure that out)
-fix intro blue screen.  I still don't know where it comes from.  I don't know enough about Android software.  But basically when I launch a game, it starts off with a blue screen that disappears when I touch the screen.  My game still has a blue background.
-make it prettier
-also figure out some small issues, with some words being incorrectly marked incorrect.
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 11, 2018, 04:15 PM
Trying to install Android Studio on my laptop.
It's working but for some reason a bunch of things are missing. 
There's no android under the tools option. 
The emulator isn't there.

And after a good hour of trying to fix it, there's hardly anything online that has helped either problem. 

Finally got it.
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 13, 2018, 01:49 PM
.
It's like really, really good that my math function got fixed.  
Have to solve for the first ~250,000,000 numbers.  It takes a long time.  
Probably took about 10 hours.  
Not exactly sure.  I have it count how long, but the computer was also sleeping for a lot of the time.  (I have it running on my laptop)

Took about 20 hours overall.  It must have finished the first part just a few hours ago.  

Now I have a 600 MB text file with just numbers.

Soon I'll have 2.
Title: Re: Programming Thread
Post by: Legend on Oct 13, 2018, 02:46 PM
It's like really, really good that my math function got fixed.  
Have to solve for the first ~250,000,000 numbers.  It takes a long time.  
Probably took about 10 hours.  
Not exactly sure.  I have it count how long, but the computer was also sleeping for a lot of the time.  (I have it running on my laptop)

Took about 20 hours overall.  It must have finished the first part just a few hours ago.  

Now I have a 600 MB text file with just numbers.

Soon I'll have 2.
That's really nice. If it was ever so slightly slower, you'd feel like you did something wrong.

How did you handle memory for that? An array with 250,000,000 entries feels like it could have issues if just used willy nilly.
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 13, 2018, 02:57 PM
That's really nice. If it was ever so slightly slower, you'd feel like you did something wrong.
I actually sat down and did the math to see about how long it should take, assuming everything was working properly. 

Was well in line with what was happening. 

How did you handle memory for that? An array with 250,000,000 entries feels like it could have issues if just used willy nilly.
I just used an array. 

250,000,000 ints requires about 1 GB of space. 

(It's very good to have 16 GB of RAM).

I basically had a function like
Code: [Select]

f(N){
for( i=0; i<=N; i++)
array[i] = calculate(i);
}

Where calculate just calculates the number. 

All the previous calculations have to be accessible for the calculate function.
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 13, 2018, 04:22 PM
So it takes about 1 minute and 30 seconds to load 250 million ints from a file. 

Nice.
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 14, 2018, 01:56 AM
To do:
-keyboard access for typing game (maybe just having a user text box would automatically open it.  Gotta figure that out)
-fix intro blue screen.  I still don't know where it comes from.  I don't know enough about Android software.  But basically when I launch a game, it starts off with a blue screen that disappears when I touch the screen.  My game still has a blue background.
-make it prettier
-also figure out some small issues, with some words being incorrectly marked incorrect.
Mostly improved all of the above. 
Still not sure what to do with keyboard.
Title: Re: Programming Thread
Post by: Legend on Oct 14, 2018, 05:01 AM
Mostly improved all of the above.  
Still not sure what to do with keyboard.
Does android not have a simple keyboard popup method?
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 14, 2018, 05:51 AM
Does android not have a simple keyboard popup method?
Issue is, I don't think I want to use Android keyboard. I think I want more control with it.  A Chinese keyboard wouldn't give tone options, instead it would just suggest characters.  
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 17, 2018, 04:06 PM
So I just figured out the dumbest problem ever.  

Working on my app again, and trying to create a new project.  

First "activity" went fine.  
Second activity broke everything.

For some reason it isn't creating the R file.  

Google doesn't help.  I literally spent a few hours trying to figure this error out.  
So I tried recreating a project again.  

Tried everything again, same issue.  

Then I noticed that my match.xml file isn't being read as an .xml file.  

Finally the solution.  For some reason, android studio added "match.xml" should be read as a text file.  
Title: Re: Programming Thread
Post by: Legend on Oct 17, 2018, 04:08 PM
This thread is 90% posts about us debugging lol.
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 17, 2018, 04:46 PM
This thread is 90% posts about us debugging lol.
Debugging is hard.  :(
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 18, 2018, 01:22 PM
One thing that has been really awesome is seeing how much I remember from older classes.  

Like I've been helping people with their AI assignments, and my AI code from 2 years ago makes complete sense to me.
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 18, 2018, 03:44 PM
So my new app is on the way to being done.  

Vastly improved the vocab importer.  
-Doesn't rely on the slow character matching.  Saves a huge amount of time

-Also doesn't rely on silly limiters like it used to.  I had a bunch of stupid ways of how things were formatted.  A lot of very unnecessary marking for marking off where the pronunciation part ended and where the word begins.  Now it's set up to make the assumption that the first part is the character, the second part is the pronunciation, and the rest is the meaning description.    It means the files look nicer.  The only downside is if I were to start doing something in a language that did have spaces between words, it wouldn't work.  So if I wanted to make a spanish file with something like New York, it would break.   But it works great for languages without spaces.  Maybe I'll make it more dynamic someday.


Start Screen:
-Now the start screen has another button to toggle between languages.  Adding that change meant I had to make some changes to pretty much everything else.  Had to pass the language to whatever game was being started, and that had to be passed to the vocabimporter so that it'd get the right language.

Matching Game:
I made it more dynamic, so that it would ask the player different things.  
So instead of going from pronunciation to English meaning, it switches between every pair of (pronunciation, English, characters).

The worry I had was with Chinese.  Chinese has a ton of words that sound exactly the same, but mean wildly different things, so I added stuff to the matching game so that it'd make sure that there was only 1 correct choice.  So if it gave me shi, there'd only be one word or character to match with shi.  

So that's a lot of fun.  

Made a Chinese list for the words.  And ensured that it was working with the vocab importer.  

So huge improvements across the board.  

The only thing that isn't being worked on, is the writing game.  

The writing game will probably be the next and last thing that I do.  


That's where I wasn't sure what to do with the keyboard.  

Basically if you type in Chinese in the android keyboard, as far as I know, there aren't any pinyin options.  

So there's no way to differentiate between the 5 ways of spelling ma.
Depending on what android keyboard you were using, it either won't work, no difference, or it'll give the various Chinese options.  So that's a challenge, I'd like to avoid, and just make my own keyboard that does exactly what I want it to.

It won't be pretty or functional outside of the app, but in the context of the app, I think it'll be the best way to go about it.  
Far from being the most pretty thing, but this is the current state:

(https://farm2.staticflickr.com/1915/30468929997_969536d60f_o.png)
(https://farm2.staticflickr.com/1954/44494605865_a182143348_o.png)
Title: Re: Programming Thread
Post by: Legend on Oct 18, 2018, 04:04 PM
Congrats!

Why can't you use spaces in words? Could you not write them as an _ in your file and change it to a space when displaying it?
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 18, 2018, 04:12 PM
Congrats!

Why can't you use spaces in words?
There's not like a technical reason.  It just isn't set up that way (yet).  :D

Could you not write them as an _ in your file and change it to a space when displaying it?
I just had a different idea of how to go about it, but to be honest, this is a great idea.  
Would require minimal changes to the code too!  
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 19, 2018, 04:26 AM
So the last two challenges are:

Figuring out pinyin.  

So basically when I type something like mian, it has to know which lettersto put the tones over, depending on the setting.  

The other challenge is making it so that hard words show up more frequently.  
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 20, 2018, 03:58 AM
Figuring out pinyin.  
I believe this is all functional.  

I tried like 4 different methods of doing it.  But I ended up with the easiest way, by adding another user button to add 1,2,3, or 4 to the string. And then it basically adds that tone to the previous letter.  

A tiny speck more work for the user, but it saves the programmer an immense amount of work.  And since both of those are me, it ends up saving me time.  

Tomorrow I'm going to be testing it to ensure that everything works as it should, but so far it looks promising.  
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 21, 2018, 02:00 AM
I think unless I run into problems, I am not going to be adding anything more to my app.  

On to other projects.  :D
Title: Re: Programming Thread
Post by: Legend on Oct 21, 2018, 02:40 AM
I think unless I run into problems, I am not going to be adding anything more to my app.  

On to other projects.  :D
Woohoo you finished it!!!
Title: Re: Programming Thread
Post by: Legend on Oct 22, 2018, 08:02 PM
Maybe slightly off topic but kinda on topic.

Title: Re: Programming Thread
Post by: the-pi-guy on Oct 23, 2018, 05:06 PM
It's a little perturbing, when I am at school, and I am browsing facebook on the computers and I see the exact same amazon items I looked at, at home, in an ad.  

Like yep, Facebook has a copy of my amazon browser history.  
Title: Re: Programming Thread
Post by: Legend on Oct 23, 2018, 05:22 PM
It's a little perturbing, when I am at school, and I am browsing facebook on the computers and I see the exact same amazon items I looked at, at home, in an ad.  

Like yep, Facebook has a copy of my amazon browser history.  
They know too much!

It'll be very weird in a few years/decades once regular people become fully aware just how well they are tracked online.
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 24, 2018, 11:07 PM
(https://imgs.xkcd.com/comics/estimation.png)

Title: Re: Programming Thread
Post by: darkknightkryta on Oct 25, 2018, 02:22 AM
Yeah, I wonder when this is all going to come to a head.  I just hope I die before 1984 happens.
Title: Re: Programming Thread
Post by: Legend on Oct 25, 2018, 03:15 AM
Yeah, I wonder when this is all going to come to a head.  I just hope I die before 1984 happens.
Nah 1984 isn't realistic. We're barreling towards Brave New World instead.
Title: Re: Programming Thread
Post by: Legend on Oct 26, 2018, 03:54 PM
I need to learn c++ already. C# is great but I have to fight Unity far too much nowadays.
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 26, 2018, 04:01 PM
I need to learn c++ already. C# is great but I have to fight Unity far too much nowadays.
C++ isn't too far off from C#.
Only big things is memory control is very explicit, and pointers are a bit different .

Aside from that, you could probably learn C++ in like a day.  Enough to start using it, at least .
Title: Re: Programming Thread
Post by: Legend on Oct 26, 2018, 04:38 PM
C++ isn't too far off from C#.
Only big things is memory control is very explicit, and pointers are a bit different .

Aside from that, you could probably learn C++ in like a day.  Enough to start using it, at least .
The thing putting me off is visual studio. I write everything in Monodevelop and am not looking forward to switching over.  :P
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 28, 2018, 01:58 AM
Computers have a register called the program counter that keeps track of what line of the program is being run.  
PC:    instruction
110:  a=a+b
111:  print(a)
(Although of course, the instructions are going to be more simplified than that.).

But the PC gets incremented by separate hardware.  
But there are also control units to be able to select different values for the PC.  That's how loops and conditionals get implemented.  
Title: Re: Programming Thread
Post by: Legend on Oct 29, 2018, 05:14 AM
I love double precision way more than I should. Single precision floats just cause unnecessary problems a lot of times. Especially when first prototyping/getting the functionality working.
Title: Re: Programming Thread
Post by: Legend on Oct 29, 2018, 08:33 PM
(https://i.redd.it/csnjksoix3u11.jpg)
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 30, 2018, 06:07 PM
What can I do to make a cool chatbot?

 @Legend
Title: Re: Programming Thread
Post by: Legend on Oct 30, 2018, 06:16 PM
Like on the forum or in general?
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 30, 2018, 06:18 PM
Like on the forum or in general?
In general.  
Title: Re: Programming Thread
Post by: Legend on Oct 30, 2018, 06:21 PM
In general.  
The Machine is just hardcoded with simple replies. I don't really know anything about chatbots beyond what a 5 minute google search would show.
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 30, 2018, 06:34 PM
The Machine is just hardcoded with simple replies. I don't really know anything about chatbots beyond what a 5 minute google search would show.
This is what I was thinking to do.  

But now I'm somewhere between figuring out something a little smarter or making an AI bot.  
Some ideas I have for the former are like maybe having the bot save the previous response, and doing something more with it.  But really that's probably  something that shouldn't be messed with.

And now I'm feeling like the whole thing shouldn't be messed with.  
Title: Re: Programming Thread
Post by: darkknightkryta on Oct 30, 2018, 06:48 PM
You can always make a legit A.I. and have it take over the world via chat and memes.
Title: Re: Programming Thread
Post by: Legend on Oct 30, 2018, 07:32 PM
This is what I was thinking to do.  

But now I'm somewhere between figuring out something a little smarter or making an AI bot.  
Some ideas I have for the former are like maybe having the bot save the previous response, and doing something more with it.  But really that's probably  something that shouldn't be messed with.

And now I'm feeling like the whole thing shouldn't be messed with.  
What I've really loved is the concept of making an AI/chatbot that is just designed to "predict" how a human would respond. e.g. have the program go through every one of your posts on this website and figure out your general response patterns and just repeat them.
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 30, 2018, 08:34 PM
What I've really loved is the concept of making an AI/chatbot that is just designed to "predict" how a human would respond. e.g. have the program go through every one of your posts on this website and figure out your general response patterns and just repeat them.
I've had that exact thought....
Title: Re: Programming Thread
Post by: Legend on Oct 30, 2018, 08:58 PM
I've had that exact thought....
spoooky
Title: Re: Programming Thread
Post by: the-pi-guy on Nov 05, 2018, 12:51 AM
Looking at a problem for a class.  Guy who implemented it made some mistakes.  Trying to fix them for a good hour. 

All done, except one example still isn't giving the right answer.  I spend a good 30 minutes looking it over unable to find any issues. 

Frustrated I look at the updated assignment, and find out the teacher had the wrong answer for the last example. 
Title: Re: Programming Thread
Post by: the-pi-guy on Dec 21, 2018, 03:53 AM
So I've decided to make a little project.

Going to make a dumb chatbot to practice Japanese with.

It's going to have prewritten questions and responses, and it'll be set up to find the question that is closest to what the user has written.  
Title: Re: Programming Thread
Post by: the-pi-guy on Dec 31, 2018, 11:22 PM
So there's apparently a way to set up png's so they are viewed as different images depending on what system you are using to browse them.  


Saw it on reddit.
There's an image that shows up in Chrome as... something very naughty.

And it shows up in Photos on Windows as a picture of a tree.

Title: Re: Programming Thread
Post by: Legend on Jan 01, 2019, 01:34 AM
So there's apparently a way to set up png's so they are viewed as different images depending on what system you are using to browse them.  


Saw it on reddit.
There's an image that shows up in Chrome as... something very naughty.

And it shows up in Photos on Windows as a picture of a tree.


Yeah stuff like that is fun. Was it using this? Magic PNG Thumbnails - Tristan Hume (http://thume.ca/projects/2012/11/14/magic-png-files/)
Title: Re: Programming Thread
Post by: the-pi-guy on Jan 01, 2019, 01:41 AM
Yeah stuff like that is fun. Was it using this? Magic PNG Thumbnails - Tristan Hume (http://thume.ca/projects/2012/11/14/magic-png-files/)
Not sure how it was made.  
Title: Re: Programming Thread
Post by: the-pi-guy on Jan 19, 2019, 10:01 PM
So I want to make something to use with flash cards.
First thing I want is:
Cards that have a wrong streak should come up more often.  To give the person more practice.  
I'm thinking the last 20 attempts should be saved.  

This is pretty easy.  Store it as an int where the pattern is what was correct.  Simply shift.  Add 1 if it was correct.  Super efficient computationally.  

The other thing is, cards that haven't been used in a while should come up eventually.  

Saving the last few times a card was used, doesn't seem very efficient.  Saving the next time it's available seems to be the way to do it.  

It's not my favorite though.  

Next step up is saving the previous and the next.  Which is probably what I'll do.  
Title: Re: Programming Thread
Post by: Legend on Jan 20, 2019, 12:15 AM
You could order all the flash cards like a deck. After a card is drawn, it is put back into the deck based off its history. A correct card goes to the very back of the deck while a card that isn't correct goes in the middle or closer to the front depending on your stored int. As long as this algorithm is balanced correctly, you could pretty easily control the draw rate of cards based off their history while making sure the same cards are are drawn at roughly even intervals.

Random variation could be put in by drawing not necessarily the first card in the deck. Say 50% the first card is drawn, 25% the second, 12.5% the third, etc.


Title: Re: Programming Thread
Post by: Xevross on Jan 20, 2019, 01:33 AM
Oh I forgot about this thread. Might post in here a few times for help with my project.
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 06, 2019, 01:44 AM
I made a .jar file to automate a command line input that starts a (premade) server from a python command to make it easier to run a graphics demo written in javascript in a web browser.  
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 21, 2019, 08:58 PM
So we are learning about strictly functional programming.

Where absolutely everything is done using functions.

So there's nothing like a+b, instead, it's add(a,b)

And most things are done using recursion.
Title: Re: Programming Thread
Post by: Legend on Feb 21, 2019, 09:23 PM
So we are learning about strictly functional programming.

Where absolutely everything is done using functions.

So there's nothing like a+b, instead, it's add(a,b)

And most things are done using recursion.
Does that change things really?

I know in C# a+b calls a function anyway.
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 21, 2019, 09:41 PM
Does that change things really?

I know in C# a+b calls a function anyway.
Not in that case, but pure functional programming languages don't have for or while loops.

You have to do loops like this:

loop(i, limit){
if(lessThan(i,limit)){
   loop(add(1,i),limit)
}
}
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 22, 2019, 07:22 AM
So I spent way too much time trying to install a portal virtual machine. But it kept giving an error and the internet wasn't much help.  

Finally gave up.  Installed the regular version.  

After all that I spent a while trying to figure out the syntax for this program.  

Around midnight I was getting prepared to give up and finally some of the test cases were passing.  

Spent about an hour fixing them pretty easily.  Except two were giving bizarre errors that still don't make sense.  I ended up doing something weird.  

1-(2+3) was returning -22, which makes no sense.  However you look at it.  

Then I added 1*1-(2*1+3*1) and suddenly it was parsing correctly.  

I am wondering if JavaScript was taking the numbers as some weird encoded value.  But oh well.  I am done.
Title: Re: Programming Thread
Post by: Legend on Feb 22, 2019, 04:09 PM
So I spent way too much time trying to install a portal virtual machine. But it kept giving an error and the internet wasn't much help.  

Finally gave up.  Installed the regular version.  

After all that I spent a while trying to figure out the syntax for this program.  

Around midnight I was getting prepared to give up and finally some of the test cases were passing.  

Spent about an hour fixing them pretty easily.  Except two were giving bizarre errors that still don't make sense.  I ended up doing something weird.  

1-(2+3) was returning -22, which makes no sense.  However you look at it.  

Then I added 1*1-(2*1+3*1) and suddenly it was parsing correctly.  

I am wondering if JavaScript was taking the numbers as some weird encoded value.  But oh well.  I am done.
Haha yeah 2 and 3 must have been interpreted as strings so adding them produced 23. Multiplying by 1 forced javascript to think of them as numbers.
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 22, 2019, 04:33 PM
Haha yeah 2 and 3 must have been interpreted as strings so adding them produced 23. Multiplying by 1 forced javascript to think of them as numbers.
With how tired I was, I somehow still knew what was happening, but not really why.

Now that I'm rested, it's pretty obvious that's what was happening.  
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 23, 2019, 01:12 AM
The structure of a compiler:


Phase 1:  Lexical Analyzer: converts a file into tokens.  

This part of the compiler basically figures out where the keywords are.  Basically it goes through the file character by character, usually discarding the white space.  It's what figures out if "IF" identifies something or if it's the start of an if statement for example.  

Spoiler for A typical set of tokens that might be matched up::
<br>-ID<br>-DOUBLE<br>-INT<br>-IF<br>-THEN<br>-ELSE<br>-WHILE<br>-FOR<br>-SWITCH<br>-CASE<br>-STATEMENTS <br>--PRINT STATEMENT<br>--ASSIGNMENT STATEMENT<br>-LPAREN<br>-RPAREN<br>-MULT <br>-DIV<br>-PLUS<br>-MINUS<br>-MOD <br>


Phase 2:  Syntax Analyzer: converts list of tokens into a parse tree

The syntax analyzer matches up a string in a grammar to figure out how to build the parse tree.  

A simple grammar:
S -> S + S | S - S | T
T -> T * T  | T / T | U
U -> (S) | NUMBER
NUMBER -> (0-9)+

This grammar generates all expressions like 7+4*3, 1+2*3/4, etc.

But this grammar has a problem, it is ambiguous.  For each of the strings above, there are multiple different ways to build a parse tree that matches.
(https://upload.wikimedia.org/wikipedia/commons/0/0b/Leftmostderivations_jaredwf.png)

This means that the expressions like 1-4+3 could be interpreted different ways.
The compiler could run it like 1-(4+3) or (1-4)+3
We could get 0 or -6 in this case.  

So ambiguous grammars are bad, because they can lead to those kinds of problems.
For the simple expressions like these, we need something that does:
-Precedence (multiplying comes before adding)
This is done by having operations with higher precedence lower in the grammar.
-Associativity (whether a-b-c is interpreted as a-(b-c) or (a-b)-c )
This is done by matching each left associative operation with a left recursive production and same with the right.  This looks like:
A -> A * B | B / A
B -> NUMBER

In this example, multiplication is left associative, and division is right associative.  So in the division example a/b/c/d, the compiler would solve c/d first.

Phase 3: Semantic Analyzer

This phase does things like type checking.  You'll basically run through the parse tree and make sure that the types match.

Phase 4:  Intermediate code generation

This phase goes through the parse tree to build the code.

This part can be pretty tricky.  You want to do things like building a symbol table to keep track of where a variable gets used and to keep track of scope.  
Have to be able to access the symbol table to know whether you're in the local variable space for x.  

If your compiling into assembly, you'll need to keep track of what memory locations are used for what variables, as well as what variables are in what registers.
An expression like  
a = a + b;
int c = a + b;
might have to become something like (in more like psuedocode):
load register1, a
load register2, b
add register1, register1, register2
store a
add register3, register1, register2
store c

Phase 1,2 and 4 are essentially the minimum of what a compiler needs.  

A good compiler is also going to have phases for code optimization, and final code generation.

A fancy compiler can have some pretty sophisticated processes for code optimization.  

Some things that can be done include looking at the exit condition for a function.  I recall seeing that gcc will actually simplify the following code:

function square(int x){
int i = 0;
  while(i<x*x){
i++;
}
return i;
}

into the following:

function square(int x){
return x*x;
}

I don't know if that's actually what the example was, but it was something like that.
Title: Re: Programming Thread
Post by: Legend on Mar 12, 2019, 12:59 AM
I know every single thing online always says "never make your own game engine," but I'm getting really excited about starting mine. The primary goal is to make an engine for my 4D game but ideally I'd use this engine for all my games going forward. A few things I'd like

Good alt version support. Unity is great at making a game run on multiple systems but it still has lots and lots of things that only work by making separate projects for each SKU. I'd like my engine to have a system where SKUs are easy to define and automatically handled. (as an extreme example, a demo would exist in the same project as the full game instead of being forked off)

Decent scalability. I realised that I tend to make niche games that can be really exciting for people that don't consider themselves video game players. It would be smart to make an engine that can run on older computers. It doesn't need to look good, but it should be able to run smoothly.

High precision. Doubles and longs should be used on most things. First of all I just like them, secondly I tend to use complex geometry where imprecision adds up, thirdly suspend/resume mean that games can run for weeks without being reset, and fourthly I'd love to make a space game one day.

Splitscreen/local multiplayer support. Goes without saying.

Rock solid frame rates. The actual act of rendering should be safe to perform at any time. Essentially the camera and critical components are guaranteed to update every frame but other things can be skipped as needed. Basically asynchronous timewarp but built into the game and available even in 2D. The game should have a steady framerate but this is a safety net.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 22, 2019, 02:07 PM
-Trying to install an IDE
-Won't install, due to build problems
-can't find any help because every google result is about the IDE not building a program, and not the other way around....  
Title: Re: Programming Thread
Post by: darkknightkryta on Mar 22, 2019, 03:20 PM
So we are learning about strictly functional programming.

Where absolutely everything is done using functions.

So there's nothing like a+b, instead, it's add(a,b)

And most things are done using recursion.
Dr. Racket?
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 22, 2019, 03:31 PM
Dr. Racket?
We are using JavaScript.  
Title: Re: Programming Thread
Post by: darkknightkryta on Mar 23, 2019, 04:24 AM
We are using JavaScript.  
Oh.  The University of Waterloo here created a language that sounds exactly as you described.  
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 23, 2019, 04:28 AM
Oh.  The University of Waterloo here created a language that sounds exactly as you described.  
It's not that the language doesn't do other things, we just aren't allowed to do those things...  
Title: Re: Programming Thread
Post by: darkknightkryta on Mar 23, 2019, 05:56 PM
It's not that the language doesn't do other things, we just aren't allowed to do those things...  
That sounds excessive. "I'm going to force my way of programming on my students and teach nothing practical".  Unless this is some weird data structure class.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 23, 2019, 06:23 PM
That sounds excessive. "I'm going to force my way of programming on my students and teach nothing practical".  Unless this is some weird data structure class.
It's just the functional programming part of the course.  We are just required to make all our functions in the form of functional programs, so we arent allowed to use non-functional programming techniques.  

I know every single thing online always says "never make your own game engine," but I'm getting really excited about starting mine. The primary goal is to make an engine for my 4D game but ideally I'd use this engine for all my games going forward. A few things I'd like

Good alt version support. Unity is great at making a game run on multiple systems but it still has lots and lots of things that only work by making separate projects for each SKU. I'd like my engine to have a system where SKUs are easy to define and automatically handled. (as an extreme example, a demo would exist in the same project as the full game instead of being forked off)

Decent scalability. I realised that I tend to make niche games that can be really exciting for people that don't consider themselves video game players. It would be smart to make an engine that can run on older computers. It doesn't need to look good, but it should be able to run smoothly.

High precision. Doubles and longs should be used on most things. First of all I just like them, secondly I tend to use complex geometry where imprecision adds up, thirdly suspend/resume mean that games can run for weeks without being reset, and fourthly I'd love to make a space game one day.

Splitscreen/local multiplayer support. Goes without saying.

Rock solid frame rates. The actual act of rendering should be safe to perform at any time. Essentially the camera and critical components are guaranteed to update every frame but other things can be skipped as needed. Basically asynchronous timewarp but built into the game and available even in 2D. The game should have a steady framerate but this is a safety net.

How's it going?
Title: Re: Programming Thread
Post by: Legend on Mar 23, 2019, 06:52 PM
How's it going?
Still holding off from writing any code until Twisty Puzzle Simulator is out on Steam.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 24, 2019, 03:42 AM
So I have 2 books that cover general AI techniques, another one for natural language understanding, and another for machine vision.  

I haven't been able to delve into any of them, except for my AI class, but I'm really excited to be able to do that.  
Title: Re: Programming Thread
Post by: Legend on Mar 24, 2019, 05:06 AM
Still holding off from writing any code until Twisty Puzzle Simulator is out on Steam.
I am really starting to think this might be a good idea for all my games going forward and not just my 4D game.

As it is now I essentially create a new game engine for each game (outside of the core fundamental structure of Unity). VizionEck Cube Royale has a from scratch menu system, VizionEck Adventure has a seperate from scratch menu system, and Twisty Puzzle Simulator has "3" from scratch menu systems. It'd save so much time if I just had one core menu system that I could reuse.

Also Unity depreciated the low level transport layer I used to write my own multiplayer with. I knew UNet was getting the axe but I guess I just assumed the low level stuff would be safe. Yay.
Title: Re: Programming Thread
Post by: Legend on Apr 26, 2019, 03:00 AM
Give a man a game and he'll have fun for a day. Teach a man to make games and he'll never have fun again.
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 26, 2019, 03:15 AM
Give a man a game and he'll have fun for a day. Teach a man to make games and he'll never have fun again.
I too subscribe to r/gamedev.  
Title: Re: Programming Thread
Post by: Legend on Apr 26, 2019, 04:03 AM
I too subscribe to r/gamedev.  
I knew people would know I copied it from somewhere so I didn't bother sourcing it, but I didn't expect you to know the specific subreddit!
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 26, 2019, 12:45 PM
I knew people would know I copied it from somewhere so I didn't bother sourcing it, but I didn't expect you to know the specific subreddit!
Wow, I just misread this seriously.

But yes.  :D
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 26, 2019, 06:17 PM
In PL we are learning about different ways to pass parameters.  

f(a,b){
b=a+b;
}

main(){
int a=1, b=2
f(a,b);
print(a, b)
}

by value: 1 2
by reference: 1 3
copy by value: 1 3
macro: 1 3

You can get wildly different answers, just depending on how things are evaluated.
Title: Re: Programming Thread
Post by: Legend on Apr 26, 2019, 06:56 PM
In PL we are learning about different ways to pass parameters.  

f(a,b){
b=a+b;
}

main(){
int a=1, b=2
f(a,b);
print(a, b)
}

by value: 1 2
by reference: 1 3
copy by value: 1 3
macro: 1 3

You can get wildly different answers, just depending on how things are evaluated.

I was so confused when I first started realising arrays in C# were passed by reference instead of by value. At that time I only thought it happened to objects.
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 26, 2019, 10:07 PM
I was so confused when I first started realising arrays in C# were passed by reference instead of by value. At that time I only thought it happened to objects.
Aye!  


They kind of drill in the difference of how it works in school.  Especially right now.  


I didnt know about all these other ways.  

Copy restore is like in the middle of reference and value.  It basically copies the value, but at the end it writes the values back to the reference values.  


Macro expansion is weird.  You basically copy the function lines into the calling function, and then replace the variables by the ones being called in.  

So something like this:
f(c,d){
d=c+d
}

main(){
int a=1, b=2
f(a,b);
print(a, b)
}


Becomes:

main(){
int a=1, b=2
b=a+b;
print(a, b)
}


This has the unfortunate side effect that a reference to a global variable could get replaced by a local variable in a completely different function.
Title: Re: Programming Thread
Post by: Legend on Apr 26, 2019, 10:45 PM
Is macro done by the compiler? I've heard of that being done where it's less of a function and more of just a way to avoid writing the same few lines of code in a lot of places.
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 26, 2019, 11:50 PM
Is macro done by the compiler? I've heard of that being done where it's less of a function and more of just a way to avoid writing the same few lines of code in a lot of places.
Yeah, all managed by the compiler.  

I don't think any compilers actually use macros for evaluation, but it is there.  
Title: Re: Programming Thread
Post by: Legend on Apr 30, 2019, 05:24 AM
(https://i.redd.it/6b7und8rs1v21.png)
Title: Re: Programming Thread
Post by: the-pi-guy on May 01, 2019, 02:05 PM
I'm really tired and frustrated.  Still making progress.  Forgot I made changes before running the program again, and was confused why it was suddenly working.  
Title: Re: Programming Thread
Post by: the-pi-guy on May 02, 2019, 05:34 PM
Grammars are frustrating beasts.  

Trying to add a feature for an assignment, and for some reason the grammar is expecting '}' in a program, despite the fact that the only way to get there is by having a for statement.
So it's expecting something that there doesn't seem to be any reason it should be expecting.
Title: Re: Programming Thread
Post by: the-pi-guy on May 03, 2019, 03:32 AM
Me right now:
(https://pics.me.me/it-is-done-when-you-stay-up-all-night-and-37542038.png)
Title: Re: Programming Thread
Post by: the-pi-guy on May 05, 2019, 11:48 PM
So I have to work on this program that is being taken out of a physics book.

The assignment is to fill in some missing pieces to make it work, is what I was told to do.  

I'm pretty sure I messaged someone about this already.  But there's so much awful stuff here.  It's frustrating.  


Probably mostly a recap:

there's weird function definitions like:
function(i,j,k)
int i, j, k;  {


}


I'm wondering if the writer ever actually tried running the code.  I don't think that'd compile in C.  

It looks like that's what you're supposed to do in fortran?  I'm just guessing, because there's some parts of fortran also in the lines of code.  

There's also frustrating stuff like, in the fortran code it very clearly says "chapter".  It's not even a smudge, but based off context and fortran keywords, it's supposed to be "character".  


This whole assignment is becoming more like:
-copy this program, while fixing the typos, and fill in the blank spaces where you have no idea what's supposed to be happening.  
Title: Re: Programming Thread
Post by: Legend on May 06, 2019, 06:23 AM
That doesn't look fun. Is this a popular course with lots of other people complaining about the program online?
Title: Re: Programming Thread
Post by: the-pi-guy on May 06, 2019, 03:19 PM
That doesn't look fun. Is this a popular course with lots of other people complaining about the program online?
Nope.
I can't find anyone talking about the book in the first place.  
Title: Re: Programming Thread
Post by: Legend on May 06, 2019, 07:12 PM
https://www.reddit.com/r/funny/comments/bldzyn/technologically_advanced/ (https://www.reddit.com/r/funny/comments/bldzyn/technologically_advanced/)

All the comments are about software development. Sounds about right.
Title: Re: Programming Thread
Post by: darkknightkryta on May 09, 2019, 02:25 PM
So I have to work on this program that is being taken out of a physics book.

The assignment is to fill in some missing pieces to make it work, is what I was told to do.  

I'm pretty sure I messaged someone about this already.  But there's so much awful stuff here.  It's frustrating.  


Probably mostly a recap:

there's weird function definitions like:
function(i,j,k)
int i, j, k;  {


}


I'm wondering if the writer ever actually tried running the code.  I don't think that'd compile in C.  

It looks like that's what you're supposed to do in fortran?  I'm just guessing, because there's some parts of fortran also in the lines of code.  

There's also frustrating stuff like, in the fortran code it very clearly says "chapter".  It's not even a smudge, but based off context and fortran keywords, it's supposed to be "character".  


This whole assignment is becoming more like:
-copy this program, while fixing the typos, and fill in the blank spaces where you have no idea what's supposed to be happening.  
I can't remember specifically, but I do remember looking at "old" C and it looked something like that.  It might actually be right... if it was written in the 70s.
Title: Re: Programming Thread
Post by: the-pi-guy on May 11, 2019, 12:36 AM
.
There's one thing I'm also having issues with.
The book isn't consistent with where the code continues.  All of the code is in two columns.

It looks like they printed off the code, and then photocopied it for the book. 

The reason I think this is because there's a weird cutoff in one of the pages, and at that spot, the code continues on the previous page's right column.

If each quote block is a printed page, with the left and right columns, it looks like this:
Quote
Header

f = 32;print g

Quote
g = f + 2done


Header

Add it to the pile of things that piss me off about this.

F it gets even worse. 

It literally has a section of code that ends 1/4th of the column on one page, and then it returns to the previous page, and the rest of the column is a completely different method. 
Title: Re: Programming Thread
Post by: the-pi-guy on May 12, 2019, 03:47 PM
Finally got that to the point where it runs.  
Not sure if it's correct or anything, but still great.  

Working on game project now.  

Have to figure out how I want the player to move.  The starter code has it set to move really slow which doesn't feel very satisfying.  

Have a rough idea of what I want to do, but I'm feeling intimidated.  
Title: Re: Programming Thread
Post by: Legend on May 12, 2019, 04:34 PM
Finally got that to the point where it runs.  
Not sure if it's correct or anything, but still great.  

Working on game project now.  

Have to figure out how I want the player to move.  The starter code has it set to move really slow which doesn't feel very satisfying.  

Have a rough idea of what I want to do, but I'm feeling intimidated.  

Code: [Select]
if(playing){
    player.Move();
}


;)
Title: Re: Programming Thread
Post by: the-pi-guy on May 12, 2019, 04:47 PM
Code: [Select]
if(playing){
    player.Move();
}


;)
I think it can all be managed by:
Code: [Select]

while(gameRunning){
    game();
}



Title: Re: Programming Thread
Post by: the-pi-guy on May 13, 2019, 01:22 PM
It's going to be hard to finish the game.  :(

It's due tomorrow night and I've barely started.
Title: Re: Programming Thread
Post by: the-pi-guy on May 14, 2019, 04:25 AM
It's going to be hard to finish the game.  :(

It's due tomorrow night and I've barely started.

Might be able to finish it tomorrow.  There's a chance.  A lot of anxiety either way though.  
Title: Re: Programming Thread
Post by: Legend on May 14, 2019, 04:28 AM
Might be able to finish it tomorrow.  There's a chance.  A lot of anxiety either way though.  
You can do it!!!  ;D
Title: Re: Programming Thread
Post by: darkknightkryta on May 14, 2019, 10:54 AM
Just remember.  Moving a sprite from one end to another can be a game XD
Title: Re: Programming Thread
Post by: the-pi-guy on May 14, 2019, 05:45 PM
Is there a quick and dirty way to do collision detection based off one location and the next one?
Title: Re: Programming Thread
Post by: Legend on May 14, 2019, 08:19 PM
Is there a quick and dirty way to do collision detection based off one location and the next one?
Only for spheres or aligned cubes.

Or is this 2d?
Title: Re: Programming Thread
Post by: the-pi-guy on May 14, 2019, 08:44 PM
Only for spheres or aligned cubes.

Or is this 2d?
3D, mostly cubes.  

I came up with a quick and dirty method.  :P

Not something that I'd use for a real game, but for a homework assignment that I haven't spent much time on, I think it'll be okay.  

Just going to make a bubble around each game object, and return true if two objects are sufficiently close.  
Title: Re: Programming Thread
Post by: the-pi-guy on May 14, 2019, 11:02 PM
I am making a zombie horde mode.  :P

I'm having a lot of fun, actually.... 


Need to dos:
-Add lighting source
-make new ground
-make better projectiles
-add score
-make zombies appear

-give zombies AI
-other stuff I haven't thought of yet.
Title: Re: Programming Thread
Post by: Legend on May 14, 2019, 11:53 PM
Don't forget sound effects and music!

I want you to find a mic and say "brains" over and over.
Title: Re: Programming Thread
Post by: the-pi-guy on May 15, 2019, 02:10 AM
Don't forget sound effects and music!

I want you to find a mic and say "brains" over and over.
Sound effects is low priority.  :P

This is a lot of fun.   A lot of small victories.  A few big victories. 

Oddly enough adding text was one of the harder things. Because webgl doesn't have a way to add text.  So you have to add another canvas to place on top of the main canvas that is clear.  And then add text to that using a different context. 

While my zombies are rectangular prism shaped, I still feel proud of this. 
Title: Re: Programming Thread
Post by: the-pi-guy on May 15, 2019, 03:54 AM
Ugh, I'm gonna turn it in late.  

My game doesn't require a lot of stuff that's required for the assignment. The game itself is like 80% done, it only has like 20% of the list.  

So I have to figure out some stuff to add...
Title: Re: Programming Thread
Post by: the-pi-guy on May 15, 2019, 10:48 PM
I had a fun little bug this morning.

Was playing the game and I noticed that the collision detection only worked once.   So I was making sure the wait variable was getting assigned correctly.  Everything seemed correct. 

Turned out I had two bugs. 

The first was that the villain would get thrown upwards (as intended) but they stayed there. 

How did not notice? 
In with the second bug the "villains" were not getting drawn properly.  The modelview matrix not take into account the height of the villain. 

So the zombie was in the air, but still being drawn on the ground.

Thought it was fun how two bugs worked together so well to look like a bug somewhere else. 
Title: Re: Programming Thread
Post by: Legend on May 17, 2019, 04:25 PM
Looking for advice/feedback.

For my RPG, the final look of the game is a 2D fantasy map. I'm not sure how I can render this.

Essentially it's like Google maps where the camera can show the whole world or zoom in close to the player.

65,536×65,536 pixels for the whole map.

I think what I need to do is create a render function that can replace texture streaming. Give it an x,y position and a zoom factor and it'll produce that texture.

2048x2048 texture for around the camera. 1024x1024 texture at quarter res for around that, 512x512 texture at 1/16 res around that. first texture has a backup texture for rendering into.

Or I could do a sparce quad tree. Render into a 2048x2048 buffer and populate the quadtree from that. Sounds better since data wouldn't overlap and merging quads as they get away from the camera would be cheap. Downside is that I'd need a custom shader to draw this quadtree on screen. Could be too slow for VR.
Title: Re: Programming Thread
Post by: the-pi-guy on May 18, 2019, 03:40 PM
Looking for advice/feedback.

For my RPG, the final look of the game is a 2D fantasy map. I'm not sure how I can render this.

Essentially it's like Google maps where the camera can show the whole world or zoom in close to the player.

65,536×65,536 pixels for the whole map.

I think what I need to do is create a render function that can replace texture streaming. Give it an x,y position and a zoom factor and it'll produce that texture.

2048x2048 texture for around the camera. 1024x1024 texture at quarter res for around that, 512x512 texture at 1/16 res around that. first texture has a backup texture for rendering into.

Or I could do a sparce quad tree. Render into a 2048x2048 buffer and populate the quadtree from that. Sounds better since data wouldn't overlap and merging quads as they get away from the camera would be cheap. Downside is that I'd need a custom shader to draw this quadtree on screen. Could be too slow for VR.
Have you looked at how that's usually implemented?  Is there some limitation with those that you are trying to avoid?  
Title: Re: Programming Thread
Post by: Legend on May 18, 2019, 05:08 PM
Have you looked at how that's usually implemented?  Is there some limitation with those that you are trying to avoid?  

I can't save the full image so I need to re render a lot of times.
Title: Re: Programming Thread
Post by: the-pi-guy on May 19, 2019, 12:06 PM
I'm saving this for later:
The Man Behind The Curtain (http://www.codersnotes.com/notes/the-man-behind-the-curtain/)
Title: Re: Programming Thread
Post by: the-pi-guy on May 20, 2019, 12:52 AM
I can't save the full image so I need to re render a lot of times.
Sorry, I don't think I can help.
Title: Re: Programming Thread
Post by: the-pi-guy on May 20, 2019, 01:12 AM
So I would like to make a math program sometime, basically allowing:

-user text to input equations with the usual operations
-user to save functions
-user to save variables
-degrees/radians
-other bases

Must haves:
-cos, sec + inverses
-sin, csc + inverses
-tan, cot + inverses
-lg
-log
-ln
-logx
-The usual operations:  ^, *, /, +, -, !, |, &, =, !=, <, >, <=,>=, %
-Maybe a special operation to allow mixed bases
-(, )
-(mod x)

User will set variables or functions using set keyword:
User: set x = 5
User: x
System: 5

User set f(x) = 2*x
User: f(x)
System: 2*x

User: f(3)
System:  6

Nice to haves:  (Will probably get too bored to do these:)
-matrix features
-a more robust editor
-list features {2,3,4} * 5 = {10, 15, 20}
-other fancy features: special functions like prime counting function, function to return if p is prime
Title: Re: Programming Thread
Post by: the-pi-guy on May 21, 2019, 01:31 PM
In progress:

set_func-> set id( args ) = statements

any_exp -> bool_exp | set_exp | mod_exp
bool_exp -> (bool_exp bool_op bool_exp) | exp op exp | true | false | null
set_exp -> SET id = any_exp
mod_exp -> exp (MOD exp)

exp -> exp + factor | exp - factor
factor -> factor * fact | factor / fact | factor % fact
fact -> fac ^ fact
fac -> term !
term -> (exp) | real | id | id( in_args )

op -> = | != | >= | <= |  < | >
bool_op -> || &

statements -> while bool_exp { statements }
statements -> if bool_exp { statements } (else{ statements })?
statements -> set_exp;
statements -> return exp;
statements -> print exp;


----------------------

PRINT
RETURN
SET
IF
WHILE
LPAREN
RPAREN
LBRACK
RBRACK
LSQ
RSQ
EXP
ADD
SUB
DIV
MUL
FACTORIAL
OR
AND
EQUAL
NEQUAL
GT
LT
GEQ
LEQ
MOD
REMAIN
REAL = (0-9)*.?(0-9)*
ID = (A-Z | a-z) (A-Z | a-z | 0-9 | _)*
Title: Re: Programming Thread
Post by: the-pi-guy on May 23, 2019, 02:38 AM
I think I have everything.

Think the grammar does what I want it to do, and I think it has all the features that I want it to have.  

-Decent at Java
-Learning C++
-Probably doesn't count, but "TI-BASIC" it's for calculators.  :P
C, Java, C++, Python, MIPS assembly, TI-BASIC, JavaScript, learned enough Erlang in a day to do an assignment.  

Look how far I've come.
Title: Re: Programming Thread
Post by: Legend on May 26, 2019, 02:59 AM
It's almost like you know what you are doing!




I'm still away but I think I've figured out my map.

Every pixel on the 512x512 grid will be its own renderer in charge of just that tile. All ~260,000 will update individually and only care about their own needs. A tile far from the player will mostly not change and just have a 2x2 or 4x4 texture. As the camera gets closer, the tile re-renders to a higher resolution. This isn't super fast but can look like texture streaming. At max the tile could be 1024x1024 or higher and cover the full screen. As the camera moves away, the texture is scaled down to decrease memory.

This has all the pros of a sparse quadtree while also rendering faster. Rendering speed is dependent on tile count and resolution so this method works with that. Also there is no need for multilevel stuff like a quadtree. In addition, every tile can bake some info instead of recalculating it always.

Labels can be decals rendered on top. The grid of textures could be packed into a single texture to make 3d rendering really fast.
Title: Re: Programming Thread
Post by: the-pi-guy on May 26, 2019, 03:28 AM
It's almost like you know what you are doing!
I have a pretty good handle of this stuff.  :D

I think I forgot about it when I was writing stuff about compilers, but there are programs to generate the parser from a grammar.  There is still a lot of work that has to be done outside of the parser though.  

Grammars have a few nuances, that sometimes leads to bizarre problems if the grammar isn't set up correctly. Still have to implement a symbol table, implement what everything in the grammar does.  This project will definitely be more work than it's worth, but it'll still be kind of fun I hope...  

The end result will be basically be a command terminal that uses an interpreter to act on the inputs.
Title: Re: Programming Thread
Post by: the-pi-guy on May 31, 2019, 05:16 AM
In progress:

set_func-> set id( args ) = statements

any_exp -> bool_exp | set_exp | mod_exp
bool_exp -> (bool_exp bool_op bool_exp) | exp op exp | true | false | null
set_exp -> SET id = any_exp
mod_exp -> exp (MOD exp)

exp -> exp + factor | exp - factor
factor -> factor * fact | factor / fact | factor % fact
fact -> fac ^ fact
fac -> term !
term -> (exp) | real | id | id( in_args )

op -> = | != | >= | <= |  < | >
bool_op -> || &

statements -> while bool_exp { statements }
statements -> if bool_exp { statements } (else{ statements })?
statements -> set_exp;
statements -> return exp;
statements -> print exp;


----------------------

PRINT
RETURN
SET
IF
WHILE
LPAREN
RPAREN
LBRACK
RBRACK
LSQ
RSQ
EXP
ADD
SUB
DIV
MUL
FACTORIAL
OR
AND
EQUAL
NEQUAL
GT
LT
GEQ
LEQ
MOD
REMAIN
REAL = (0-9)*.?(0-9)*
ID = (A-Z | a-z) (A-Z | a-z | 0-9 | _)*
Found some errors that I am fixing in my program.
And I still have a lot of parsing errors I have to figure out.  
Title: Re: Programming Thread
Post by: Legend on Jun 29, 2019, 08:07 AM
The markov chain like system I set up for words starts producing really really good results once there are hundreds and hundreds of source words.

It made me interested in doing the same thing with pictures. Take a database of a few thousand pictures of the same thing, faces for example, and see how good the system is at generating new ones.


Pixel by pixel a new image could form. Pixels would be added in a random order so that there isn't any bias towards a direction, and later pixels could be less random and focus more on only the best output.

Hardest part would be figuring out a "scoring" system. My word system is fairly basic and just checks the quantity of matching letters. This system would need to go pixel by pixel and search in a circle for similar colors. Find the best match based off similarity and distance. Then add up the scores for all already defined pixels.

Do it in black and white first, and then deal with color later. Would not work to do rgb separately.
Title: Re: Programming Thread
Post by: the-pi-guy on Jul 11, 2019, 03:35 PM
I've been studying some of the basics.  
Objected Oriented was 5 years ago now.  I just looked over most of what I was a little unsure of.  I was familiar with the words, but I've forgotten some of the distinctions.  

Polymorphism:
There are a couple types of polymorphism.  Generically, polymorphism is where one thing can be used in multiple ways.

One type: function overloading.  
You can name multiple functions the same way, but with different parameters.
So like:
add(int, int)
add(double, double)

Another is subtyping.  

------
Another concept is abstract classes and interfaces.  

An interface is more useful when you want to share behavior, an abstract class is when you want to share code.  
In an abstract class you can basically mix methods that need to be implemented, and methods that are already programmed.  An interface is something that needs to be entirely programmed.  

-----------

Might do a post for data structures that I work with less often.  
Title: Re: Programming Thread
Post by: the-pi-guy on Jul 13, 2019, 02:24 AM
Starting data structure notes.  

Tree traversal, I usually get these ones mixed up.  

Postorder:
callChildren
visit

calls the postorder function on each of the children first, then visits the current node.  

Basically causes the lower children to get called first.  

Preorder:
visit
callChildren

Simply the opposite of the above.  

InOrder:
callLeft
visit
callRight

Only works on binary trees.  


-----
This probably won't be useful for anyone else.  I'm going to write these up for myself.  
I'm basically making a set of notes for myself to review.

Object Oriented (http://"https://vizioneck.com/forum/index.php?msg=246422")

Next ones will be much more detailed.  

Up next for data structures:
-Heaps
-Hash tables
-search trees
-sets
-possibly strings (pattern matching and text compression)
-graphs


After data structures I am not sure what I'll do. A few things on my mind.  

-databases
-artificial intelligence
-algorithms
-graphics
-security

A few things also on my mind, but further down:
-operating systems
-compilers
-computer organization

Title: Re: Programming Thread
Post by: Legend on Jul 19, 2019, 03:53 AM
I'm thinking about combining a neural net with celluar automata. Regular machine learning is great for instant solutions but poor when trying to give it some sort of memory. Celluar automata isn't used for problem solving but it's great at flowing from state to state.

So what about something that has a little bit of both? A function that has to think before producing an output.
Title: Re: Programming Thread
Post by: the-pi-guy on Jul 19, 2019, 04:44 AM
I'm thinking about combining a neural net with celluar automata. Regular machine learning is great for instant solutions but poor when trying to give it some sort of memory.
By memory, do you mean that the solution doesn't quickly change?  

That is done in a neural network by decreasing the learning rate, or making it small in the first place.  
Title: Re: Programming Thread
Post by: Legend on Jul 19, 2019, 05:19 AM
By memory, do you mean that the solution doesn't quickly change?  

That is done in a neural network by decreasing the learning rate, or making it small in the first place.  
I mean an equivalent to RAM. Once a specific neural net is fully trained and is just being used, it is equivalent to a black box function. Input goes in one side and output comes out the other. There is no internal state for that specific neural net.

(http://seas.ucla.edu/~kao/images/nn.png)

Information only flows left to right, from one layer to the next. If the input nodes don't change, then the state of the network is static.

Cellular automata however needs to be calculated over and over again with "information" freely flowing.

(https://upload.wikimedia.org/wikipedia/commons/e/e5/Gospers_glider_gun.gif)

My idea is to basically merge both of them. Essentially cellular automata with unique weights per pixel. The whole grid is white, then input pixels are made black, and then output pixels are monitored.
Title: Re: Programming Thread
Post by: Legend on Jul 19, 2019, 08:00 PM
(https://i.imgur.com/bIJUYbd.png)

I set up a quick environment to test the idea out. Bottom left is a visualization of the neural grid. It has 4,096 neurons so it only fills up the bottom of the square. On the right is the race track. It is a super simple track where the AI only needs to turn left. If the car drives off the track (the white ring) then it kills the AI and moves on. If the AI is too slow it is also killed.

Top left are stats showing progress. I'm using natural selection to tune the neural grid since modern neural net approaches wouldn't really work.


At this moment, it's functionally identical to a normal neural network. Programing a neural network to do this with natural selection is borderline trivial. The big challenge for the AI to overcome is that the controls flip after the second lap. Left swaps with right and gas swaps with brake. A neural network with identical inputs would not be able to handle this. That AI would crash into a wall almost instantly even if it was mathematically perfect.

I have yet to test my AI on this so maybe it'll fail just as bad, but that's the goal: a neural brain that is actively thinking and not just reacting.


Current record is 11.8 radians before going off track.
Title: Re: Programming Thread
Post by: the-pi-guy on Jul 19, 2019, 08:20 PM
I mean an equivalent to RAM. Once a specific neural net is fully trained and is just being used, it is equivalent to a black box function. Input goes in one side and output comes out the other. There is no internal state for that specific neural net.

(http://seas.ucla.edu/~kao/images/nn.png)

Information only flows left to right, from one layer to the next. If the input nodes don't change, then the state of the network is static.

Cellular automata however needs to be calculated over and over again with "information" freely flowing.

(https://upload.wikimedia.org/wikipedia/commons/e/e5/Gospers_glider_gun.gif)

My idea is to basically merge both of them. Essentially cellular automata with unique weights per pixel. The whole grid is white, then input pixels are made black, and then output pixels are monitored.
I mean I know how a neural network works.  

I'm just confused as to why you couldn't constantly train the network?  
Title: Re: Programming Thread
Post by: Legend on Jul 19, 2019, 08:23 PM
edt:




Experimenting with a less active brain so that the changes are more visible. A.I. number 17 makes the full loop and dies as the video ends. You can see the input pixels on the bottom, showing the AI raycast info about the track.
Title: Re: Programming Thread
Post by: the-pi-guy on Jul 19, 2019, 08:46 PM
So I'm guessing you mean that:
with a Neural network, you're training it to simulate a function f(x,y)  and if you reach the same point, a neural network would have to give the same output, which wouldn't be correct.  

Ie, f(x,y) on the first round is different from f(x,y) the second round, because you need different outputs.  Or in other words, the neural network has to have the memory to know what round it is in.  

FNN don't support memory.  
But there are other types of neural networks, that do.

https://en.wikipedia.org/wiki/Recurrent_neural_network (https://en.wikipedia.org/wiki/Recurrent_neural_network)

The solution you're putting forward should simulate that though.  
Title: Re: Programming Thread
Post by: Legend on Jul 19, 2019, 11:04 PM
I mean I know how a neural network works.  

I'm just confused as to why you couldn't constantly train the network?  
Just trying to be as clear as possible with what I'm talking about. I know you know how a neural network works haha.

So I'm guessing you mean that:
with a Neural network, you're training it to simulate a function f(x,y)  and if you reach the same point, a neural network would have to give the same output, which wouldn't be correct.  

Ie, f(x,y) on the first round is different from f(x,y) the second round, because you need different outputs.  Or in other words, the neural network has to have the memory to know what round it is in.  

FNN don't support memory.  
But there are other types of neural networks, that do.

https://en.wikipedia.org/wiki/Recurrent_neural_network (https://en.wikipedia.org/wiki/Recurrent_neural_network)

The solution you're putting forward should simulate that though.  
Yeah exactly this is focused on similar things to recurrent neural networks.

Unlike a recurrent neural network though, this is much closer to cellular automata. There are no layers and there is no directed graph. Connections are bidirectional with the whole grid updating in steps.

The goal isn't so much to make a useful AI that solves real world problems, but to make an AI that's random and chaotic with ever evolving inner thoughts.
Title: Re: Programming Thread
Post by: Legend on Jul 21, 2019, 01:18 AM
A genetic solution for adjusting the weights doesn't work. Unlike a neural network, this is super chaotic and isn't smooth.

A few hundred generations tends to reach something ok but then progress stops. It's mostly just getting lucky with random mutations instead of actually zoning in on a local maximum.


It also takes a fair amount of steps to become populated. The system favors AI that can jump into action instead of those that take a while to wake up.

I'm trying to figure out a way to train the grid like a normal neural net. That way a single brain can live for millions of ticks and develop into a "mature" ai. Not sure how or if I can actually do that though haha.
Title: Re: Programming Thread
Post by: the-pi-guy on Jul 22, 2019, 11:41 AM
It would be cool to have an AI basically scrape a personality from a TV show character.  

Like if you were a game developer for a Simpson's game, you could train an AI on Homer, Marge, Lisa, etc.  Basically autogenerated compelling, interactive TV show characters.  
Title: Re: Programming Thread
Post by: Legend on Jul 23, 2019, 06:32 PM
The biggest challenge with getting this cellular automata ai to work is definitely training it.

The hard part is weight adjustment. Every cell/neuron has 9 weights associated with it. That's much nicer than a traditional neural network but with no flow of direction, it's much harder to backpropagate. Additionally it's impossible to use traditional methods because of the boolean nature of cells. Super small changes in weights do not necessarily change the output.

The harder part is dealing with memory and the state of the brain. Since cellular automata is turing complete, exclusively flipping cell states is enough to program any output. Weights could be completely ignored and yet it could still function as a full AI if seeded correctly. Training needs to include a method to flip cells or temporarily change weights with the short term goal of setting up cells. I have no idea how to handle this.


I've been able to train the AI to make it around the track near perpetually but this is almost exclusively based off the internal state of the brain instead of sensor input. Structure should form within the brain around the input and output sections but instead everything is fairly evenly distributed.

It would be cool to have an AI basically scrape a personality from a TV show character.  

Like if you were a game developer for a Simpson's game, you could train an AI on Homer, Marge, Lisa, etc.  Basically autogenerated compelling, interactive TV show characters.  
Would be cool. I'd bet we are within a decade or two of being able to replace characters in live TV. The AI would visually replace the person like we can kinda do now, but it could also rewrite lines and make the character match their personality.
Title: Re: Programming Thread
Post by: Legend on Jul 31, 2019, 05:23 AM
I keep getting pulled back in by my AI thing.

The goal at the moment is a single AI agent that evolves and trains itself as it runs. Reinforcement learning is used like before but now it's an active part of the brain. If I can get this step working, then hopefully the AI can evolve to handle more complicated courses.

I switched to a 3d grid and increased the input cells, so now I can see what the AI sees. It really feels like an animal brain haha.
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 16, 2019, 08:23 PM
I am going to try making a game from scratch.  Probably a terrible idea, but it'll be great for learning I think.  

Haven't used opengl and C++ together before.  It looks very different from webgl.  So I have a rough background, but I still have stuff to learn.  
But some of the relevant books I have are pretty old. And I'm worried about how outdated they are.  Like the second newest book is from 2000.  So I'm sure a lot of the opengl stuff is deprecated.  

I've decided I'm going to make my Japanese game, and it'll be made incrementally.  I've been worried about it feeling like a complete experience, but I'm going to worry about that later.  

Title: Re: Programming Thread
Post by: Legend on Aug 16, 2019, 08:38 PM
I am going to try making a game from scratch.  Probably a terrible idea, but it'll be great for learning I think.  

Haven't used opengl and C++ together before.  It looks very different from webgl.  So I have a rough background, but I still have stuff to learn.  
But some of the relevant books I have are pretty old. And I'm worried about how outdated they are.  Like the second newest book is from 2000.  So I'm sure a lot of the opengl stuff is deprecated.  

I've decided I'm going to make my Japanese game, and it'll be made incrementally.  I've been worried about it feeling like a complete experience, but I'm going to worry about that later.  


That sounds really cool!

How scratch are you talking? Open source libraries when possible or as scratch as possible to help you learn?
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 16, 2019, 08:50 PM
That sounds really cool!

How scratch are you talking? Open source libraries when possible or as scratch as possible to help you learn?
Probably all by scratch, unless I really can't make progress with something.
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 19, 2019, 01:37 AM
Sometimes I really hate setting stuff up.  

Like installing a program, API, library, etc. Is just way too much trouble sometimes.  That I'd rather try using what I already have set up instead sometimes.
Title: Re: Programming Thread
Post by: Legend on Aug 19, 2019, 02:02 AM
Sometimes I really hate setting stuff up.  

Like installing a program, API, library, etc. Is just way too much trouble sometimes.  That I'd rather try using what I already have set up instead sometimes.

I get that. I hated having to switch to visual studio for example.
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 19, 2019, 02:38 AM
I get that. I hated having to switch to visual studio for example.
Yeah, me too. 
I was trying to get started on Unreal Engine.  And I had this weird error where it wouldn't stay open. 
Tried re-installing it to see if that was the problem.   
Saw there was an error code.  Was having trouble finding a solution to it.  Turned out it was because my laptop was switching GPUs. 

-----
Had trouble with OpenGL too.  Had to set up Visual Studio for opengl, by getting it to point to the directory in a couple different places. 
Messed up something, but finally got it to work. 
But then I was going through a tutorial, and it wanted me to set up another thing. 

It's always one thing after another when getting started up the first time. 

Edit, actually part of the issue is that I was working with stuff that I'm still trying to understand. 
There are a large number of very different OpenGL sdks.  Which I wasn't aware of.  Ugh. 
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 19, 2019, 02:53 PM
What graphics API are you using for your engine?  
Title: Re: Programming Thread
Post by: Legend on Aug 19, 2019, 04:34 PM
What graphics API are you using for your engine?  
Haven't touched my engine in a long time, but I used DirectX for prototyping.
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 21, 2019, 08:24 PM
Making slow progress.  

OpenGL is apparently set up a bit differently from webgl, so I kind feel like I'm starting over a bit.
Title: Re: Programming Thread
Post by: Legend on Aug 21, 2019, 08:47 PM
Making slow progress.  

OpenGL is apparently set up a bit differently from webgl, so I kind feel like I'm starting over a bit.
How long do you expect till you get hello triangle running?
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 22, 2019, 01:00 AM
How long do you expect till you get hello triangle running?
Hopefully in a couple days.  I haven't been working on graphics very much.  
I've just started working on a resource managing system.  
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 22, 2019, 06:10 PM
That sounds really cool!

How scratch are you talking? Open source libraries when possible or as scratch as possible to help you learn?
I guess a more a more updated/accurate answer here would be:
Graphics: using the SDL library to work with OpenGL. 

But I still think everything else will be pretty from scratch. 

SDL is a lot better than GLUT, which is super outdated. 

Edit: ive made more progress in half an hour with SDL than I did over a day with GLUT
Title: Re: Programming Thread
Post by: Legend on Aug 22, 2019, 10:50 PM
I guess a more a more updated/accurate answer here would be:
Graphics: using the SDL library to work with OpenGL.  

But I still think everything else will be pretty from scratch.  

SDL is a lot better than GLUT, which is super outdated.  

Edit: ive made more progress in half an hour with SDL than I did over a day with GLUT
Sounds like switching was a good idea  ;D
Title: Re: Programming Thread
Post by: darkknightkryta on Aug 23, 2019, 02:45 PM
Sometimes I really hate setting stuff up. 

Like installing a program, API, library, etc. Is just way too much trouble sometimes.  That I'd rather try using what I already have set up instead sometimes.

I was looking at getting MinGW working on VIsual Studios Code, and I honest to god want to slap people.

I guess a more a more updated/accurate answer here would be:
Graphics: using the SDL library to work with OpenGL. 

But I still think everything else will be pretty from scratch. 

SDL is a lot better than GLUT, which is super outdated. 

Edit: ive made more progress in half an hour with SDL than I did over a day with GLUT
I remember having a conversation with a coworker at EB Games.  This had to have been close to 10 years ago.  "It's not good, but gets the job done" he said.  Sad tools haven't gotten super better than that.  I mean, SDL itself is pretty old and outdated, yet there's not much super better (Other than like Unity)
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 26, 2019, 02:19 AM
So SDL, GLUT, freeGLUT, GLFW, etc are mainly used to handle input and to manage a window.

Glew, Gl3w, Glad, etc are used to actually load the GL functions.
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 30, 2019, 03:13 AM
Even though it doesn't go with my game... I want to make a globe instead of a flat world. 

Not sure how I want to make it work though. 

Idea I have in mind right now is basically a layered height map where it'll basically be correlated to somewhere on the sphere instead of a plane.

------

Haven't been working on it much, but so far it's starting to look a lot like my projects in my graphics course.  Which is awesome when something new starts clicking. 
Title: Re: Programming Thread
Post by: Legend on Aug 30, 2019, 04:00 AM
Even though it doesn't go with my game... I want to make a globe instead of a flat world.  

Not sure how I want to make it work though.  

Idea I have in mind right now is basically a layered height map where it'll basically be correlated to somewhere on the sphere instead of a plane.

------

Haven't been working on it much, but so far it's starting to look a lot like my projects in my graphics course.  Which is awesome when something new starts clicking.  
Are you wanting the whole world traversable? That's a lot of work if players won't even notice haha.

Could fake it by having a flat world that is visually deformed during rendering.
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 30, 2019, 04:17 AM
Are you wanting the whole world traversable? That's a lot of work if players won't even notice haha.

Could fake it by having a flat world that is visually deformed during rendering.
No, with this particular project it's pretty much the furthest thing from what I want to do.  

But it is something I want to do at some point.
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 31, 2019, 08:07 PM
Been spending the past two days debugging my initializing function.  

Making progress, pretty exciting.  But nothing happening quite yet.
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 04, 2019, 11:08 PM
Been spending the past two days debugging my initializing function.  

Making progress, pretty exciting.  But nothing happening quite yet.
Now I'm getting pretty frustrated.  

I know I'm getting close, but something is still not working the way it is intended.  Everything with the window itself is good.  But for some reason the vertices won't get drawn or they're out of the picture.
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 07, 2019, 03:40 AM
I know the context is working, just have to figure out the answer to these questions:

- buffers getting set up correctly?  
- is the triangle actually in view?


It's probably some small error, somewhere.  
Title: Re: Programming Thread
Post by: Legend on Sep 07, 2019, 02:58 PM
I know the context is working, just have to figure out the answer to these questions:

- buffers getting set up correctly?  
- is the triangle actually in view?


It's probably some small error, somewhere.  
Have you tried skipping a buffer and hardcoding the triangle location, just to make sure the rest is working?
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 07, 2019, 03:55 PM
Have you tried skipping a buffer and hardcoding the triangle location, just to make sure the rest is working?
Not yet, I'm being lazy. :(
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 07, 2019, 04:52 PM
So it looks like the buffer isn't being set up properly. 

Glad to know where the problem is. 

Although I'm getting a weird thing, after I changed something.  The graphics are showing up as intended, but now the program is giving me an error code. 

Edit:
For some reason it works when the glprogram fails to link, but it doesn't work when the glprogram succeeds linking... 
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 09, 2019, 04:13 AM
Im just frustrated how long this is taking.  

I'm not finding any good simple example code, but my code looks right based off the opengl programming I've done before and the portions of examples I have been able to find.

The only good examples I've found are incredibly outdated.  Using a library that shouldn't be used anymore.  
Title: Re: Programming Thread
Post by: Legend on Sep 09, 2019, 04:21 AM
Im just frustrated how long this is taking.  

I'm not finding any good simple example code, but my code looks right based off the opengl programming I've done before and the portions of examples I have been able to find.

The only good examples I've found are incredibly outdated.  Using a library that shouldn't be used anymore.  
Have you narrowed your issues down to a specific problem at least?
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 09, 2019, 03:45 PM
Have you narrowed your issues down to a specific problem at least?
I have narrowed it down to 2 possible spots.  
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 10, 2019, 03:37 AM
So apparently it didn't like the way I initialized the array of vertices.   :(

Which was not what I expected. 

There's still a mystery though.  The colors aren't acting the way anticipated. 

It seems like the buffer still isn't being loaded properly.  Because only the first 2 values of the colors of the first vertice are getting the color.  Which makes no sense to me.  I can turn it in Red or green, but I can't turn it blue, and the other 2 vertices are black. 

So far, this doesn't feel like much of a victory.  :(

But I think i'll have to finish it tomorrow.
Title: Re: Programming Thread
Post by: Legend on Sep 10, 2019, 04:46 AM
So apparently it didn't like the way I initialized the array of vertices.   :(

Which was not what I expected.  

There's still a mystery though.  The colors aren't acting the way anticipated.  

It seems like the buffer still isn't being loaded properly.  Because only the first 2 values of the colors of the first vertice are getting the color.  Which makes no sense to me.  I can turn it in Red or green, but I can't turn it blue, and the other 2 vertices are black.  

So far, this doesn't feel like much of a victory.  :(

But I think i'll have to finish it tomorrow.
Any progress is still progress!!!
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 10, 2019, 03:55 PM
Any progress is still progress!!!

On the one hand, it'll hopefully be smooth sailing after this part.  At least some parts of it.  

On the other hand, it's frustrating that the bug was because of something so dumb.  
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 11, 2019, 01:28 AM
How long do you expect till you get hello triangle running?
Only took me 3 weeks.   :(

So the issue was that I was using a pointer to set up my variable length arrays.  So then when I foolishly used sizeof during the call to copy the array to the buffer, it was taking the size of the pointer instead of the size of the array.  
So then there wasn't enough information for a color or vertex.

That was my stupid mistake.  
Title: Re: Programming Thread
Post by: Legend on Sep 11, 2019, 01:46 AM
Only took me 3 weeks.   :(

So the issue was that I was using a pointer to set up my variable length arrays.  So then when I foolishly used sizeof during the call to copy the array to the buffer, it was taking the size of the pointer instead of the size of the array.  
So then there wasn't enough information for a color or vertex.

That was my stupid mistake.  
Eh that at least was a reasonable mistake. You can at least follow the logic of what you were thinking  :)

But now it works!!!
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 11, 2019, 02:26 AM
Eh that at least was a reasonable mistake. You can at least follow the logic of what you were thinking  :)
Yeah, I think I'm being a little too hard on myself.  Wasn't like I spent that much time on it.  Started back at work, and other stuff in the past 3 weeks.  

Quote
But now it works!!!
Yeah!  And a few other things should be pretty easy to add.
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 13, 2019, 11:28 PM
So I was thinking 3D, with a full controllable camera, but I think I could get away with more doing a scene like this:

(https://ksassets.timeincuk.net/wp/uploads/sites/54/2016/01/supermarioRPG.jpg)

I think if the camera were closer, there'd be higher expectations for animations, and that's the one thing that I'm terrified to touch.

Doing this way, I think I could probably do a lot with a little basically.  
Title: Re: Programming Thread
Post by: Legend on Sep 14, 2019, 01:47 AM
So I was thinking 3D, with a full controllable camera, but I think I could get away with more doing a scene like this:

(https://ksassets.timeincuk.net/wp/uploads/sites/54/2016/01/supermarioRPG.jpg)

I think if the camera were closer, there'd be higher expectations for animations, and that's the one thing that I'm terrified to touch.

Doing this way, I think I could probably do a lot with a little basically.  
I think the hardest part will be setting up skinned meshes and animation systems on the programing side of things. If you're able to get that going, I think you'd be able to make serviceable animations in blender with relatively little effort.
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 22, 2019, 01:44 AM
Trying to add text has been kind of a pain. 

I'm sure there's a better library or a better explanation, but the whole process has been stitching parts together. 

This is how to create the font using sdl, this is how to turn it into a texture for opengl, this is how to display the texture.

So then when it doesn't work, it's like was it one of those 3 steps, or is there something wrong with my shaders? 

I like graphics programming, but it doesn't give error codes the way "regular" programming does.

I'd still say it's easier than debugging grammars.
 

It's been kind of fun though.  Learning more about debugging.
Title: Re: Programming Thread
Post by: Legend on Sep 22, 2019, 03:09 AM
Trying to add text has been kind of a pain. 

I'm sure there's a better library or a better explanation, but the whole process has been stitching parts together. 

This is how to create the font using sdl, this is how to turn it into a texture for opengl, this is how to display the texture.

So then when it doesn't work, it's like was it one of those 3 steps, or is there something wrong with my shaders? 

I like graphics programming, but it doesn't give error codes the way "regular" programming does.

I'd still say it's easier than debugging grammars.
 

It's been kind of fun though.  Learning more about debugging.
With shader debugging I always end up writing the dumbest tests to figure out what is happening. You can throw in a bunch of if statements and just see what's up.

Do you have regular textures working yet?
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 22, 2019, 04:33 AM
With shader debugging I always end up writing the dumbest tests to figure out what is happening. You can through in a bunch of if statements and just see what's up.
Yep!  That's been quite a bit of what I've been doing.  ;D
Quote
Do you have regular textures working yet?
Not yet.  I should do that first, instead of doing something else that depends on that code.  
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 27, 2019, 02:20 AM
Haven't worked on it much this past week due to working. 

I'm not sure how it's typically done in C++.  But there is a show method in the gameobject class that our instructor gave us for our class project.  It basically draws the gameobject to the screen. 

Now I'm assuming the way to do this in c++ is to pass a pointer to the graphics code that points to the list of vertices in the gameobject class. 

I have to do some reconstruction on the graphics methods to get everything working that way, but it seems like the way to do it to match up with best practices. 

Still have to figure out textures.

I'm happy though that a month and a half after starting, I'm still excited to work on this project. 

Wish I could be doing more, but it's like at least fourth priority after work, family, house, etc. :P
Title: Re: Programming Thread
Post by: Legend on Sep 27, 2019, 05:35 AM
Haven't worked on it much this past week due to working.  

I'm not sure how it's typically done in C++.  But there is a show method in the gameobject class that our instructor gave us for our class project.  It basically draws the gameobject to the screen.  

Now I'm assuming the way to do this in c++ is to pass a pointer to the graphics code that points to the list of vertices in the gameobject class.  

I have to do some reconstruction on the graphics methods to get everything working that way, but it seems like the way to do it to match up with best practices.  

Still have to figure out textures.

I'm happy though that a month and a half after starting, I'm still excited to work on this project.  

Wish I could be doing more, but it's like at least fourth priority after work, family, house, etc. :P
That's mostly how it works. Every object is called from the CPU to be drawn on the GPU. You can optimise this by batching objects into a single call but it's all the same concept. (not sure if this was the part you were unsure about though  :P )


It sounds like you're really close to actually making the game instead of making the tech. Lighting (can be) relatively simple and is just handled in your shaders if you want to go with forward rendering. Game graphics are pretty much just drawing triangles with textures and lighting as input. Slap a filter on afterwards and call it a day.
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 28, 2019, 03:08 AM
That's mostly how it works. Every object is called from the CPU to be drawn on the GPU. You can optimise this by batching objects into a single call but it's all the same concept. (not sure if this was the part you were unsure about though  :P )

I was unsure if that was definitely the way it was done and also unsure how it usually gets implemented.  

I can think of 3 ways to have the vertices passed onto the graphics class for drawing. Two are terrible, but I wanted to check if there were other ways to do it that I wasn't thinking of.  
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 06, 2019, 01:11 AM
I swear like 90% of the issues that I'm having with writing the program have been declaring the wrong type.  


I apparently tried passing something a double instead of a float, and it wasn't drawing, but the compiler didn't have a problem with it. So I didn't realize my error.  
Title: Re: Programming Thread
Post by: Legend on Oct 06, 2019, 06:00 AM
I swear like 90% of the issues that I'm having with writing the program have been declaring the wrong type.  


I apparently tried passing something a double instead of a float, and it wasn't drawing, but the compiler didn't have a problem with it. So I didn't realize my error.  
Which compiler are you using? That'd be really annoying.

I had something similar not too long ago where I used a short instead of a half. Worked just fine from the compiler's perspective but was really giving me a headache.
Title: Re: Programming Thread
Post by: the-pi-guy on Dec 20, 2019, 08:04 PM
It's impossible to overstate how mindblowingly ahead of it's time the Doom engine was. Outright the father of modern gaming. | ResetEra (https://www.resetera.com/threads/its-impossible-to-overstate-how-mindblowingly-ahead-of-its-time-the-doom-engine-was-outright-the-father-of-modern-gaming.160340/)

Quote
I'm sure a lot of people are like, "yeah, of course, all FPS games after took inspiration from it" but that's underselling what Id Tech 1 did. The things the doom engine did go well beyond FPS games or even rendering graphics period. Doom laid the foundation that virtually all game engines today descend from.

 Several years back, Dreamcast scenester and general amazing dude ChillyWilly had ported Doom to the DC, but his old code no longer builds because of various changes to the KOS library that powers the port. Because of this, earlier this year, I took my first stab at porting doom to a platform:

  (https://pbs.twimg.com/media/D9BpcGIWkAAHIiR?format=jpg&name=large)

 I began with ChillyWilly's port as a base, then worked backwards. I have worked with modern engines over the years - Source, Unreal Engine 4, Unity - but never really dove deep into how Doom worked. That's not to say I was unfamiliar with Doom, I had been making Doom WADs for years, so I generally knew of things like BSP and lumps, but not really how any of it worked. Around the same time I began porting doom, I also picked up Fabien Sanglard's Doom Engine black book (https://www.resetera.com/threads/the-doom-engine-black-book-is-one-of-the-best-books-ive-read-in-a-long-while.128970/). This was not the first blackbook I'd read. I had read the Wolfenstein black book prior, and years earlier, when learning graphics programming, I read Michael Abrash's Graphics Programming black book (which is, really, the Quake black book). Most draw a linear path between these 3 games: Wolfenstein -> Doom -> Quake. But that really undersells how it all progressed. Things I had thought Quake had come up with, actually came from doom. Further, I learned that Doom and Quake share much more in common than Wolfenstein and Doom share in common. One thing dawned on me: To study Doom, is to study how modern video games work. Doom is, IMO, the very best place for anybody to start if they want to know how modern video games function and operate on a conceptual level. So much of what Doom does directly applies to modern engines.

 With interest in Id Tech 1 growing, and a project in hand, I started where most doom ports begin: converting the 4 main files that are platform dependent. Doom's engine is genius, honest to god genius. It was built with cross platform compatibility in mind. The platform most people play doom on, IBM PC, was NOT the platform Doom was written on. It was written on the NeXT platform, and id knew most people did not have access to NeXT computers. Doom, thusly, is a prime example of how to write a cross platform game, one of the best models. Doom spares no detail in creating everything from the ground up, including fundamental data structures.

 For example, doom shows you how to elegantly sanitize malloc -- malloc is a C function that interfaces with kernels in your operating system to request and reserve a block of memory. But how kernels operate on memory varies not only from OS to OS, but even revision of OS to OS. Malloc, thusly, is malliable, over time, as C has evolved, malloc too has changed. It's not wise to rely on malloc to handle memory in C. People who don't do low level programming but operate in higher programming languages like Java might hear things about how C is a "nightmare" because you have to "manually manage memory." A lot of that "nightmare" comes from how much malloc changes over the years. Doom shows you how to manually manage your memory. It uses malloc in the most broad sense, only using it to request a single large pool of memory, which it then handles and breaks into smaller chunks itself. It, in essence, creates it's own micro OS within that chunk of memory. It is doom, not your OS or its kernel, that fiddles with the memory. To do this, it builds every data type it uses from the ground up. That let carmack and crew design custom, portable data structures in low level memory, bit by bit, byte by byte. That might seem rote to anyone who has done engine programming these days, but that's the point. Doom set that standard. Everybody follows doom's model.

 Going further, Doom impliments OOP in C. Programmers might have heard that C is classically "not an OOP language." That's not quite true. C is a very low level language, exposing memory directly to the programmer. As such, it doesn't provide any OOP abstraction, but you're absolutely free to write your own yourself. When Doom was created, OOP wasn't really a common thing. None the less, Doom implements it's own OOP concepts through pointers, function callbacks, etc. The OLD style of OOP. But Doom's methods are elegant, it's a great OOP implementation. With liberal use of void* pointers and explicit casting, Doom manages to perform a pattern that wouldn't become popularized till really 5 or so years later!

 Back to porting doom: Doom is written to be portable. By writing so much of the engine in custom, operating-system-independent wrappers, it was built so that the core function of the engine was self contained. There are only really 4 files that are platform dependent, those files control the lowest level functions of the engine. Things like calling out to the video card, requesting memory, polling hardware. These 4 files are the core of doom's engine. They are written not to actually do larger functions, but rather to provide a framework of commands that the rest of the engine can call to do complex things. Like, a function to draw pixels on the screen. When you port doom, you write those functions for the hardware, which is how it becomes so portable. If you can write a low level function that places pixels on the screen, matching the interface doom defines, the rest of the engine can use it and thusly do everything it needs to do regarding graphics. That is one of the secrets to why Doom is so widely ported. This concept of portability was not necessarily created by Doom itself -- I've seen Amiga/Genesis/SNES games that work the same way with company-specific libraries that worked the same way which could be placed inside larger assembler code -- but Doom does it very well. More than that, while some other games did this, most did not. It was more common in 1993 for ports of games to essentially be entire rewrites than have modular code like this. And in the Amiga/Genesis/SNES examples I cite, the entire games usually weren't written to be modular, only pieces. Things like the graphics system might work in a modular fashion, but then the memory management might be entirely different among the games. They were often half-ports, half-bespoke-remakes. Doom is truly portable.

 I rewrote those core functions in a few days and got Doom running on the Dreamcast. Really cool, very good lesson. But that isn't going far enough. Doom has way, way more lessons to teach if you dive in. Writing those core functions will teach you how to make a nice modern interface, get you thinking about portability, but the Doom Engine itself will teach you many more concepts the deeper you dive in. For example, Doom teaches you the concept of decoupling the game's internal logic from internal hardware. Old games used to have this problem where how well the game performed was dependent on the hardware it ran on. The logic was usually very closely tied to the hardware, using things like the screen's refresh rate to tie to logic. Doom doesn't do that. Doom implements what is called Fixed Timestep, which uses real-world time as a metric. For example, movement. In many old games, movement is handled in number of spaces jumped per frame. On frame 1, you are at position X, on frame 2, you are on position X+A, on frame 3, you are on position X+A+A, and so forth. Your position depends on that A variable and also which frame you are looking at, A is essentially your speed. This means your motion is not constant if the frames are not constant. If it takes 1 microsecond between frames 1 and 2, but 10 microseconds between frames 2 and 3, your velocity will not be linear, it'll be logarithmic. Doom doesn't work like this. Doom calculates delta between frames. One frame 1, your position is X, on frame 2, your position is X + Delta(frame1), on frame 3, your position is X + Delta(frame2). The delta is how much time passed between the current frame and last frame, calculated using a constant velocity. If you are moving at 1 space per unit of time, and between frame 1 and frame 2, 1 unit of time passes, then the delta is 1 space. But if 10 units of time pass between frames 2 and frames 3, then the delta is 10 spaces, meaning you move at a linear 1 space per unit of time. This decouples the refresh rate of the hardware from the game speed. Game speed is dependent on external, real time, not the load of the computer. Again, this sort of thing is rote today, but largely because Doom showed everyone how it was done.

 Another great example of how Doom establishes the model of modern game design is with its rendering system. People will say things like "Doom isn't 3D" but that's completely wrong. Doom IS 3D, it's the map layouts that are 2D. But Doom's rendering system is pretty much the basis of all modern rendering systems today. The main difference between the way Doom renders and wolfenstein renders is owed to how they process the polygons that make up the world. Wolfenstein uses a raymarcher, basically a system where the game shoots rays out from the players perspective, and paints the screen line by line. It is rendering lines. The world is made up of a bunch of tiny lines that make up walls. Doom does not work like that. Doom renders the world per object. This is a massive difference because, to accomplish this, it needed a way to very speedily traverse the world. Enter Binary Space Partitioning. Binary Space Partioning, at the time of Doom's release, was something really only used in the academic world. It was stuff that, like, the military used for simulations, or NASA used for the space shuttle. It was the most cutting edge 3D traversal system around. BSP works by subdividing the world into many partitions to create nodes (called lumps in doom) that contain single objects. BSP helps order the world into lumps so that, when you render the world around you, you don't have to render everything.

 Kotaku once ran an infamous article where they talked about Fustrum Culling as though it was a new technique Horizon Zero Dawn used to speed things up:

  (https://66.media.tumblr.com/a8b7b18d71e1167277a0e06a3e407d77/tumblr_inline_oqh1hamavB1tm46jo_500.gifv)

 Many people laughed and pointed out that it wasn't unique to that game, it was an old technique, which is correct. Many games used it before Horizon Zero Dawn. BUT NO 3D GAME USED IT BEFORE DOOM. Doom is the genesis of this technique, the magic behind how this technique works is BSP. Even today, modern 3D engines use BSP to speed things up. Without BSP, even modern graphics cards would be too slow to render. BSP is the "magic" that makes rendering large worlds possible. BSP is an ordering technique that sets everything up in a way that graphics technologies can speedily figure out what is or isn't in a fustrum. Without this ability to order objects, if everything was out of order in memory, it would simply be to slow.

 More to the point about doom being actual 3D -- while the map is an arrangement of objects on a flat plane, the objects themselves are NOT 2D. They are fully 3D, with both an X and Z component, plus a height component that is functionally a Y component. That's the trick to how Doom works so fast, it's a bunch of 3D objects, laid out on a 2D plane so that the early BSP traversal implementation didn't have to work so hard. Once CPUs became faster, it became possible to have BSP traversal in 3 dimensions (meaning operating on more data) and the process pretty seamlessly transitioned into 3D maps in Quake. But the core concept was there in Doom, just operating on less data to accomplish the same feat.

 Another example of how Doom teaches great concepts: Event handling. In games prior, things like joystick polling were done at intervals, in simplistic ways. Every bit of the game would have it's own routine to check input. Like, mario. The title screen has a part where it checks input, then determines if start is pressed to proceed. Then, once the game begins, an entirely separate piece of code in the game loop checks input, and figures out what to do if you press right, or A, or B, or whatever. Each screen, each game mode, had it's own input checking stuff. Doom doesn't work like this. There is one centeral, modular piece of technology (one of the core functions I mentioned above) that polls for input, independently of the rest of the game. To let this piece of technology talk to the rest of the game, it implements what is known as an Event Handler, which is a global queue of events that get passed from mode to mode. Events are queued using hardware interrupts, a way for the processor in your computer to receive a message outside of your program, directly from the joystick, which makes it say "oh shame, let's stop running the main code for a bit, and jump to this routine immediately, then when it's done, let's go back to exactly where we were in the main code." In Doom's instance, the IRQ code that is run when the joystick (or keyboard, or mouse) flags input, is a piece of code that takes the information polled, configures it into a package, then places it into the event queue. Then, individual game modes themselves have event handlers. They don't poll the input, they just handle the input if any exists. This means, for example, the menu in Doom does not need to check for input. Nor does the gameloop. Instead, they just have routines that, if input exists at all, will get executed. If no input exists, they don't get executed. This concept of events is a major change to how games work. All game engines today operate off of events, it's the main concept behind blueprints in things like UE4:

  (https://docs.unrealengine.com/Images/Engine/Blueprints/UserGuide/Events/EventHitEX.jpg)

 Again, this might seem rote today, but that's because DOOM popularized it. It's rote, because everyone is copying doom.

 I could keep going on and on about how this kind of stuff is laid out. Doom standardized game networking, for example, teaching synchronization methods. Doom popularized the concept of releasing editors and tools. Doom did a ton of things that all games today crib off of. Doom is, hands down, the most important and groundbreaking and trendsetting game of the last 30 years. Hell, I might say ever. Probably the most important game ever released.

 Pay your respects to Doom. It's legacy endures, the entire game industry owes it a huge technical debt.  
[/size]
Title: Re: Programming Thread
Post by: the-pi-guy on Jan 20, 2020, 02:35 AM
I've learned a lot of the basics.

But I have a long way to go.   :-\

*sigh*
Title: Re: Programming Thread
Post by: Legend on Jan 20, 2020, 04:49 AM
I've learned a lot of the basics.

But I have a long way to go.   :-\

*sigh*
Just focus on how far you've already come!  ;D

Title: Re: Programming Thread
Post by: the-pi-guy on Jan 20, 2020, 03:59 PM
Just focus on how far you've already come!  ;D


Sometimes I think I'm in a good place with stuff.  
Other times I look at job applications wanting masters degrees or PhD, and feel like I'm falling behind because I feel like I should be there already.  
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 06, 2020, 11:50 PM
(https://i.redd.it/0vmh03b24df41.jpg)
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 19, 2020, 04:27 PM
(https://preview.redd.it/86v60s9ksvh41.jpg?width=640&crop=smart&auto=webp&s=a6dbf60c8f8fbeda13ddc54fbdddebc8d0837653)
Title: Re: Programming Thread
Post by: Legend on Feb 19, 2020, 05:53 PM
(https://preview.redd.it/86v60s9ksvh41.jpg?width=640&crop=smart&auto=webp&s=a6dbf60c8f8fbeda13ddc54fbdddebc8d0837653)
At this point is that even hacking haha? It's more like a prank that could work on stupid human drivers too.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 06, 2020, 03:59 PM
For some reason I'm really anxious about Angular.  I feel kind of irritated with the idea of learning how to do it, even though I really have to.  

I'm having trouble finding good explanations for things, because they all seem to either be 1.) tutorial based, showing what to do, instead of explaining any kind of why, 2.) assume that you have some kind of specific background that the explanation makes sense.  

So I'm a bit frustrated.  
Title: Re: Programming Thread
Post by: Legend on Mar 06, 2020, 06:04 PM
For some reason I'm really anxious about Angular.  I feel kind of irritated with the idea of learning how to do it, even though I really have to.  

I'm having trouble finding good explanations for things, because they all seem to either be 1.) tutorial based, showing what to do, instead of explaining any kind of why, 2.) assume that you have some kind of specific background that the explanation makes sense.  

So I'm a bit frustrated.  
What made you decide to learn Angular?
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 06, 2020, 06:49 PM
What made you decide to learn Angular?
My internship supervisor suggested it was the best choice.  
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 14, 2020, 02:34 AM
Making better progress.

But I still hate it. 

I literally downloaded an example from Google's website for Angular.  And it doesn't work on my computer. 

I'm assuming I'm missing some dependencies, but of course I don't know which ones.  And I can't even find anyone having the same problems.
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 14, 2020, 03:21 AM
Early games: We gotta come up with the most efficient ways to do everything.  Only the simplest sprites.  Only a couple colors in any given square.
Large RPGs = 4 MB of data.  
--------
Now:
We're going to make incredibly detailed models with features no one will even notice.  
Large RPG = 100GB
Title: Re: Programming Thread
Post by: the-pi-guy on Mar 26, 2020, 07:17 AM
Angular isn't too bad, now that I've pushed myself to learn bits of it.  Learning how to smash some CSS + HTML together.  8)

Know enough now that I should be able to make okay progress.
Title: Re: Programming Thread
Post by: Legend on Mar 26, 2020, 08:15 AM
Early games: We gotta come up with the most efficient ways to do everything.  Only the simplest sprites.  Only a couple colors in any given square.
Large RPGs = 4 MB of data.  
--------
Now:
We're going to make incredibly detailed models with features no one will even notice.  
Large RPG = 100GB
Yeah the "inefficiency" of modern games is crazy. Nowadays artists and programmers can be separate people!

I love the youtube channel boundary break. Lots of games have very fun ways of doing things behind the scenes.
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 18, 2020, 01:47 AM
That moment when you're following a tutorial for something related,  (Because you're trying to use a combination of tools that aren't the most common combination)

you figure you're okay, because the php and mysql stuff will carry over no problem

But it's not working.  And you're not sure if it's a code problem or something else.  

Then bam, 5 hours later, you find out that it's because the file you saved was in the wrong folder, because this stack requires putting it in a totally different folder than the one for the tutorial you were following.  



(https://media.giphy.com/media/5eFp76zhsq3uw/source.gif)
Title: Re: Programming Thread
Post by: darkknightkryta on Apr 20, 2020, 06:55 PM
I am so frustrated with the people at... whoever the hell maintains the core linux kernel (Yes I know it's more than 1 person).  So here I was, programming a usb to jamma (arcade) converter using the joystick parsers that are built in, when I plugged in my dualshock 4 and found out my dpad wasn't registering.  Buttons were, but the dpad wasn't.  Obviously, the controller works fine, as I'm using it for games.  So I go and look into things, aaaaaaaaaaaaand joystick stuff was depreciated.  It was merged in the generic event stuff.  Cause apparently mice, keyboards, microphones, and controllers all have the same needs.  So what used to be something as simple as putting in js0 (Or any number, assuming I know how many joysticks there are going to be), to me having to parse the file system looking for something that ends in (joystick-events).  So now I have to write a directory parser, that needs to be constantly run since you can plug or unplug controllers.  I also need to figure out how the hell I'm supposed to use their new parser, since there isn't much information out there.  I went from parsing a few bytes of data for 1's and 0's to having to figure out if a button is pressed or not using their convoluted event system.  There was also a lot of tools with the old system that hasn't been replaced either.  It's mind boggling to me that sort of updating their file parsers with the old system, was somehow harder to maintain than merging everything and going through the glut of their event parser.  Like, I can't even fathom who thought this was a good idea.  I have to scrap everything I did in the past few months.

On another note, I need to find out of Raspberry Pis switch their GPIO pins from read to write blazingly fast.  I made a mistake with arcade boards.  They read 0 as a button press.  I was working under the assumption that 1 was a button press.  I can't send 1 to the board cause that might damage the arcade board (5V going up stream to a pin that's sending 5V downstream).  I have to set the pin to read for it to register as a no press, and 0 for a button press.  I might have to use a register->transistor system.  But I need to work with 40 bits at least.  the largest transistor array I found is 7 bits.  This is a massive circuit if I have to go through with that idea.
Title: Re: Programming Thread
Post by: Legend on Apr 20, 2020, 07:16 PM
(https://imgs.xkcd.com/comics/standards.png)

Controller inputs suck everywhere. For Twisty Puzzle Simulator I used Unity input, PS4 input, Steam VR input, and Steam Controller input all because everyone tries to be a one size fits all solution yet fails.
Title: Re: Programming Thread
Post by: darkknightkryta on Apr 21, 2020, 05:52 PM
(https://imgs.xkcd.com/comics/standards.png)

Controller inputs suck everywhere. For Twisty Puzzle Simulator I used Unity input, PS4 input, Steam VR input, and Steam Controller input all because everyone tries to be a one size fits all solution yet fails.
What gets me is that they have to leave the joystick stuff in for legacy.  Like, holy shame, just update the joystick parsers and leave them separate.  You have to update them anyways.
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 22, 2020, 07:47 PM
Title: Re: Programming Thread
Post by: Legend on Apr 22, 2020, 09:18 PM

Love a good Tom Scott video.

That excel bug is great. It's almost like the fake island that stayed on google maps for years.

Title: Re: Programming Thread
Post by: the-pi-guy on Apr 23, 2020, 05:53 PM
So I bought the Real Time Rendering textbook.
I'm a bit worried about it.  The content is supposed to be better than ever, but the actual quality of the printing and binding has had scores of concerns.  Including pages just falling out.  
Title: Re: Programming Thread
Post by: Legend on Apr 23, 2020, 06:14 PM
So I bought the Real Time Rendering textbook.
I'm a bit worried about it.  The content is supposed to be better than ever, but the actual quality of the printing and binding has had scores of concerns.  Including pages just falling out.  
Hopefully it's all good. Should be a good book to have.
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 24, 2020, 10:05 PM
I ran into a situation where it was vastly more helpful to use a book than Google.
Kept trying to use Google to figure out how to combine 2 mysql queries.  No real luck with what I searched. 

But it turned out the solution was literally on the page I left myself on in my database book. 

This whole project is kind of crazy for me.  Slapping together some PHP, HTML, CSS, Angular, and MYSQL stuff on the fly.  Despite the fact that I've done very little of any of this before. 

Hopefully it's all good. Should be a good book to have.
It seems a little on the low end, but no real problems! 
Title: Re: Programming Thread
Post by: Legend on Apr 24, 2020, 10:21 PM
I ran into a situation where it was vastly more helpful to use a book than Google.
Kept trying to use Google to figure out how to combine 2 mysql queries.  No real luck with what I searched.  

But it turned out the solution was literally on the page I left myself on in my database book.  

This whole project is kind of crazy for me.  Slapping together some PHP, HTML, CSS, Angular, and MYSQL stuff on the fly.  Despite the fact that I've done very little of any of this before.  
It seems a little on the low end, but no real problems!  
If you don't mind sharing, what was your solution? I'm wondering if you used joined queries or did something I've never heard of since I've only learned mysql from google.
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 24, 2020, 11:03 PM
If you don't mind sharing, what was your solution? I'm wondering if you used joined queries or did something I've never heard of since I've only learned mysql from google.
Sorry, I wasn't accurate with my wording. I'm just dumb with this stuff.  And I think my googling has gotten worse or something.  Just now pretty easily found this first solution.  

What I was actually trying to figure out how to do:
SELECT x, y, z FROM a WHERE x="something" AND ( y LIKE "something" OR z LIKE "something")

This would work, but wasn't sure if I could chain it like that, because all of the examples I was looking at only looked like "a AND b AND c".

But from my book this works:

SELECT x, y, z FROM a WHERE y LIKE "something" OR z LIKE "something" from
   (SELECT x,y,z FROM a WHERE x="something")
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 24, 2020, 11:03 PM
I need to rest more.
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 30, 2020, 04:47 PM
So I'm not sure what to do here.  

My supervisor suggested just using Google sign in to manage security stuff.  

So now I'm wondering what I should do.  

1.) Should I have a register page, then they sign in later with Google and match it to the right email?  (Downside is having to deal with more stuff)

2.) Should I not have a register page, then just match an account with an email? (Downside is people could have multiple accounts on accident).  

3.) Should I do something horrible like mix and match.  Have a register page and have Google sign in also do the same kind of thing?  


I don't know what the recommendation here.  

This whole project is weird for me.  A whole mountain of stuff I don't care about.  

What kinds of not completely pointless information should I be saving?  



Not to mention, website development stuff and databases are kind of not my thing.
Title: Re: Programming Thread
Post by: Legend on Apr 30, 2020, 05:37 PM
So I'm not sure what to do here.  

My supervisor suggested just using Google sign in to manage security stuff.  

So now I'm wondering what I should do.  

1.) Should I have a register page, then they sign in later with Google and match it to the right email?  (Downside is having to deal with more stuff)

2.) Should I not have a register page, then just match an account with an email? (Downside is people could have multiple accounts on accident).  

3.) Should I do something horrible like mix and match.  Have a register page and have Google sign in also do the same kind of thing?  


I don't know what the recommendation here.  

This whole project is weird for me.  A whole mountain of stuff I don't care about.  

What kinds of not completely pointless information should I be saving?  



Not to mention, website development stuff and databases are kind of not my thing.
I've never used google sign in but you shouldn't need to also have a registration page.

Google sign in is just used to authenticate the user. Once you know the user is who they say they are, you can seamlessly create an account on your backend if one doesn't already exist.


Shouldn't save email addresses unless you need to be using them beyond signing in.
Title: Re: Programming Thread
Post by: the-pi-guy on Apr 30, 2020, 06:04 PM
I've never used google sign in but you shouldn't need to also have a registration page.

Google sign in is just used to authenticate the user. Once you know the user is who they say they are, you can seamlessly create an account on your backend if one doesn't already exist.
Sounds good.  This was what I was leaning towards.  


Quote
Shouldn't save email addresses unless you need to be using them beyond signing in.

Yep!  
Saving as little as possible of anything.
Title: Re: Programming Thread
Post by: the-pi-guy on May 01, 2020, 04:31 PM
I have no clue what to do.  

I've spent today and yesterday trying to fix 1 bug.  

I've even tried using an example, and my code looks exactly like theirs.  But something is still amiss.  

And I'm not really sure if there's something wrong with the front end, or the back end, or if it's just a mismatch between the two.  


Just as I say this.  I have made progress....  

And it's doing it again, even after I rolled back every file.  
Title: Re: Programming Thread
Post by: the-pi-guy on May 01, 2020, 09:37 PM
I have no clue what to do.  

I've spent today and yesterday trying to fix 1 bug.  

I've even tried using an example, and my code looks exactly like theirs.  But something is still amiss.  

And I'm not really sure if there's something wrong with the front end, or the back end, or if it's just a mismatch between the two.  


Just as I say this.  I have made progress....  

And it's doing it again, even after I rolled back every file.  
Very slowly figuring it out!  
Title: Re: Programming Thread
Post by: the-pi-guy on May 02, 2020, 01:26 AM
The issue was the php stuff.  

Still not completely sure what is going on.  

The if statement breaks it for some reason.  Probably something stupid like a semicolon that I cant see.  
Title: Re: Programming Thread
Post by: Legend on May 02, 2020, 01:53 AM
The issue was the php stuff.  

Still not completely sure what is going on.  

The if statement breaks it for some reason.  Probably something stupid like a semicolon that I cant see.  
Php can be funky with scopes, or does it not even run?
Title: Re: Programming Thread
Post by: the-pi-guy on May 02, 2020, 02:44 AM
Php can be funky with scopes, or does it not even run?
I figured it out.
It's something wrong with my mysql command.  It's not written right, but I'm not exactly sure what the exact right way to do it is.


I'm pretty burnt out though.
Title: Re: Programming Thread
Post by: the-pi-guy on May 02, 2020, 04:29 PM
So my big problem is that I had no real debugging tools.  Was too lazy to do that.
I was basically just using the dev tools to tell me the angular code problems.  But the php and mysql that's inside the php does not give errors in the dev tools.  
So I had to try finding ways to debug the php and mysql separately.  

The problem was a lot easier to solve once I realized that...   :(
Title: Re: Programming Thread
Post by: the-pi-guy on May 02, 2020, 10:57 PM
Sorry I like venting.  

The other really irritating thing was that the php was causing a CORS error. And literally every stack overflow post basically said it was a permission issue.  And to add the access to the .htaccess file or to add it to the post message.  


Nope. I had already tried that. The problem was something else in my mess of a program not working
Title: Re: Programming Thread
Post by: the-pi-guy on May 04, 2020, 02:35 PM
It seems harder than it should be to have a method wait for a http get to return.  

The way I had it set up is to get the account, and then create it if it doesn't exist.  But there's an issue that the post doesn't wait for the get.  So it just ends up creating a new user every log in.  


But I'm wondering if it'd be easier to either:

-have the post request on the server end just check for duplicates.

-maybe roll in the get/post user into the same kind of command.  
Title: Re: Programming Thread
Post by: Legend on May 04, 2020, 04:06 PM
Are you using php?

I don't know the flow for google sign in but it shouldn't have issues like you are having.


Post and get are essentially the same thing and they go together in php. Are you talking about $_GET and $_POST not having the info you want? Or do you mean you're sending post and get info to google and not getting a response?

Edt, or you mean mysql side of things?

Title: Re: Programming Thread
Post by: the-pi-guy on May 04, 2020, 04:21 PM
Are you using php?

I don't know the flow for google sign in but it shouldn't have issues like you are having.


Post and get are essentially the same thing and they go together in php. Are you talking about $_GET and $_POST not having the info you want? Or do you mean you're sending post and get info to google and not getting a response?

Edt, or you mean mysql side of things?


I mean the MySQL side. Google works good. 
I get the Google sign in and try getting the profile from MySQL.  And create one if it doesn't exist. 

I am using PHP.  I think I will try rolling it into the same php file.
Title: Re: Programming Thread
Post by: Legend on May 04, 2020, 05:06 PM
I mean the MySQL side. Google works good.  
I get the Google sign in and try getting the profile from MySQL.  And create one if it doesn't exist.  

I am using PHP.  I think I will try rolling it into the same php file.
Make the google id unique in your database. Should stop dups.
Title: Re: Programming Thread
Post by: the-pi-guy on May 04, 2020, 05:38 PM
Make the google id unique in your database. Should stop dups.
The issue there is, you cant make a text column unique.

The fix would be a varchar of a predetermined length. But everyone says not to do it, because the Id token supposedly can be of arbitrary length and have a tendency to get longer.

I can just make a varchar column that's just overly big.
Title: Re: Programming Thread
Post by: the-pi-guy on May 05, 2020, 02:27 AM

Once this website junk is complete, I think I want to make a quick and dirty vocab app.  

Hot jam.  

I finally got all the basic sign in stuff working!  

Today's stuff was super easy too.
-changed the PHP code to check if the user exists first, then sends either the new User or it sends the already created user.  
-changed the Angular code to wait for the profile data to get sent over, and then it changes the variable to let the user know they've been logged in.  It was literally just a 1 line code addition, but I was a bit worried that something more complicated was needed.  
Title: Re: Programming Thread
Post by: the-pi-guy on May 07, 2020, 03:22 AM
So I made a text editor for my website.

With how many WYSIWYG's editors that I was seeing while trying to find out how to make one, I was expecting it to be really difficult. 

But actually there are some good tools built into HTML/typescript that made it really easy. 

With how much work I'm putting into this, I think I'm ready to make VizionEck forum 3.0 from scratch.  8)

Nah, I really still don't like website development.

Although maybe I'll make that Japanese app a website...


Edit. Now that I think of it, the best thing that has come out of this, is to show when push comes to shove, I can push myself to make a decent sized project.
Title: Re: Programming Thread
Post by: the-pi-guy on May 19, 2020, 03:59 AM
My website feels lame.  I really only made like 5 webpages.  

On the other hand, it took like 10 HTML, 10 CSS files, probably 30 typescript files, 14 php files to make it work.  

Still the learning curve really made this take a lot longer than it should have.
I think if I were making something similar in Java, it would have taken half or maybe even as little as a quarter of the time.  But it took a lot of creative bug fixing.

Title: Re: Programming Thread
Post by: the-pi-guy on May 22, 2020, 10:36 AM
(https://imgs.xkcd.com/comics/x.png)
Spoiler for Hidden:
The worst is when you run out of monospaced fonts and have to use variable-width variables.
Title: Re: Programming Thread
Post by: darkknightkryta on May 22, 2020, 03:00 PM
So I bought the Real Time Rendering textbook.
I'm a bit worried about it.  The content is supposed to be better than ever, but the actual quality of the printing and binding has had scores of concerns.  Including pages just falling out.  
Off topic, but I remember buying the strategy guide for Final Fantasy XII.  It literally fell apart.
Title: Re: Programming Thread
Post by: the-pi-guy on May 23, 2020, 12:25 AM
I just tested a php program in another program.

Notepad++ informed me that the file was gone.  

So I tried resaving.  Notepad++ informs me that I can't save in this location.

Turns out, I can save any other file name, except the one that just vanished.  

I don't know how to fix this.
Title: Re: Programming Thread
Post by: Legend on May 23, 2020, 01:18 AM
I just tested a php program in another program.

Notepad++ informed me that the file was gone.  

So I tried resaving.  Notepad++ informs me that I can't save in this location.

Turns out, I can save any other file name, except the one that just vanished.  

I don't know how to fix this.
What was the file name? Was it a reserved windows one lol?
Title: Re: Programming Thread
Post by: the-pi-guy on May 23, 2020, 01:20 AM
What was the file name? Was it a reserved windows one lol?
No.  
createUser.php

I resaved the file with a new name.  But every time I try testing it, windows hides it and makes it so that a file can't be saved with that name in that location.

Restarting the computer lets me re-save the file.  
Title: Re: Programming Thread
Post by: the-pi-guy on May 23, 2020, 05:01 AM
It happens when I'm trying to authenticate a token id for Google.  I pretty much just took the lines they had and installed the necessary libraries.

It was giving me an error because I passed in the wrong thing, so I know it's finding the right method.  

But now that I'm passing in the right thing (I think), when I make the method call, it instead deletes the file, and protects it or something.  
Title: Re: Programming Thread
Post by: Legend on May 23, 2020, 05:05 AM
It happens when I'm trying to authenticate a token id for Google.  I pretty much just took the lines they had and installed the necessary libraries.

It was giving me an error because I passed in the wrong thing, so I know it's finding the right method.  

But now that I'm passing in the right thing (I think), when I make the method call, it instead deletes the file, and protects it or something.  
That is really strange. How/why would the file do anything with windows?
Title: Re: Programming Thread
Post by: the-pi-guy on May 23, 2020, 06:18 PM
That is really strange. How/why would the file do anything with windows?
This makes no sense!  
It's like trying the method deletes the file, and then protects the file from being overwritten.  

I feel like I'm in some kind of debugger hell.  

It's been hard to find anything online that even remotely comes close.  
Title: Re: Programming Thread
Post by: Legend on May 23, 2020, 06:46 PM
This makes no sense!  
It's like trying the method deletes the file, and then protects the file from being overwritten.  

I feel like I'm in some kind of debugger hell.  

It's been hard to find anything online that even remotely comes close.  
Maybe antivirus software is thinking it's bad?
Title: Re: Programming Thread
Post by: the-pi-guy on May 23, 2020, 06:56 PM
It sounds an awful lot like php's unlinking call.

PHP: unlink - Manual  (https://www.php.net/manual/en/function.unlink.php)
Quote
On Windows, it is now possible to unlink() files with handles in use, while formerly that would fail. However, it is still not possible to re-create the unlinked file, until all handles to it have been closed.

I think this seems consistent with what I'm seeing.  

The file gets deleted, but it still has handles pointing to it so it can't be overwritten.

I don't think this helps, because none of my code is using the unlink command.
Title: Re: Programming Thread
Post by: the-pi-guy on May 23, 2020, 10:14 PM
Digging into the Google API, and this is the line that crashes things.  

$response = $this->http->get($url);

Which I'm not sure why.  I'm hoping it's not something stupid like, since I tried it from a command line, the $url is uninitialized.  
Title: Re: Programming Thread
Post by: Legend on May 23, 2020, 10:21 PM
Digging into the Google API, and this is the line that crashes things.  

$response = $this->http->get($url);

Which I'm not sure why.  I'm hoping it's not something stupid like, since I tried it from a command line, the $url is uninitialized.  
Have you been able to ever fetch urls with this project?
Title: Re: Programming Thread
Post by: the-pi-guy on May 23, 2020, 11:44 PM
Have you been able to ever fetch urls with this project?
Yeah.  So it works when I call it from the webpage.  

But then it doesn't give me any helpful error messages.  

Do you know of any helpful ways to basically send a fake url through command line?
Title: Re: Programming Thread
Post by: Legend on May 24, 2020, 12:16 AM
Yeah.  So it works when I call it from the webpage.  

But then it doesn't give me any helpful error messages.  

Do you know of any helpful ways to basically send a fake url through command line?
I don't.

Can you hard code a url just for testing?
Title: Re: Programming Thread
Post by: the-pi-guy on May 24, 2020, 01:26 AM
Ugh.
Now I don't get that error anymore.  I'm not even sure why. Rolled back the code, still don't get that error anymore. 

Instead I have another problem now

The verifyid token isn't returning anything.

I'm trying to use a hardcoded value, and a passed in value.  PHP says they're the same, but for some reason, it works with the hard coded value, but not the passed in value. 


(https://media.giphy.com/media/bPCwGUF2sKjyE/giphy.gif)
Title: Re: Programming Thread
Post by: Legend on May 24, 2020, 03:16 AM
Ugh.
Now I don't get that error anymore.  I'm not even sure why. Rolled back the code, still don't get that error anymore.  

Instead I have another problem now

The verifyid token isn't returning anything.

I'm trying to use a hardcoded value, and a passed in value.  PHP says they're the same, but for some reason, it works with the hard coded value, but not the passed in value.  


(https://media.giphy.com/media/bPCwGUF2sKjyE/giphy.gif)
Like within php it returns true with ===?

Programming is supposed to be logical! That does not make sense lol.
Title: Re: Programming Thread
Post by: the-pi-guy on May 24, 2020, 03:24 AM
Like within php it returns true with ===?

Programming is supposed to be logical! That does not make sense lol.

Yes. That is what it does.   :-\

None of this makes any sense.
Title: Re: Programming Thread
Post by: the-pi-guy on May 24, 2020, 09:08 PM
My leading theory right now (and I don't think it's even a good one), is that there is some formatting issue with the input string.

The two strings have the same contents, but perhaps with different encoding, so === says they're the same because they have the same content, but Google's verify method ends up doing some kind of special hashing or other function that makes a difference.  

My secondary theory is that there is some weird pass by value/pass by reference business going on.  But it seems PHP passes by value, unless you specify it to do otherwise.
Title: Re: Programming Thread
Post by: the-pi-guy on May 24, 2020, 10:49 PM
@Legend

Any ideas?
Title: Re: Programming Thread
Post by: Legend on May 25, 2020, 12:00 AM
@Legend

Any ideas?
Have you tried doing funky things like producing a third string as a mix of the two?

$frankenString=$hardCodedUrl;

$frankenString[3]=$otherUrl[3];


//send off frankenstring


Could see if it works for any swapped character.

Also just double checking, have you been using == not ===? Maybe the user entered string isn't a string.
Title: Re: Programming Thread
Post by: the-pi-guy on May 25, 2020, 12:10 AM
Have you tried doing funky things like producing a third string as a mix of the two?

$frankenString=$hardCodedUrl;

$frankenString[3]=$otherUrl[3];


//send off frankenstring


Could see if it works for any swapped character.

Also just double checking, have you been using == not ===? Maybe the user entered string isn't a string.
I used both == and ===.

The latter evaluates as true, the former returns a 1.
Title: Re: Programming Thread
Post by: Legend on May 25, 2020, 12:38 AM
I used both == and ===.

The latter evaluates as true, the former returns a 1.
Have you tried restarting your computer?

At this point there are pretty much only three options. Php itself is broken on your machine, some other thing on your computer is causing this, you found a glitch in the matrix.
Title: Re: Programming Thread
Post by: darkknightkryta on May 25, 2020, 02:24 AM
I need to get my dog in gear.  I want to make a course website, but where it works out like an RPG.
Title: Re: Programming Thread
Post by: the-pi-guy on May 25, 2020, 03:20 AM
Have you tried restarting your computer?

At this point there are pretty much only three options. Php itself is broken on your machine, some other thing on your computer is causing this, you found a glitch in the matrix.

Guess tomorrow's plan is to reinstall php.  :(

Or maybe set up an ide finally.  
Title: Re: Programming Thread
Post by: the-pi-guy on May 25, 2020, 04:01 PM
I don't use this kind of language often. 


But what the fudge. 


I thought I tried a try catch before this.  I must not have.

I was hoping there'd be some error code that would be caught, instead it works perfectly.  The function now works perfectly with the passed in data.  It doesn't catch any error, it just tries and succeeds. 

I'm literally shaking. I'm not sure if I'm happy or pissed right now.

Google sign in now works front end and back end.
Title: Re: Programming Thread
Post by: Legend on May 25, 2020, 04:19 PM
I don't use this kind of language often.  


But what the fudge.  


I thought I tried a try catch before this.  I must not have.

I was hoping there'd be some error code that would be caught, instead it works perfectly.  The function now works perfectly with the passed in data.  It doesn't catch any error, it just tries and succeeds.  

I'm literally shaking. I'm not sure if I'm happy or pissed right now.

Google sign in now works front end and back end.
Well it works at least!
Title: Re: Programming Thread
Post by: the-pi-guy on May 25, 2020, 04:26 PM
Well it works at least!
But why!?

I am feeling this on a spiritual level right now:

(https://i.pinimg.com/236x/11/0a/7f/110a7fec924b161ca30c61c86676757f--computer-programming-computer-humor.jpg)
Title: Re: Programming Thread
Post by: the-pi-guy on May 25, 2020, 11:23 PM
On to Facebook's sign in, which is very different.  

Google's sign in, sends you a key, and then you have to authenticate the key to get the information that's needed.
Facebook's sign in sends you the information that's needed, but then they seem to save your sign in session.

So Facebook's is easier to sign in, harder to sign out.
Title: Re: Programming Thread
Post by: the-pi-guy on May 26, 2020, 03:42 PM
My website feels lame.  I really only made like 5 webpages.  
My website isn't actually very lame.  

Some of the other capstone projects are really small.  

One is a flashcard app.  
Title: Re: Programming Thread
Post by: darkknightkryta on May 26, 2020, 09:19 PM
Oh god, I remember having to program Facebook login into apps.  It was a pain in the dog.  We decided to use an all one one solution.  This was 6 years ago, so I don't know what it's like now.
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 08, 2020, 03:59 AM
I want to make regular paper flashcards from a excel document.  

Not sure how to do it.  I want to match stuff, if this is my excel document:

1   X  Y
1   X  Z
1   X  A
2   B  C
2   B  D
3   E  F

I want to put all the 1's on one card:
Front:
X
X
X

Back:
Y
Z
A

But uh, I have no clue how to do that.
Title: Re: Programming Thread
Post by: kitler53 on Jun 08, 2020, 02:32 PM
I want to make regular paper flashcards from a excel document.  

Not sure how to do it.  I want to match stuff, if this is my excel document:

1   X  Y
1   X  Z
1   X  A
2   B  C
2   B  D
3   E  F

I want to put all the 1's on one card:
Front:
X
X
X

Back:
Y
Z
A

But uh, I have no clue how to do that.
i've never tried in excel.  seems like the kind of thing word is better suited for because if you want paper flashcard layout is more important than data.

in word you create a grid and size it up the way out want (4 cards per page?  6? 8?) and then put the fronts of the card on "page 1" and the backs of the cards on "page 2".   Then as long as you keep the layout consistent you can get the flashcards correct by "printing on both sides".
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 08, 2020, 02:56 PM
i've never tried in excel.  seems like the kind of thing word is better suited for because if you want paper flashcard layout is more important than data.

in word you create a grid and size it up the way out want (4 cards per page?  6? 8?) and then put the fronts of the card on "page 1" and the backs of the cards on "page 2".   Then as long as you keep the layout consistent you can get the flashcards correct by "printing on both sides".

Word has a feature where you can take data from excel and format it how you want.  Usually done with addresses, but I think it should work here.

I just need to format the data so it doesn't because ~8000 flashcards.
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 29, 2020, 04:26 AM
Visual Studio: keep brackets on the same line.  

I know, I'm a monster.  

(https://i.stack.imgur.com/Wc2Kk.jpg)

It's so crazy to me, that Visual Studio literally has an option to change this one specific thing depending on context.
Title: Re: Programming Thread
Post by: Legend on Jun 29, 2020, 04:30 AM
Visual Studio: keep brackets on the same line.  

I know, I'm a monster.  

(https://i.stack.imgur.com/Wc2Kk.jpg)

It's so crazy to me, that Visual Studio literally has an option to change this one specific thing depending on context.
I prefer the first but I am often too lazy to think about it so I often default to the second...
Title: Re: Programming Thread
Post by: the-pi-guy on Jun 29, 2020, 04:55 AM
I prefer the first but I am often too lazy to think about it so I often default to the second...
Who knew smart people could be so wrong?   ::)

But for real I prefer the second but I think it's weird how touchy some people are about it.  My partner on a project spent like 20 minutes fixing the formatting on a project. Minor things like the brackets, nothing actually wrong.
Title: Re: Programming Thread
Post by: Legend on Jun 29, 2020, 05:12 AM
Who knew smart people could be so wrong?   ::)

But for real I prefer the second but I think it's weird how touchy some people are about it.  My partner on a project spent like 20 minutes fixing the formatting on a project. Minor things like the brackets, nothing actually wrong.

It sure would be nice if things like that could just be visual settings. One programer sees them on the same line, the other sees them on different lines. For most projects we don't really need to treat code like a text file even if it's 100% text based.
Title: Re: Programming Thread
Post by: darkknightkryta on Jun 29, 2020, 01:20 PM
I need them on the same column when I'm debugging my student's code.  I have them nest a lot of If statements and they tend to forget to close a few of them.  It's a pain trying to find which bracket is missing if they aren't lined up.
Title: Re: Programming Thread
Post by: the-pi-guy on Jul 05, 2020, 08:52 PM
This is a monstrosity:


https://github.com/TerryCavanagh/VVVVVV/blob/e18dd195babfa1676785c17263c33df2699c26ee/desktop_version/src/Game.cpp#L708
Title: Re: Programming Thread
Post by: Legend on Jul 05, 2020, 09:13 PM
This is a monstrosity:


https://github.com/TerryCavanagh/VVVVVV/blob/e18dd195babfa1676785c17263c33df2699c26ee/desktop_version/src/Game.cpp#L708
I love stuff like that. Mike Bithell had a great talk about how you shouldn't try to impress anyone with your code when it's the game itself that matters. If it works, it works.

Although that is definitely a monstrosity haha. For some reason I think the text dialogue being hard coded irked me the most.
Title: Re: Programming Thread
Post by: the-pi-guy on Jul 07, 2020, 07:04 PM
(https://i.redd.it/zftxoobamf951.jpg)
Title: Re: Programming Thread
Post by: the-pi-guy on Jul 19, 2020, 07:17 PM
I need to do more programming.  

I've become soft.
Title: Re: Programming Thread
Post by: Legend on Jul 19, 2020, 07:42 PM
I need to do more programming.  

I've become soft.
Make an ai  8)
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 04, 2020, 09:42 PM
I spent an embarrassing amount of time trying to figure out why my terrain was at 0,0,0 and my character was at 0,0,0
But my character had to be at like 430, 0, 430 in order to overlap with the terrain.  

The grouping I had my terrain in was shifted over.  
Title: Re: Programming Thread
Post by: Legend on Aug 04, 2020, 09:44 PM
I spent an embarrassing amount of time trying to figure out why my terrain was at 0,0,0 and my character was at 0,0,0
But my character had to be at like 430, 0, 430 in order to overlap with the terrain.  

The grouping I had my terrain in was shifted over.  
local vs global position?
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 04, 2020, 09:47 PM
local vs global position?
Yep.   :P
Title: Re: Programming Thread
Post by: Legend on Aug 04, 2020, 10:18 PM
Yep.   :P
Unity strikes again
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 04, 2020, 11:12 PM
Unity strikes again
I knew it was a local vs global issue, I was just very confused where it was coming in.  
Title: Re: Programming Thread
Post by: the-pi-guy on Sep 13, 2020, 04:24 PM
(https://i.redd.it/y00tczjk7wm51.png)
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 08, 2020, 01:06 AM
Title: Re: Programming Thread
Post by: Legend on Oct 08, 2020, 01:34 AM

Never seen anything like that lol. 5 aaa must be a really senior spot or just a sports studio lol.
Title: Re: Programming Thread
Post by: kitler53 on Oct 08, 2020, 12:44 PM
eh. job postings are a companies wish list.  I've never hired a person that has met all of the job posting criteria. 
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 14, 2020, 08:24 PM
{id, object}
{hhid, object}

"Okay, so we just take all the same code and replace id with hhid.  Easy"


*Hour later*

Browser: whhidth=100
Title: Re: Programming Thread
Post by: Legend on Oct 14, 2020, 09:08 PM
{id, object}
{hhid, object}

"Okay, so we just take all the same code and replace id with hhid.  Easy"


*Hour later*

Browser: whhidth=100

Haha yeah I've had that with php since I wrote it in a text editor.
Title: Re: Programming Thread
Post by: Legend on Oct 20, 2020, 07:17 AM
I'm going insane.

It is a complete tangent to everything and a good enough solution really would be good enough, but I'm trying to create an algorithm that fits an axis aligned regular hexagon to a grid of points, while making the hexagon as small as possible.

I have spent hours just bashing my head against trig only to realize I've made basic fundamental mistakes like multiplying by 2 instead of dividing. I keep coming up with seemingly solid algorithms, only for them to fail on edge cases. Why the heck am I bothering with this? I think I'll delete it all in the morning, unless the solution is stupidly obvious once I have slept.
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 20, 2020, 09:29 PM
I'm going insane.

It is a complete tangent to everything and a good enough solution really would be good enough, but I'm trying to create an algorithm that fits an axis aligned regular hexagon to a grid of points, while making the hexagon as small as possible.

I have spent hours just bashing my head against trig only to realize I've made basic fundamental mistakes like multiplying by 2 instead of dividing. I keep coming up with seemingly solid algorithms, only for them to fail on edge cases. Why the heck am I bothering with this? I think I'll delete it all in the morning, unless the solution is stupidly obvious once I have slept.
Did sleep help?
Title: Re: Programming Thread
Post by: Legend on Oct 21, 2020, 12:40 AM
Did sleep help?
Ya.

I decided to just not do it.
Title: Re: Programming Thread
Post by: the-pi-guy on Dec 23, 2020, 07:57 PM
I really need to start doing things more efficiently.

I have a tendency to do stuff project based. I make stuff from scratch for each project.

Like any time I need to read from a file, I make that from scratch everytime.  I've probably written the same kinds of methods like 20 times and I've probably used like 4 different Java libraries to do that same thing in slightly different ways.

I need to get better about doing this kind of stuff more efficiently. Making libraries, instead of just making stuff for projects.
Title: Re: Programming Thread
Post by: Legend on Dec 23, 2020, 08:59 PM
I really need to start doing things more efficiently.

I have a tendency to do stuff project based. I make stuff from scratch for each project.

Like any time I need to read from a file, I make that from scratch everytime.  I've probably written the same kinds of methods like 20 times and I've probably used like 4 different Java libraries to do that same thing in slightly different ways.

I need to get better about doing this kind of stuff more efficiently. Making libraries, instead of just making stuff for projects.

Ditto.

I'm horrible at all that.
Title: Re: Programming Thread
Post by: kitler53 on Dec 23, 2020, 10:59 PM
requires having vision over the entire whatever and recognizing what will be reusable from what is purpose driven.  

this kind of vision planning is what everyone sucks at the most.  
Title: Re: Programming Thread
Post by: the-pi-guy on Dec 31, 2020, 07:16 PM
I was forced to make an equation, and I want to share it as it doesn't seem to exist... : gamedev (https://www.reddit.com/r/gamedev/comments/kntrvr/i_was_forced_to_make_an_equation_and_i_want_to/)

This is odd.
Title: Re: Programming Thread
Post by: Legend on Dec 31, 2020, 07:26 PM
I was forced to make an equation, and I want to share it as it doesn't seem to exist... : gamedev (https://www.reddit.com/r/gamedev/comments/kntrvr/i_was_forced_to_make_an_equation_and_i_want_to/)

This is odd.
It seems to be working for them but I don't understand what or why.
Title: Re: Programming Thread
Post by: the-pi-guy on Dec 31, 2020, 07:42 PM
.
Unrelated.

Do any of your games have environment destruction/deformation?  
Title: Re: Programming Thread
Post by: Legend on Dec 31, 2020, 07:50 PM
Unrelated.

Do any of your games have environment destruction/deformation?  
Technically Twisty Puzzle Simulator has environment destruction  ::) One of the castle walls has a crack and can be destroyed with the cannon.

Forged Odyssey is 100% destroyable/deformable. It's a "voxel" game just without the traditional voxels.
Title: Re: Programming Thread
Post by: the-pi-guy on Dec 31, 2020, 08:02 PM
Forged Odyssey is 100% destroyable/deformable. It's a "voxel" game just without the traditional voxels.
Is there something similar in another game?
Title: Re: Programming Thread
Post by: Legend on Dec 31, 2020, 08:52 PM
Is there something similar in another game?
I don't even know what I'm doing yet, but I don't think any other game does something similar. Every single thing is built from molecules, but things clump based off structure. Once a thing has clumped, the individual parts can be discarded.

This is best shown with piles of objects. Say a player starts dumping gold coins on the ground. The first few coins can be physical objects but once there are enough to consider it a "collection" of coins, the game internally creates a new node that holds all of them. Individual coins are tracked visually but the game logic just says "the pile has X properties and has Y inside."
Title: Re: Programming Thread
Post by: the-pi-guy on Dec 31, 2020, 09:04 PM
I see.  

I am itching to work on stuff.  

Voxels or something similar seem like the easiest way to do some stuff that I want to do.

Title: Re: Programming Thread
Post by: the-pi-guy on Feb 16, 2021, 02:24 AM
I'll be getting back into game development as soon as I can get a new desktop.  
I do have more usage over my laptop, but i'll be getting a desktop soon ish hopefully, which will be better.  

There has been one technical challenge that has been on my mind for my language game.  
How do I associate a word with another word?  That's not straightforward. Does read associate with 読む or does it associate with 読みました?  

I think the easy solution is to encode it somehow like (read, 読む)  but that's still an enormous pain.  How do I automate that better?

Long story short, I'm working on a text editor that would be able to give specialized suggestions.
Title: Re: Programming Thread
Post by: the-pi-guy on Feb 17, 2021, 02:03 AM
It's kind of fun when you read on stack overflow on how something can't be done and then you figure out a way to do it.
Title: Re: Programming Thread
Post by: Legend on Mar 16, 2021, 07:10 AM
I genuinely hate Unity some times.

With Forged Odyssey I used a shader to render meshes as flat uv images. It's a great trick to convert objects back into textures. Well with Hapax I'm using Unity's new HDRP and while I love a lot about it, I'm at its mercy.

I tried replicating this but nope. HDRP doesn't support shader replacement and the function works as a regular render without any errors.

So I switch over and manually set it up. This is only for development so it can be slow and messy.


But then I run into another issue. Unity can't render negative values into textures. It's supposed to. Everything online says it does, but it seems HDRP is breaking that too.

So I just set the system to translate the floating point value to keep all of them positive. But this doesn't work because I then discover there is still something active messing with my colors after they are rendered.

I say screw it. I don't care to tear apart the unity hdrp right now. I'll just convert the float to 1s and 0s and send the data over 32 frames per color! By this point I have gone fully mad of course.

...

I ended up just using a command buffer. HDRP does whatever HDRP does and then I just render a second time after it finishes. Negative floats work fine.
Title: Re: Programming Thread
Post by: Legend on May 20, 2021, 11:22 PM
I connected to NASA servers through ftp today, that was fun.

I've been doing way too much research into stars. Gaia is great!
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 28, 2021, 03:51 AM
Crazy idea that I don't know if I will do it. 

My work is primarily focused on web apps (vue) and a sql database.

Kind of tempted to make something at home like a few localhost webpages.   
Title: Re: Programming Thread
Post by: Legend on Aug 28, 2021, 04:15 AM
Crazy idea that I don't know if I will do it.  

My work is primarily focused on web apps (vue) and a sql database.

Kind of tempted to make something at home like a few localhost webpages.  

Don't know what you want to do with it, but do it!
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 28, 2021, 07:58 PM
Don't know what you want to do with it, but do it!
Short term: turn that games form into a better intranet web page.

Long term I don't even know for sure.  
Title: Re: Programming Thread
Post by: the-pi-guy on Aug 30, 2021, 02:25 AM
I successfully have a local SQL server and a local webpage that gets data from it.  

So that's cool.
Title: Re: Programming Thread
Post by: Legend on Sep 06, 2021, 08:10 PM
I tried my hand at some neural nets from scratch but I had some issues. Felt like I was brute forcing results instead of making predictable progress.




With just an input and output layer, I can get to this level of quality super quick. Sometimes it makes it a bit farther but never down to the next loop.



With a middle layer it reaches the same spot but takes a bit longer to train. This is around 50,000 epochs.



Two middle layers doesn't improve the final result, it just takes longer to reach there. This is 150,000 epochs.


I'm guessing I'm having serious problems with overfitting. It easily finds a method that works for the first swerve but it can't modify itself without losing that. Maybe I need use a less naive reinforcement method, or maybe I need to add more starts to the data.

Fun seeing how close it loves riding edges though. The reward function is based off distance travelled not distance along the path.
Title: Re: Programming Thread
Post by: Legend on Sep 10, 2021, 11:25 PM
I fixed it. Problem was my input and output generalized poorly. It couldn't learn from one corner and then directly apply that to the next. I wanted it to learn how to interpret the input and output data itself, but that was asking too much for how simple the net is.

All I needed to do was rotate the velocity output to match the car and it loops the track with ease.
Title: Re: Programming Thread
Post by: Legend on Sep 11, 2021, 05:20 AM
Bet yall haven't seen a neural net that looks like this before.

It doesn't do anything impressive but it uses the cellular automata structure I've talked about before. Every node is connected to the 8 or less nodes around it and updated simultaneously, not in series. The green nodes are controlled by sensors and the blue nodes are sampled as output.



The structure allows the AI to have a memory and iterate as part of problem solving. On multiple occasions when I had the reward system wrong, it had the ability to come to a complete stop in the road and then resume "driving." It is not told velocity info. The 5 inputs are 5 ray distances extending forward.

Of course the big negative of this structure is that information has to physically travel and overlap other information. The two green bars on the left have to send information across to the right blue bar which controls steering. I purposely designed the shape of this network to show this isn't a deal breaker, but the green cells can be placed on the bottom and the blue cells can be placed on the top to improve it. A regular neural network is much nicer because all inputs have equal potential within the system. Also the massive massive limitation of this setup is that traditional backpropagation is impossible.

Title: Re: Programming Thread
Post by: the-pi-guy on Oct 15, 2021, 04:21 AM
So I effectively want to:
1.) Preload future scenes
2.) When the next scene is activated, in some instances I want to be able to save the current state, to return to it afterwards.
3.) When the next scene is activated, in other instances I want to be able to simply reload the scene.

For example if you're playing Skyrim, and you go into some basement, rather than simply reloading the main floor, I want to keep into memory, along with other scenes that might possibly show up.


I'm not completely sure the best way to handle it. Some parts, I've been able to find good solutions. Other parts, I'm still not completely sure.
Title: Re: Programming Thread
Post by: Legend on Oct 15, 2021, 05:21 AM
First off, are you sure you need to unload scenes from memory? You can disable every parent component in a scene and just keep things there like ghosts. Solves all your problems unless you can't fit it in ram.


If you need to really unload things but not lose their state, you need to set up a system for adjusting the scene after it activates but before the first update.
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 15, 2021, 02:35 PM
First off, are you sure you need to unload scenes from memory? You can disable every parent component in a scene and just keep things there like ghosts. Solves all your problems unless you can't fit it in ram.
Actually I think this is exactly what I need, thanks.
Title: Re: Programming Thread
Post by: the-pi-guy on Jan 17, 2022, 07:48 PM
It's not really programming related, but I've noticed I tend to be a lot more concerned about software being LTS when I'm working on professional stuff.
Title: Re: Programming Thread
Post by: Legend on Feb 02, 2022, 07:49 AM
I can't download repositories from github  :'(

The download is so slow that it cuts off. Downloading assets hosted on github however just takes a few seconds like normal. Hopefully the problem is on githubs end and goes away on its own...
Title: Re: Programming Thread
Post by: Legend on Feb 02, 2022, 09:13 PM
Still slow but github desktop kinda works if I clone. ::)
Title: Re: Programming Thread
Post by: Legend on Feb 25, 2022, 01:01 AM
Haha that's a new one. The "remember this device" checkbox on a website was labeled as "never challenge me on this device again."
Title: Re: Programming Thread
Post by: Legend on Apr 08, 2022, 06:57 PM
Heck yeah! I made one of my slower dev tool functions exponentially faster!!! Literally just .001% of the time the function would previously take when handling the full dataset.

Spoiler for Hidden:
I forgot I had a few debug error checks running inside it lol.
Title: Re: Programming Thread
Post by: darkknightkryta on May 03, 2022, 01:36 PM
Controller to arcade update:
So I worked my way around the evdev and have my controller being read.  I then started looking into controlling the GPIO pins aaaaaaaaannnnnnd wiringpi has been depreciated.  I've been looking into accessing the registers via LInux's memory mappers.  Fun time.  I still need to figure out how to access the spi interface though.  Luckily I found current sink registers.  I was thinking of using GPIO extenders and switching them from sink to read to register a button press. Hopefully these registers work.
Title: Re: Programming Thread
Post by: Legend on Jul 02, 2022, 10:51 PM
Keep crashing my game. Maybe I need 128 gb of ram for development.
Title: Re: Programming Thread
Post by: the-pi-guy on Jul 13, 2022, 12:11 AM
Suppose you had a turn based game, with the following stipulations:



The turn is decided by the unit's speed:
A unit that it twice as fast would go twice as many times, and similarly the faster units go before the slower ones.

The player is able to see the queue for turns, and the queue must be consistent. So the queue must be calculated a certain distance, and it needs to be recalculated at regular intervals.

Title: Re: Programming Thread
Post by: the-pi-guy on Jul 13, 2022, 01:13 AM
Possible solution 1:
Use the least common multiple, calculate the entire queue up to that multiple. Then for moves you simply have to enqueue, dequeue each time. 

Very good solution for small numbers, but not very scalable. If N and M were numbers like 255, 256 (2 large relatively prime numbers), you would be looking at a queue of 65,280.

Edit
4 possible solutions I've thought up and I finally have one i am happy about.
Title: Re: Programming Thread
Post by: Legend on Jul 13, 2022, 08:06 AM
What solution did you go with? The solution that popped in my head was imagining a line from 0,0 to N,M on a pixelized grid. Two horizontal pixels next to each other represent a turn for the first unit and two vertical pixels represent a turn for the second unit. Could work with non integer speeds and could work with an arbitrary amount of units.
Title: Re: Programming Thread
Post by: the-pi-guy on Jul 13, 2022, 12:06 PM
Thinking about it, I described it ambiguously before.

But basically it'd be like chess, if chess players could go more than once based on their speed so if M and N were 28 and 13, the turns would be calculated as:
28, 28, 13, 28, 28, 13

What solution did you go with?
The idea is that you build up a timeline:

Suppose M and N were m/s, then you could take 1 meter / (M) to get seconds.

You do this for the list of units, you sort them in ascending order.  

A.) The first unit in that list would go first. So you remove that one, and add it to the queue.

B.) Then multiply that time by whatever cycle that unit is on. So you calculate when they would make their k+1 move. You add this back into the list, in the place where it stays ordered.

Then you repeat steps A and B until you have the goal number of lookahead steps.
Title: Re: Programming Thread
Post by: darkknightkryta on Sep 23, 2022, 12:52 AM
So back to my controller to arcade converters.  I managed to find some current sink shift registers, which solves a lot of my issues with hardware for my converter.  Finished up the Linux code for getting controller input, despite the lack of documentation on the controller stuff for evdev (Seriously, I was lucky I found a random post on the internet from someone on the SDL team with a working, useable example).  I managed to get my SPI code working, that I shamelessly took from wiringPi (Rip).  Shiftout worked.  Controller code worked.  I put the two together?  It broke.  Something's up with the way linux or GCC handles loops.  The word I was sending out was getting changed asycrhronously somehow.  So I was investigating multithreading.  Multithreading isn't fun.  I took a chance and copied the word to another variable before the shiftout.  It worked.   (╯°□°)╯︵ ┻━┻
Title: Re: Programming Thread
Post by: Legend on Sep 23, 2022, 03:25 AM
So back to my controller to arcade converters.  I managed to find some current sink shift registers, which solves a lot of my issues with hardware for my converter.  Finished up the Linux code for getting controller input, despite the lack of documentation on the controller stuff for evdev (Seriously, I was lucky I found a random post on the internet from someone on the SDL team with a working, useable example).  I managed to get my SPI code working, that I shamelessly took from wiringPi (Rip).  Shiftout worked.  Controller code worked.  I put the two together?  It broke.  Something's up with the way linux or GCC handles loops.  The word I was sending out was getting changed asycrhronously somehow.  So I was investigating multithreading.  Multithreading isn't fun.  I took a chance and copied the word to another variable before the shiftout.  It worked.   (╯°□°)╯︵ ┻━┻
Gotta love when there's something fundamental that just doesn't make sense.

A couple days ago I had shader code that was producing impossible errors. Eventually I found out the text itself had an invisible character that was breaking things. Don't know how Unity let that slide vs warning me.
Title: Re: Programming Thread
Post by: the-pi-guy on Oct 17, 2022, 02:11 PM


Quote
Someone improved my code by 40,832,277,770%
This is hilarious.

His code took over 30 days, someone else got it down under 10 milliseconds.