Advertisement Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

PC Camera and platform Update




It's been a while. I was busy again with other stuff but I managed to work on the game engine (less on the game itself) during this time. The new features are not visible for most of them, it is more about code optimization and organization. But now we have a better 2D camera system that I will present right now.

The first nice thing is how to use the camera. I just need to initialize, choose among some functions and call the camera update function it in the game loop.

void bkp_graphics_2DinitCamera(BKP_Rect dim, BKP_Rect world,int camera_function); //Initialize
int bkp_graphics_camera2D(BKP_Dynamics2D P); 							//Call in main loop to follow the scene

void bkp_graphics_2DsetCameraDim(BKP_Rect dim); 			//obsolete
void bkp_graphics_2DsetCameraWorld( BKP_Rect world);		//world limits (up,left,down,right)
void bkp_graphics_2DsetCameraAuto(float auto_speed);		//obsolete use camera2DsetFunc() instead                   
void bkp_graphics_2DsetCameraSpeed(BKP_Vec2 speed);         //set a speed other than default
void bkp_graphics_2DsetCameraPanic(float up, float down);   //set the panic lines for vertical scroll IMPORTANT

void bkp_graphics_2DtoggleCamera(void);                   //Freeze the camera to the current position or unfreeze

void bkp_graphics_camera2DsetFunc(int function);			//select a camera function 

Basically, there are only 2 mandatory functions, others are used to change the default values for the camera function, focus or speed. There are more than listed here. Yes, it is possible to change the camera function during the game. Here is an example of how to use it:

BKP_Rect world = setMapPlatform(); 

bkp_graphics_2DinitCamera(bkp_rect(g_scr.w / 4, g_scr.h * 2 / 5, 0.0f, 0.0f), world, BKP_CAMERAFUNC_SMOOTHSTD);

while(Player->input->Cancel == 0)                                                                                                                                                                                                                                            


        _update_fps_counter( fps); //print on the screen FPS and Memory usage


1/get the world dimension from the level layout.

2/ select smoothstd function for scrolling
3/set the up panic at 150 pixels under the top of the screen and 50 over the bottom of the screen
4/we change the current function to FOCUS to tell the camera to scroll to the target instead of just show the player in the centre (look at the beginning of the 2nd video to see the scrolling animation to find the player). The camera will switch  automatically to the function passed in 2DinitCamera as soon as the target is locked.
By using BKP_CAMERAFUNC_FIXEDSETFOCUS,  we will set the camera without scrolling the prior animation to find the player.

I organized the code in the way that it is easy to add a new camera function without modification in the game loop. let's have a look. Actually the bkp_graphics_camera2D() is that simple:

int bkp_graphics_camera2D(BKP_Dynamics2D P)                                                                                                                                                                                                                                    
    int ret = camera2D(&stc_2D->camera, P);
    if(BKP_TRUE == ret)
        bkp_graphics_2DTranslateView(stc_2D->camera.speed); // manual
    return ret;

int camera2D(BKP_Camera * S, BKP_Dynamics2D P)
    if(S->on == BKP_FALSE)				//set or unset by toggle()
        return BKP_FALSE;

    return TBL_Camera[S->func](S, P);   //all functions are in this table

Notice that I pass a BKP_Dynamics2D structure to the camera instead of anything else not general, all objects I want to get focused by the camera should have a BKP_Dynamics2D structure. That's it, Player, NPC, or whatever object so far has that. it is a simple structure with position, dimension, ...

So, next time I want to add a new camera I just have to create the function and set a new entry in the enum of camera functions et voila, nothing to change, just add.

LOCKON camera



 It is just a basic camera where the player is centred everytime it is possible. For horizontal movements it is ok but when it comes to jumps it starts to hurt our eyes. I did it at the beginning just to be able to test the collisions and travel around the map.  This camera function is not really usable to play a platform game. 


STDsmooth camera


This function solves the problem with vertical scrolling and smoothly scroll. when changing the direction we can notice the camera scroll to give us some room in the direction the player is facing. On vertical movement, the Camera scrolls only the player is on a platform or if he is going to high (on the video the orange line)


here let see the differences between the two functions on vertical movements.(sorry for the gif, gimp decided to annoy me) . You can see on the left gif the player jumping without the camera moving while on the right gif it moves everytime the player move up


The lockon camera is used in Soul of Mask, but I keep it here because this is the choice I made for autoscrolling. I made a function auto scroll before which is obsolete (or not, maybe I will delete it maybe not) and replace by the Lockon camera. I just ask the camera to follow a target different than the player. Here on this video, you will see a green square moving around. The camera will use this green scare as a target, that's it I have an auto scroll now:


Coming up next:

 I will stop the game engine and go back to the game development again, the next time we should have the first image of the game.

Thanks for reading. Any technical questions ? don't hesitate. I decided to release the engine part on Github and only keep the game part proprietary.







Recommended Comments

Welcome back, looking forward to seeing more progress on your game. :) 

Share this comment

Link to comment

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
  • Advertisement
  • Advertisement
  • What is your GameDev Story?

    In 2019 we are celebrating 20 years of! Share your GameDev Story with us.

    (You must login to your account.)

  • Blog Entries

  • Similar Content

    • By Jami Cassidy
      Hi everyone! I just released the Free Demo for my first real game, Choices!

      You can download it, here -

      I hope you like it! Any feedback is appreciated and welcome. Enjoy!
    • By I3DI
      I have spent many hours dedicated to advanced blending, shading, modeling and texture art for a game concept that will requires stages.  Think of this in the context of the sims, but far more advanced.  I need someone with a server that can host the Unreal server.  The plant life, very advanced.  The terrain textures very advanced and using blending, GIS, varying liquid textures I am building the foundation for a economic sim first.  The idea initially will be to build businesses in cities and have a character you can customize with basic animations.  Later down the road once world economies are in motion, we will add simulations, politics, governments, and finally combat simulations.  The idea is you can assume any role you would in life, build a life in modern civilization, all connected world wide.  Initially it's very basic, businesses and economies with a customizable male or female character, house or business building.
      My company has secured a contract that generates about 120,000.00 USD a year, and those willing to vest in this project will ultimately be paid.  Where is the money?  Well, the idea is to take subscriptions initially but then, money is deposited by players to build their virtual life, career, and each nation will have a government that builds on taxation.  I will add stock markets, housing markets, medical markets, technology markets and resource markets.  The beauty is, since players invest real cash, they can make real cash thru inventions, politics, banking, travel, whatever they set up in the virtual world.  Simply working a job for another players business that pays.  As the economy grows and more players are added, then they supply cash to begin their lives in our virtual world and the ones that make money can simply withdraw into their real world bank accounts.  We simply make our money off fees in transactions that occur in our virtual world.
      So to be clear, this is a beginning try out with stages of development.  I will be doing a early release and as players are added, money is invested, this will fund further development.  
      Stage 1:
      Government, Business and World Setup.  I have completed all texture art necessary to generate a complete earth in very vivid detail.  I am making preset buildings.  But I require assistance in the development of a in game GIS terrain generator.  I will also need help finding a database of cities and their building and maps so we can procedurally generate the cities.  I have iClone and could use another person to help me develop the basic animations for people.  I would like to make a building designer in game, setup zoned properties, making clothing, furniture, and get the economic part of the game setup.
      I am seeking someone with a server that can run 24/7, a Unreal game server.  I am seeking one or two artists that can help speed up the basic modeling process for many models.  I personally will deal with the terrain, city and various programming aspects.  I already have done all the architectural textures, detail and base, PBR.  I am doing models, like furniture, fountains, but being able to shift this work to several artists that are consistent would be of real help so I can focus on the programming aspect of this first stage.  I also have a merchant processor so I can run the credit cards and accounts thru them.  If you are willing to vest in this one project, one piece at a time, then I can guarantee once you are proven and consistent, there will be pay.  There are several other stages to building this advanced simulation but this first stage is the simplest and will at least begin a very lucrative money income for the company.
      A additional programmer would be of real help that is familiar with C++, Unreal, Blueprints, Materials, GitHub is hard working consistent, and wants to get their foot in the door in game development.
      Seeking two artists, 2D knowledgeable in Adobe 
      Seeking two artists 3D knowledgeable in Substance, Adobe, Blender, iClone is a bonus
      Seeking one individual with a 24/7 server for Beta Testing at no cost.
      Tools and accounts are setup and paid for by me.
    • By Alladin
      Got an amount of inspiration and made this game. It's humoristic and satiric, so don't take it too seriously)
      Here you play as a priest and your main task is catching the kids. Steam store page:
      Gameplay trailer:
      If you have any suggestions, advice or something else, write here)
    • By ProjectTaival
      Something about me and my vision for the project:

      I have been interested at making games since I was a teenager, but never had the courage to even try, due to my personal issues I have encountered in life. But that has changed recently, as during the years of recovery I have gained more confidence in my ability to learn new things and have had extensive experience in Google Sketchup, as the picture above shows. After reading how it can be used in conjunction with Unreal Engine and Unity 3D, I decided to give it a try, no matter how hard it could turn out to be. This project is an attempt to have a new beginning and thus a very important step forward in my life, which makes it all the more important for it to be a success. I'm not seeking triple A quality and try to keep my goals achievable, but at the same time want to try my utmost to bring my vision to life without sacrificing too much visual fidelity.

      Hideo Kojima and the Metal Gear -series has also been a huge inspiration to me and I think that at least one aspect of Hideo's advice can be used in the Project Taival as well - "Betray your audience". I want to make this game in both story and mechanic wise, to be as unpredictable as possible.

      I started up as an Indie Game Developer in December 14th, 2018. I have always loved to be able to think freely - no matter how silly some idea might sound at first, I just have to entertain the idea to see if I can find some non-obvious creative value in it. Innovative ideas need analytic thinking, which have helped me tremendously on anything that requires creativity, like creating 3D models to plan out carpentry solutions as a carpenter.

      To summarize some features of the game, here is a short list of things;

      - The game will be in First Person perspective.
      - It is going to be divided in multiple games, so be sure to expect a sequel.
      - All the final assets are going to be original content or modified from free assets.
      - Paid assets remains a possibility, depending on the amount of donations and pre-orders.
      - The game is based on modern days, but the roots of the story are much deeper in time.
      - 2 layer game world, similar to Silent Hill, but different.

      My personal goals for this project are;
      • Get better at 3D modeling on more various selection of modeling software.
      • Learn to make presentable music.
      • Study on how to make animated videos from scratch.
      • Get to know some basics about several game engines, before choosing the one that I will use.
      • To improve my storytelling and compilation skills.
      • Bringing to fruition a marketable end result and registering a Game Development company.

      For all the latest information, you can subscribe to these social media sites;

      The best kind of free help you can give me, is advice and constructive criticism. I'm always ready to learn more on how to market my creations and first and foremost develop them in the first place.
      Second best and free kind of help you can give me, is to spread the word anywhere.

      Thank you for time.

    • By Ozden79
      Hello Everyone,

      Clan N is a beatemup game which combines the classic arcades gameplay with today's modern brawlers. With an ancient far east theme, you'll get challenged across 7 different levels with many different enemies, mid/end level bosses and casual mini games integrated into main gameplay.

      A fast paced beatemup which combines the classic arcades gameplay with today's modern brawlers. A main story with 7 levels divided into more than 50 sections. Levels contain casual minigames which are tightly integrated into the main story and can be played separately as well. Can be played as local or online coop with up to 4 players. A slick and clean pixel based graphics with accompanying far east inspired music and sfx. ScreenShots




      More information
      WebSite :
      Reveal Trailer :
      Steam :
      Let me know any questions you may have and happy gaming!

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!