last day (16 days later) » 

1:38 AM
hello
 
hi, thanks again
 
so
what problem do you have with boolean logic
do you mean that
you don't know what to do if the player is jumping while moving right for example ?
 
yes, that exactly
 
ok let me break it down for you
even though it should be simple
to do that
you understand what is velocity right ?
its just a vector2(x,y) , so for example
gravity could be (0,10)
 
yes, I understand that
 
1:42 AM
so every frame you would apply player.Y += gravity.Y
and player.X += gravity.X
ok so far ?
 
yeah, got it
 
so for the walls
the logic would be something like
if(player was moving right) { 1. }
else { 2 }

if(player was moving up) { 3}
else { 4 }
i use if else because he wont be moving left and right at the same time
now, how would you calculate the logical condition "player was moving right"
you would calculate the player's velocity
 
and set it to negative until not coliding?
 
at the beginning of your update()
your player would have a position, lets call it A
at the end of your update, that position would change
you would add += Gravity
you would add another velocity from the keyboard input (maybe)
and in the end the player should go to a position B
(that B position is before we check for wall/ground collsiions)
so the velocity we need is the vector2 B - A
so lets say our vector was (10,2) what does that mean
it means that our player is going down and right
{ 4 } is called
and { 1 } is called
because the condition "player was moving right " is true since 10 is greater than 0
 
what does "{ 4 }" and "{ 1 }" mean?
 
1:50 AM
its from the code above
after 4 and 1 is called
the player should be taken out of the wall/ground
we havent implemented that yet
do you get what i am saying so far ?
if(player was moving right) { 1. }
else { 2 }

if(player was moving up) { 3}
else { 4 }
this code, helps the player not be drawn inside the wall/ground
 
so it checks if playerX - wallX = 1
 
i showed you how we calculate the logical condition
"player was moving right"
and "player was moving up"
now i am about to show you how we calculate 1,2,3,4
what does "if playerX - wallX = 1" this mean ?
 
I'm a bit confused what those numbers are
 
those numbers are nothing
its the code that should be called
 
oh, i see
 
1:54 AM
i said that "player was moving right" logical condition would be checked by checking if
the X value of the vector2 B - A is greater than 0
 
okay
 
"player was moving up" would be checked
if the Y value of the vector2 B - A is less than 0
1 <-- is the code that should be called if the "player was moving right" condition is true
so 1 would be player.X = wall.Left - player.Width
2 would be player.X = wall.Right
 
i get it
 
3 would be player.Y = wall.Bottom
4 would be player.Y = wall.Bottom - player.Height
hold on
 
okay
Jotting down some notes
 
1:59 AM
im writting this for you
 
so we have

Vector A; // velocity before

//apply gravity
//apply movement from input
//apply any other physics

Vector B; // velocity after

Vector2 vel = B - A;

//Terrain collision check
if(vel.X > 0) { wall.Left - player.Width }
else { player.X = wall.Right }

if(vel.Y > 0) { player.Y = wall.Bottom }
else { player.Y = wall.Bottom - player.Height }
I have a mistake in the code
if(vel.X > 0) { wall.Left - player.Width } is supposed to be if(vel.X > 0) { player.X = wall.Left - player.Width }
 
okay, can I get an example what B would be?
 
actually
one more thing wrong
the terrain collisiton check
so basically the last 5 lines
hold on
i ll repost the code
and i will explain
 
got it
 
2:05 AM
Vector A; // velocity before

//apply gravity
//apply movement from input
//apply any other physics

Vector B; // velocity after

Vector2 vel = B - A;

//Terrain collision check
if(vel.X > 0) { player.X = wall.Left - player.Width }
if(vel.X < 0) { player.X = wall.Right }
if(vel.Y > 0) { player.Y = wall.Bottom }
if(vel.Y < 0) { player.Y = wall.Bottom - player.Height }
A is the POSITION at the begining of the Update
not the velocity before
B is the position after gravity/input/etc are applied
let me post the code one more time fixing that
 
ok. this makes much more sense
 
so we have

Vector A; // position of the player at the beggining of the frame

//apply gravity
//apply movement from input
//apply any other physics

Vector B; // position of the player after gravity / input / etc is applied

Vector2 vel = B - A;

//Terrain collision check
if(vel.X > 0) { player.X = wall.Left - player.Width }
else if(vel.X < 0) { player.X = wall.Right }
if(vel.Y > 0) { player.Y = wall.Bottom }
else if(vel.Y < 0) { player.Y = wall.Bottom - player.Height }
awesome
are you programming with just openjl and java ?
openGL *
 
yeah, currently
I use some other libraries for images
 
you are doing this for education or to make an actual game ?
 
Both. I plan on combining things I learn for little games
 
2:10 AM
if you want to make a game with java
you should do it with libgdx
so that you can export for multi platform
Windows, Mac, Linux, Android, iOS, BlackBerry and HTML5
since you are making a 2D game
there are not much you need for graphics etc
you just need a Draw(image,position,rotation,size,.....) function
 
I wanted to use OpenGL so I could understand it for the future. In case I'm looking for a job or something
 
openGL is made for 3D
there is not much to learn from OpenGL if you make a 2D game
from the graphics side
 
didn't think about that much
it seems libgdx has shaders and all
 
it has a ton of stuff but for a 2D game
you could implement things yourself
like particle engines etc
to learn programming
there isn't much to learn from 2D games on the graphics side of things
its all math and physics
and on the 3D case
opengl is ridiculously low level
so making a 3d game with just opengl would take forever
real companies use game engines
the biggest companies have made their engines themselves
 
with opengl?
 
2:19 AM
with anything they chose
not everything is made with opengl
 
directX too? for windows
 
hearthstone uses unity for example unity3d.com
thats one of them
why does every game engine needs to be using directX or opengl ?
 
I guess I've felt that professional developers use low level graphics for thier needs
their*
 
they do
only the super triple A games though
simpler games use easier game engines
unreal engine , unity, libgdx, webgl etc
 
What about being part of a triple A game in the future. Isn't it better to understand these things now?
 
2:23 AM
i think
you still have 10+ years to go for triple A games
if you are asking for to handle wall collisions right now
hehe
 
heh, I'm only a freshmen in highschool so I don't get a lot of the math sometimes
 
the only math you needed for this is addition and substraction
you are better off learning how to program
first learn how to program, i mean
 
I've been programming for about a year now. Pretty much games, websites, and learning computer science
 
im in my 4th year in univercity
you do all that while you are in high school ? thats pretty impresive
 
Yeah, thanks. I lose most of my social life, but I enjoy this (mostly)
 
2:28 AM
usually people have a programming job
and keep game development as a hobby on the side
just saying
because wanting to work to a triple A game title
is probably not as cool as you expect
 
Makes sense. I don't even want to spend all my time on games.
 
and probably not easy to get highered at a decent job
and also
you probably have higher change to make money
by making a douzen 2D games from free images you find
while having a real programming job
anyway, good luck with your game though
 
Wow, I wish I had someone older guiding me when I started. Probably wouldn't have wasted so much time
well, advice atleast
 
where you feel you wasted time on ?
cause opengl and java is fine
 
Trying to learn and program games allmost all day
 
2:33 AM
right now
especially for games
i would say the easiest thing to get into is unity3d with C#
the downside is that
it requires too little coding
it is more of a professional tool to make games
if you chose to learn unity, you will need to do more stuff if you are trying to learn programming
 
I might do unity for 3d only so I don't get lazy
 
unity can be used for 2d as well
in my opinion, it is one of the best game engines right now
by far
and C# is also one of the most powerful languages at the moment
that is easy to learn
java is too
C# and java are very very simillar
 
I heard C# is an improved java
 
the last 2 years ive been coding only in C#
C# syntax is one of the best
downside is, performance is not that great
 
and it requires .net . I'm running linux
 
2:38 AM
yea well 98% of the computers run windows
which is a microsoft's product
so is C#
so it would only make sense to require .net
 
I can use C# with monogame on Linux, right?
 
ive been writting in monogame for a long time actually
yes you can
but i never tried it, because i dont use linux
there is no point
 
Safer?
 
every program requires windows anyways, it just seems masochistic to have linux as a daily OS
what is the benefit
monogame is a very very good way to learn how to program in C#
 
Safety in commands. It can run faster, and it's open source
 
2:41 AM
well it doesn't run 90% of the software out there
so thats kind of a problem, hehe
 
I actually started with c# + XNA, but jumped into game dev way too early and began learning java
 
thats the best way to learn how to code imo
thats what i did for 5 months
then i started learning unity
 
How was the learning curve for unity?
 
um unity has a bazillion features that i have never used
i only search and find what i need for the game i make at the time
but it definately has a hard learning curve absolutely
because it is a game tool
you need to watch tutorials for it
otherwise you can't guess how to work with it
i picked up unity
about a month ago
 
Programmers I knew looked down on it and used opengl so I thought that was the right way to go.
 
2:45 AM
its by far the best fastest game engine i have seen
 
how fast can you develop now? :o
 
there are ton of games made in unity
the most famous is hearthstone
you mean me ? how fast i develop games ?
 
yeah, now that you picked it up
 
i only know the complete basics of how things work
and the game i picked to make
is a puzzle game that is super easy to implement
so i guess i am a bad example to answer that question
 
Not really, you did help me with collision I couldn't understand
 
2:48 AM
i am more interested in the coding part
how easy or hard it is to implement a game with unity
depends on what game you make
what are you making ?
 
A platformer and trying to make a basic operating system after
 
platformer is easy to do with unity
in general unity is super easy with "what you see is what you play" games
 
Too easy at times?
 
i wouldn't know
because i only have done a simple 2D mahjong game so far
 
well, i ahev to go now
have*
thanks for the help. really appreciate it
 
2:56 AM
good luck
 
you too
 
no problem
 
 
8 hours later…
10:51 AM
is this chat gone?...
 
 
9 hours later…
7:57 PM
hey, you there?
or did you leave?
 

  last day (16 days later) »