Thread: Game Engine

  1. #1
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459

    Game Engine

    Hello,

    I've asked a few game related questions lately - thanks for the input. I've decided to make a simple 2D engine (as a library) and use it with my map editor, client and possibly the dedicated server.

    It will wrap SDL for most things, but I've got a few questions

    I was thinking of providing my own screen coordinate system (in dependent of the screen resolution) what's the best way to go around that? It means I won't have to change anything client wise if I change from SDL to openGL for example.

    I was thinking maybe 10,000 units in each direction which is scaled to the current resolution or is there a better way? Such as the attachment.

    I was thinking of structuring the engine something like:
    * video (openGL)
    * map
    * tile manager
    * font (uses video manager)
    * image loader (uses video)
    * input manager etc
    * network

    Each little manager has to be init'd/deinit'd, for the video manager I was thinking of just typedef'ing SDL_Surfaces for now... All sound good?

    Thanks
    Last edited by zacs7; 10-14-2007 at 04:26 AM.

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    I was thinking of providing my own screen coordinate system (in dependent of the screen resolution) what's the best way to go around that? It means I won't have to change anything client wise if I change from SDL to openGL for example.

    I was thinking maybe 10,000 units in each direction which is scaled to the current resolution or is there a better way? Such as the attachment.
    That's an interesting idea. In one of my programs I just used screen->w/3.0 or whatever all of the time. I never thought of introducing a new coordinate system. You'll have to let me know how it goes.

    You could use 10,000 for the maximum, or you could use say 2^15-1 for the maximum if you wanted to. (It's sometimes nice to be able to represent relative coordinates, so you might want to make allowances for negative numbers.) But then you've just gone from screen->w/3.0 to SHRT_MAX/3.0.

    [edit] Perhaps a percentage system would work. I guess that's what you were trying to do with 10,000: 5,000 would be 50%. Maybe from 0 to 100 or from 0 to 1 would be better. I know, I know, it would have to be floating-point. [/edit]
    Last edited by dwks; 10-16-2007 at 04:16 PM.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ShellView as a Game Engine
    By Mastadex in forum Windows Programming
    Replies: 1
    Last Post: 01-21-2008, 03:51 PM
  2. Game Engine Link Prob
    By swgh in forum Game Programming
    Replies: 2
    Last Post: 01-26-2006, 12:14 AM
  3. KJ game engine
    By Lionmane in forum Game Programming
    Replies: 4
    Last Post: 11-18-2005, 06:16 AM
  4. Game structure, any thoughts?
    By Vorok in forum Game Programming
    Replies: 2
    Last Post: 06-07-2003, 01:47 PM
  5. game engine
    By onurak in forum Game Programming
    Replies: 1
    Last Post: 07-27-2002, 06:29 AM