can any one tell me?????????????

Dani AI

Generated

Making a game in C++ is best treated as a small engineering project: pick one concrete mechanic, prove it with a minimal prototype, then expand. ’s high-level loop (plan, pseudocode, implement, test, repeat) is the right mindset, and was right to press for a specific target — being vague about “a game” invites scope creep. ’s reminder that both learning C++ and learning a game API are large tasks is important: separate language learning from engine/library choices while prototyping.

A practical path that stays focused:

  • Define a single playable loop (MVP) — e.g., “move a player and detect collisions.”
  • Prototype that logic in the simplest form (console or small graphical stub) so the mechanic works without worrying about assets or polish.
  • Add a basic architecture: a main game loop, an input layer, an update step (use a delta time), a render step, and a small state machine for menus/playing/paused.
  • Introduce libraries only when needed (graphics, audio, networking). As found when porting SDL→SFML, switching tech later teaches portability tradeoffs but costs time—plan for that.

A tiny, practical skeleton (fixed minimal structure):

#include <chrono>
#include <thread>

int main() {
    bool running = true;
    using clock = std::chrono::steady_clock;
    auto last = clock::now();

    while (running) {
        auto now = clock::now();
        float dt = std::chrono::duration<float>(now - last).count();
        last = now;

        // input
        // update(gameState, dt)
        // render
        std::this_thread::sleep_for(std::chrono::milliseconds(5));
    }
    return 0;
}

Common pitfalls and tips: avoid mixing game logic with direct rendering, prefer RAII and smart pointers over raw pointers, keep frame-rate independence (use dt or a fixed-step update), use source control and small incremental goals, and finish a tiny playable version before adding features. Finishing a simple game teaches far more than planning a large one.

Recommended Answers

All 5 Replies

Step 1: Write a problem statement for what you want to do
Step 2: Write an outline, if it is complex
Step 3: Write up a section in pseudo-code (English instructions)
Step 4: Write the section in the programing language of your choice
Step 5: Compile the program.
Step 6: Run your program and see if it makes the computer do what you wanted.
Step 7: If not, fix the program, and compile and go back to step 5. Otherwiae release / turn in your program.

  1. Learn to write code in C++ (not a trivial exercise).
  2. Learn some C++ game API's that will make your work easier (not a trivial exercise either).
  3. Design and model your game (what, where, how).
  4. Implement it in the API of choice.

FWIW, NathanOliver's post was spot on.

How far your game goes depends alot on the operating system, SDK and programming language. For instance, I ported an SDL tutorial based on Tic-tac-toe over to SFML and felt that further improvements can be made if SFML can simplify networking API (2 player mode) and/or Image class that supports copy-on-write memory management.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.