A game with its own editor

This is a discussion on A game with its own editor within the Windows Programming forums, part of the Platform Specific Boards category; hello, I have created a game which really requires its own editor so the game gets never dull. The game ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    162

    A game with its own editor

    hello,

    I have created a game which really requires its own editor so the game gets never dull. The game is just 2D but unfortunately there is still much data which is needed to be saved by the editor so the game would run...

    I am saving the data from the editor to a txt file. I am looking for some method how to make my game read the txt file as a code not as a string. That might sound weird doesnt it?

    So I need the text typed in the txt file to be treated as code source not a string. If it was as a string there would be needed much more code in the game to read needed data appropriately.

    Thx for support

  2. #2
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,667
    The only way I can think of that being possible is having your editor write the data to the file in DLL form. Acctually, that shouldn't be too hard. Just make a template DLL, and have your editor use that file only adjusting minor parts in the DLL (like the resource section) which would ultimatly affect your level.

    But to be perfectly honest... Have you noticed any other games doing it this way? Even your million-dollar-makers just read & inturpret the level files. So why would you want to do somthing stupid that takes up more room? (Both HD & RAM.) Besides if it's just a simple 2D game, then inturpreting your own level data format shouldn't be to hard at all.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  3. #3
    Registered User
    Join Date
    Apr 2007
    Posts
    162
    Well I see your point,
    I will try to work on that... thx for help

  4. #4
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    Writing DLLs seems a bit extreme. Not that it couldn't be done, but you'd need to understand the file format DLLs use, and then work on dynamically linking it to your game.
    Further, the idea of a game's level/data being in a DLL (and therefore executable) is probably a bad idea from a security point of view. Plus, if you're only changing resources in the DLL, then you might as well stick with your own (much more simple) file format.

    Essentially between your game and editor, you have to design the file format for your levels/data/whatever. Just program the game to read whatever the editor saves. The format of what goes into a file is entirely up to you, though there are some well known formats, such as XML. Otherwise, what goes into a level/map/etc. file is entirely up to you. If you need a feature, add it to the code for the game and editor, and change your file's layout to match.

    If you need much more complexity/flexibility in your game, like what javascript does for webpages, some sort of scripting engine might be what you want. (ie, Lua, or you can always create something yourself, but like you said, it'll take more code.)
    GameDev has a few articles on scripting/mods that might help.
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do the game engine and the api interact?
    By Shadow12345 in forum Game Programming
    Replies: 9
    Last Post: 12-07-2010, 11:08 PM
  2. Try my game
    By LuckY in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 09-15-2004, 11:58 AM
  3. HELP!wanting to make full screen game windowed
    By rented in forum Game Programming
    Replies: 3
    Last Post: 06-11-2004, 04:19 AM
  4. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM
  5. Maze game, complete with maze editor and an example maze!
    By Brian in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 01-20-2002, 02:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21