Jump to content

  • Log In with Google      Sign In   
  • Create Account


zeidrich

Member Since 03 Oct 2012
Offline Last Active Oct 03 2012 03:28 PM
-----

#4986547 Communicating with Programmers

Posted by zeidrich on 03 October 2012 - 03:29 PM

One thing that is important is, if you want a programmer to do something, make sure it is something that's possible. Think it through to the end.

I worked on a project once on a system for a boarding house where beds were assigned to patients. Sometimes patients would check in before other patients would check out, and they would be assigned the same room. The customer wanted to have a report which would show all of the patients in the rooms. They wanted it to show the patient that was already checked in to the room some times, and in others they wanted to know the patients that were newly checked into the room at other times. They didn't want to see both names at once, and they couldn't provide me with a reasonable explanation of when they would want to see which. They just wanted the computer to mystically understand what their intention is when they went to open that report. They didn't want additional options or controls or reporting options because that was too complicated.

In the end I wasn't able to implement it as they wanted because what they wanted was only half-conceived, the rest was just magic. They needed to either compromise on the amount of information they were willing to put in to the system, or in the amount of information they were willing to be served by the system, but they couldn't expect the system to magically determine what was in their mind.


#4986540 Taking resolution into considreation.. pc 2d games in c++.

Posted by zeidrich on 03 October 2012 - 03:05 PM

c++ doesn't do graphics. It depends on what libraries or whatnot you use to do your graphics.

When you change your resolution, generally some kind of event is triggered carrying information about the new resolution. You then respond to that event by changing your layout to appropriately deal with the change. Do you show more? Do you scale up? Do you do neither and paint it on top of a background?

A good way to deal with variable resolutions might be to use relative screen space coordinates instead of absolute pixel coordinates. For instance, x=0 would be the leftmost side of the window, x=0.5 would be the middle, and x=1 would be the rightmost edge. This would make your image always fill the screen, but as the above poster mentioned, you'd have distortion when the aspect ratio changed. You could then worry about detecting and correcting that distortion.

But in all, exactly how you do it is really dependent on what tools you are using to get anything to show up on the screen at all.


#4986471 Game Engine from scratch using C++ and python - Where do I start?

Posted by zeidrich on 03 October 2012 - 12:02 PM

An engine is 3 parts. See http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller

You have the model, which keeps track of the state of the game that you're making. This is going to be where you would manage things like your physics and AI.
You have the view, which is the component that takes what information is stored and generated in the model and displays it for the user. This would be things like your renderer and sound system.
You have the controller, which is where you're going to be taking inputs from the player, and deciding how you're going to manipulate the model based on those inputs, or how the view describes the model.

Generally, you have a main loop. This loop repeats until the game is ended. What happens in the loop is you capture inputs from keys, you perform any ongoing calculations based on the state of the game and the inputs recieved, and you update the view to reflect the current state of the game.

An map of it might look like this

Main Loop:
HandleKeypress Function
DoPhysics (affected objects fall based on time elapsed since last call)
MoveCharacter (based on keypresses recorded maybe? Check for collisions? Whatever.)
RenderScene
Repeat

The tricky part honestly comes down to doing those things efficiently. If you want to run at even just 30 frames per second, you have to spend no more than 33ms on calculations between frames. When you want to work with voxels, you have a large amount of data, so you need to find ways to work on that efficiently, when you want to work physics into it, then you have a large amount of points interacting with a large amount of points, which gets even harder.

If you want to start, find out how to make a 3d scene that accepts inputs. Use OpenGL or DirectX. Just getting stuff on the screen is a challenge if you've never done it before. Then come up with a way to represent your data, put that data on the screen, come up with a way to handle user input, use that input to change the data or move the camera. Finally, find a way to do it quickly enough to be acceptable, and eventually write it to (and read it from) permanent storage if you want to be able to save games.


PARTNERS