Sign in to follow this  
Adrisim

2D art related topic.

Recommended Posts

Hello, everyone. Here is a new beginner for all of you.

 

Well. Lets put this straight. 

I'm currently researching on how videogames are done. For that matter, I still don't understand how 2D/3D art, characters and such things are implemented in games. Is it part of the Engine features? Or is everything programmable? I really am confused on this. 

 

Mi idea is as follows: The programmer works with 2D/3D graphics libraries on his chosen language and use it to import art from 3Ds Max, Maya or so, on the main code for being manageable from there. That means, pressing any button move character from A to Z, while its animation is taking place. Okay, lets be clearer. The user presses any button, then the code runs that character's animation for start moving from A and then walking while the button is till pressed on, to finally run the animation for stopping when arriving at the giving Z point. 

 

Is this how it really works?.

Who does this?

How can it be done?

Is it too hard?

What does it take to accomplish such task? 

 

And then, how programmers make all that to happen on a 3D/2D full environments will complex scenes and NPL character all over the place, plus, collision detection systems and on and on. 

I really still don't get how all this is accomplished. 

Any feedback will be appreciated. 

Share this post


Link to post
Share on other sites
Is this how it really works?.
Almost.
 
Who does this?
Programmers.
 
How can it be done?
By learning how to program code.
 
Is it too hard?
Yes and no. Sometimes it's very easy, other times it's challenging... but that kind of challenge can be really enjoyable (or can be exceptionally frustrating).
 
What does it take to accomplish such task?
Learning to program is a lifetime thing, continually expanding and growing in knowledge and skill. but you can learn the basics solidly within about 3 years. Quicker if you make it a full-time focus (40+ hours a week).
 
By breaking everything into smaller pieces, large challenges can be overcome by tying small simple pieces of code together to build a larger complex system.
 
(I'm running out the door as I type this, so I'll give a more descriptive response tomorrow unless someone beats me to it - which I hope they generously do smile.png) Edited by Servant of the Lord

Share this post


Link to post
Share on other sites
 By breaking everything into smaller pieces, large challenges can be overcome by tying small simple pieces of code together to build a larger complex system.
 
(I'm running out the door as I type this, so I'll give a more descriptive response tomorrow unless someone beats me to it - which I hope they generously do smile.png)

 

I'm learning C (and I will be for the next half year or so. Until there is no chance I can screw code), and the next step is C++ or C# (I'm not sure yet). I hope for a more descriptive response. 

Thank you. 

Share this post


Link to post
Share on other sites

Well if your looking for a really code specific answer to your question, here's some pseudo code.

Image puppypicture = loadimage("src/images/cutepictureofpuppy.jpg"); //load your image
int characterX = 200;
int characterY = 200;

void keyeventhandler(keyevent e)
{
if(e.keypresses = keys.leftarrowkey)
{
characterX = characterX - 2; //move two pixels to the left
}
}

void drawstuff(Graphics g)
{
g.drawImage(puppypicture, characterX, characterY);
}


Ok, that code looks a lot more like java than pseudo but I hope this answers your question about key movements. This example pretty much moves a picture of a puppy when you presss the left arrow key.

Once you get the hang of programming and you understand event handling this will make more sense. Games are essentially all about taking input and sending visual output.

When developing a game, you as the programmer are just taking the artists images and 3D models and making them come alive, everything in a game gets done in code.

 

Edited by minibutmany

Share this post


Link to post
Share on other sites

Video games work by breaking time down into little tiny discrete chunks. At the heart of it is a game loop whose job is to execute over and over until the game closes, performing these little chunks of time execution, gathering input from the player(s) and handing it off to interested parties, and drawing the view.

 

Each time a chunk of time is executed, the game will iterate through all objects and do a few things:

 

Move any objects that are moving. If the time step is 1/60th of a second, and an object moves at a speed of 3 meters/second, then in one time step the game will move that object 1/20th of a meter (1/60 * 3).

 

Advance animations. Animations typically have a set of keyframes which are interpolated to get the final pose, and the whole animation is given a duration. So if a Walk animation is 3 seconds long, then a time step of 1/60 will advance it for 1/20th of its duration.

 

Make decisions. If a character is walking toward (GoalX, GoalY), and has reached its goal in the last movement step, then it's time to decide on a new goal. Maybe an alarm was raised, and an alarm signal was sent to the character, so now the character AI will calculate a new movement goal that will take it nearer to the source of the alarm signal. Or maybe the character is hungry, so it will find a goal that brings it nearer to food. The character might even be in the middle of accomplishing a goal, when the AI overrides the current goal with a new one based on some priority decision. This is the Think() step, and here lives all sorts of goodness and complexity.

 

Advance timers. Many tasks in a game need to track timing. Say you have a frag grenade that explodes 5 seconds after activation. The grenade would maintain a timer, decrementing it each step by 1/60 until it hits 0, at which point it knows to explode.

 

Housekeeping. Cleaning up objects marked for termination, running processing tasks to account for updated objects, marking objects dirty so their transformations will update during the draw cycle, etc...

 

 

All of this is done in a step every time through the update loop. It sounds like a lot (and it is a lot) but computers are pretty fast. If you do find there to be just too much to do in an update step, then you can implement a staggered approach where objects are processed every Nth timestep, instead of every timestep, breaking up objects into batches to be updated in their turn. That way, you only update a set number of objects each update. However, this can have repercussions on the responsiveness of some objects.

 

As Servant of the Lord said, you just have to figure out how to take large tasks (representing and updating a huge world full of thousands of objects) and break it down into lots of smaller, easily achievable individual tasks (increment an animation, moving an object).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this