ASCII Game Engine

Apr 14, 2015 at 10:44pm
I have an issue with a game I am creating. I have created a doublebuffer system using the CHAR_INFO buffer, and it works perfectly. I have also created its own image file to use. Now, I am having trouble creating a camera. I am trying to create a system that uses the blocks widths and heights to get the coordinates of the upper left hand corner and lower right hand corner (in blocks, not entity coordinates) to use. I am having trouble converting entity coordinates (the input to the camera structure) to get smooth movement. Any help?
Apr 14, 2015 at 10:46pm
Apr 14, 2015 at 10:48pm
I am actually using something that works similar to ncurses, and I am doing it as a school project, and my teacher told me to make it in the console. Also, i wanted to try console based games, as i have made a a bunch of sfml based ones.
Last edited on Apr 14, 2015 at 10:49pm
Apr 14, 2015 at 10:58pm
Ok, imagine just trying to draw images then, because in this case they are treated somewhat the same, im just trying to find a way to get the camera to follow player.x and player.y.
Apr 14, 2015 at 11:16pm
Another way of putting it, I have ascii images styled to look like actual images, and draw them using output.draw(x,y,image), which draws the contents of the image class to the screen, how exactly would i take player.x, player.y,VIEW_WIDTH, VIEW_HEIGHT, and BLOCK_WIDTH, BLOCK_HEIGHT,
The player is 4 pixels by 8 pixels, and the blocks are 4x4, please help.
Apr 15, 2015 at 12:12am
It is done the same was as in SFML. You say you have experience making games with SFML, right? You should know how a camera works. Subtract the camera coordinates from everything.
Apr 15, 2015 at 12:20am
I use the SF::camera class in sfml, and also, the main issue I'm having with that method is mainly
I am not using sfml, I need to transform player coordinates to block.coordinates, and using this method also causes issues by the camera loading new areas by block, making it choppy, I
Apr 15, 2015 at 12:35am
With the console you cannot get more precise than increments of one character. There's no 'draw a character 2 pixels to the left' - you're out of luck.
Apr 15, 2015 at 12:44am
Well, I'm saying, using a method, I created a put pixel function using a method of double buffering for a windows console, I created an image class that uses a series of chars and colors in a vertex that can be loaded fron a file, what I am trying to do now, create a camera class, for a game, that uses a map class with ids, and that image goes to a vertex of images which can be accessed via ids, I am trying to make something which uses the working draw function for anything within the view centered on player.x and player.y
Apr 15, 2015 at 12:45am
The console.draw function I made works, everything for the basis of the graphics works, but now, I need to use that previously method to create a game, but the camera on that game isn't working
Apr 15, 2015 at 12:50am
As I already said, you subtract the camera's position from everything else's position.
Apr 15, 2015 at 12:55am
OK, let me put this differently, the system I use has player
X and player.y which is different from block coordinates. A block
sis 4x4 charecters, and the blocks coordinates are by block, as player coordinates are per.pixel, meaning every block.has 4 player coordinates inside them. When I subtract the camera position, it works, by its choppy, because the blocks update every time the player steps 4 times.
Apr 15, 2015 at 1:10am
You can multiply or divide the offset by to give the correct effect. Remember: round at the last second you can.

This is really more of a math question than a programming question. I am having a hard time visualizing what your game looks like so I am having a hard time giving you a specific answer.
Apr 15, 2015 at 2:21am
Take it as a tile map game, and that's what I was talking about, I need to offset it by the remainder of the division of the players position and the block width or height to get the window position. Ohhh, you helped me break it down, thank you,
Topic archived. No new replies allowed.