Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 6th, 2006, 5:07 PM   #31
frankish
Hobbyist Programmer
 
frankish's Avatar
 
Join Date: Oct 2005
Location: Ohio
Posts: 177
Rep Power: 0 frankish is an unknown quantity at this point
Quote:
Originally Posted by King
This needs some work.... First of all multiple files would be a good idea, and your main should only be like 10 lines of code, not a couple hundred.
Not really, I have a reason for coding the way I do.
frankish is offline   Reply With Quote
Old Jul 6th, 2006, 5:09 PM   #32
frankish
Hobbyist Programmer
 
frankish's Avatar
 
Join Date: Oct 2005
Location: Ohio
Posts: 177
Rep Power: 0 frankish is an unknown quantity at this point
Quote:
Originally Posted by angry_asian
i know i am new to C++, but isnt #define antiquated? dont people just use const char nowadays?
Some people do but I don't - that's my style of coding. Since you're new to C++ it is a good idea to follow the C++ standards. I once did but now that I am experienced at programming. I can code in this fasion because it has advantages over the standard. My coding is not true C++, it's actually a form of C! I'm just using C++ as "better" C.

Last edited by frankish; Jul 6th, 2006 at 5:21 PM.
frankish is offline   Reply With Quote
Old Jul 6th, 2006, 5:13 PM   #33
frankish
Hobbyist Programmer
 
frankish's Avatar
 
Join Date: Oct 2005
Location: Ohio
Posts: 177
Rep Power: 0 frankish is an unknown quantity at this point
I'm going to post a copy of the manual here so you guys can get a feel of what the level editor can do.

LEVEL EDITOR INSTRUCTION MANUAL

Table of Contents
-----------------

1. Introduction
2. Controls
3. File Formats
4. Notes

INTRODUCTION

  The level editor is meant to be a tool to create and edit isometric levels in a simple and
quick manner. The editor is implemented in 400x300 canvas mode and allows levels of all sizes
but with a somewhat limited number of objects. However, this restriction is not that great as
levels can have quite a few objects. I personally use the level editor to create levels for
games even before I create the game. This gives me a chance to get a feel of how the game might
look like.

CONTROLS

Q: quit level editor
Z: scroll through background colors
X: scroll through object types
C: scroll through work layers
V: scroll through object properties
B: increment object property value
N: deincrement object property value
I: move selected object up
M: move selected object down
J: move selected object left
L: move selected object right
4: move cursor up
E: move cursor left
T: move cursor right
D: move cursor down
R: select object while cursor is over it
Insert: lay down object at cursor location
Delete: delete selected object
arrows: scroll through the level
Caps Lock: toggle level stats
comma: change music track
period: preview music track

FILE FORMATS

  This level editor deals with four types of files: level files, catalog files, music tracks
file, and color files. The latter three files contain information relevent to the the editor
itself. The level editor will prompt you for the name of each type of file. You are expected to
have created the catalog file, color file, music tracks file, the music, and the graphics
associated with the level. Good format is necessary as it could cause serious problems, even
crashes!

Catalog Files

  The catalog file contains information about each type of object. It consists of blocks where
each block contains information for one object. Each block is formatted as follows:

name of object
name of bitmap (BMP file)
number of properties (integer)
property name 1
.
.
.
property name n
initial property value 1 (integer)
.
.
.
initial property value n
type of object ("background object", "middle object", or "foreground object")

  n corresponds to the number of properties so keep this consistent with that number. The name of
the bitmap is actually a file name. This should be a BMP file in true color format, preferably
24 bit. One last important thing is to terminate the catalog file with a newline.

Color Files

  Color files are raw. This means that they consist of tripplets of red, green, and blue
intensities as integers. Color files should also be terminated with a newline. Here's an example
of how a color file is formatted:

red (integer)
green (integer)
blue (integer)

  Try to keep each integer value in range (0 to 255). These are intensities, not colors.

Level Files

  Even though the level editor creates these it is still important to know how they are formatted
because they can be used in games. I did not provide any library to help dealing with this. It
is your responsibility to deal with the data in the level file itself.

  The first line of a level file is a number specifying the selected the background color for
the level. The next line following it is another line containing a number that specifies the
selected music track for the level. From there the rest of the file consists of blocks
describing each object in the level. Level files should be terminated with a newline. The format
of a block is shown below.

name of object
property value 1 (integer)
.
.
.
property value n
x coordinate
y coordinate

  To determine the number of property values you can read all integers to the end of the file
and then use all but the last two as properties. The coordinates of the object are relative to
the level, not the screen. You'll have to deal with this yourself.

  Level files should not be edited directly because you can screw up some things. There is also
an implied limit to the number of objects that can be present in the level but that number is
large.

Music Tracks Files

  This type of file contain the names of midi files that are to be used in selection for the
level. The file terminates with a newline.

NOTES

- do not place too many objects in a level as it could slow down your game
- your level is saved every 5 minutes and when you exit the editor
frankish is offline   Reply With Quote
Old Jul 6th, 2006, 7:27 PM   #34
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
My point is that every game has its own quirks, and that your level editor will only work for a very basic game because it's so generic. It's best to create the tools for the job, not the other way around.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Jul 6th, 2006, 7:45 PM   #35
melbolt
Hobbyist Programmer
 
melbolt's Avatar
 
Join Date: Feb 2005
Location: PA, USA
Posts: 242
Rep Power: 4 melbolt is on a distinguished road
Send a message via AIM to melbolt Send a message via Yahoo to melbolt
is this geared towards a particular game?
__________________
I have never let my schooling interfere with my education. -Mark Twain-

Xbox live gamertag: melbolt
melbolt is offline   Reply With Quote
Old Jul 6th, 2006, 9:07 PM   #36
King
Professional Programmer
 
King's Avatar
 
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 376
Rep Power: 0 King is an unknown quantity at this point
Quote:
Originally Posted by frankish
Not really, I have a reason for coding the way I do.
So what is your reason for not wanting to use multiple files or shortening your main?
__________________
I am Addicted to Linux!
King is offline   Reply With Quote
Old Jul 6th, 2006, 9:30 PM   #37
frankish
Hobbyist Programmer
 
frankish's Avatar
 
Join Date: Oct 2005
Location: Ohio
Posts: 177
Rep Power: 0 frankish is an unknown quantity at this point
Quote:
Originally Posted by King
So what is your reason for not wanting to use multiple files or shortening your main?
It's easier to step through the code. Debugging becomes almost trivial. Now my question is why would you do what you said?
frankish is offline   Reply With Quote
Old Jul 6th, 2006, 9:31 PM   #38
frankish
Hobbyist Programmer
 
frankish's Avatar
 
Join Date: Oct 2005
Location: Ohio
Posts: 177
Rep Power: 0 frankish is an unknown quantity at this point
Quote:
Originally Posted by melbolt
is this geared towards a particular game?
isometric games
frankish is offline   Reply With Quote
Old Jul 6th, 2006, 9:35 PM   #39
Toro
Hobbyist Programmer
 
Toro's Avatar
 
Join Date: Apr 2006
Posts: 136
Rep Power: 0 Toro is an unknown quantity at this point
Honestly, what was so hard about you showing us the source code?
Toro is offline   Reply With Quote
Old Jul 6th, 2006, 9:44 PM   #40
King
Professional Programmer
 
King's Avatar
 
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 376
Rep Power: 0 King is an unknown quantity at this point
Quote:
Originally Posted by frankish
It's easier to step through the code. Debugging becomes almost trivial. Now my question is why would you do what you said?
Because it is much cleaner code and easier to debug. Functions should not be that long, especially the main; having a large main is bad coding style. Why do you take so much offence from people giving you tips? You should always be looking to improve your code whenever possible.
__________________
I am Addicted to Linux!
King is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:53 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC