![]() |
|
This thread is locked; no one can reply to it.
![]() ![]() |
1
2
|
About engines |
enric
Member #4,016
November 2003
![]() |
I have heard often people speaking about engines ______________________________________________________ |
LSd016
Member #3,561
May 2003
|
Yeah, engines and other protocols are pretty confusing. But if that's a significant problem to you, you could always use linked lists or Photoshop. ____________________________________________ |
Richard Phipps
Member #1,632
November 2001
![]() |
An Engine in this case would simply be a specific section of your code, or a module. Say you have a tile 'engine' it is passed the map data and draws the tiles to fill the view on the screen. An Engine may be tied in very close to the game code, meaning it can't easily be used for other games. Or it can be actually quite seperate from the rest of the game, although this involves more work when writing the engine. Either way it is still classed as an Engine, because it's a section of code which does a very specific and important role. |
Trezker
Member #1,739
December 2001
![]() |
Let's take an example, my game Devospace. Enemy engine These engines that I've created in their own little modules make it easier for me to puzzle together a game that uses them with simple function calls for updating and drawing. IMHO, your question is somewhat equal to asking what functions are good for. |
james_lohr
Member #1,947
February 2002
|
Yeah I tend to agree - you're better off starting from scratch with most games rather than trying to work within the limits of someone else's tile engine or something. Although, for example, if you were to write a new 3D engine for every 3D game you made you would have to be completely and utterly insane. In fact you have to be insane to write your own 3D engine at all (talking from experience) when you can just use OpenGL.
|
enric
Member #4,016
November 2003
![]() |
ok, it was only the stange word that confused me. thanks ______________________________________________________ |
Lutalo K
Member #4,145
December 2003
|
I was going to start a new thread but I can kill two birds with one stone here... Here is an example of my tile engine...mind you I"m a budding programmer and theres probably a million better ways to do this... but here it goes... void draw_map(BITMAP *bmp,int MapX,int MapY){ for (int i = 0; i < MapX; i ++){ for(int j = 0; j < MapY; j++){ if(Map1<i>[j] == 0){ draw_sprite((BITMAP *) bmp,tiles[0],(i * 32) - 32,(j * 32) - 32); } else; } } } I want 'Map1' to be a variable passed to the function so I can use it for several different maps.. I looked in both my C++ books (complete idiots guide to C++ and C++ in 24 hours) but I couldnt find any good examples of passing pointers into functions in the way I need to do it... How could I do this? |
spellcaster
Member #1,493
September 2001
![]() |
void draw_map(BITMAP *bmp,int **Mapl, int MapX,int MapY){ } should do the trick (if your map uses ints, that is). -- |
Lutalo K
Member #4,145
December 2003
|
Ok cool deal.. forgive the dumb question but why the double ** ... Pointers is something I'm not completly developed with yet... Should I first declare *map1 before I pass it as a function argument... Also I assume I'll have to reference Map1[][] with a pointer in order for it to work right? |
Fladimir da Gorf
Member #1,565
October 2001
![]() |
That's simply a pointer to a pointer. Those are usually used to get dynamically allocated 2D arrays. Spellcaster, wait a moment... int **Mapl assumes that your Mapl contains pointers to the beginning of each row. But this isn't the case with an usual automatic 2D array. Now, if your map is a 2D array of dynamically allocated integers, you can just pass that to the function. You can allocate your map like: // Now you can use the map as usual: if( myMap[y][x] == 0 ) // But you have to remember to destroy it: for( int y = 0; y < mapHeight y++ ) delete[] myMap; OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori) |
Marcello
Member #1,860
January 2002
![]() |
or just use a 1-d array and access elements by doing array[x + y * width]. Saves you a heckload of trouble. Even better, wrap it all in a class, and have it do the allocating/freeing, then just provide accessor functions like getTile(int x, int y). Marcello |
gillius
Member #119
April 2000
|
Yep. std::vector< std::vector< int > >; The overhead on creation will be high, but accessing will be as fast as int**, and you only create the array once. Unforuntately, you still do need to use nested loops to initialize it, so it doesn't save you much work other than to guarantee that all memory will be properly freed. Gillius |
Marcello
Member #1,860
January 2002
![]() |
it's not difficult to do Map::Map(int _width, int _height) width(_width), height(_height) { array = new int[width * height]; } Map::~Map() { delete [] array; }
|
amarillion
Member #940
January 2001
![]() |
Engine is just a word. It can be a convenient word for game programmers to use in discussions. But there is no real definition of what an engine is. There are no rules on how to write one. -- |
nonnus29
Member #2,606
August 2002
![]() |
I think the word 'engine' is pretty abused in amateur/indie gamedev circles. But since its not really defined anywhere you can't complain when people misuse it. I think using the word 'tile engine' to talk about a function to draw a tile map is a little (ok alot) overboard. Personally, I have this idea that out there somewhere floating around in space is a 'perfect game engine' design. By perfect I mean easy to use, powerful, and implemented in very little code. But not general purpose. Although a sidescrolling platformer and fps have some things in common, they also have a lot of things in difference. I think I have a really good design, I just need to implement it. |
CGamesPlay
Member #2,559
July 2002
![]() |
Welcome to my engine Well, when it's done, I plan on making several different mods for it. Presently I'm planning an OpenGL renderer and DirectX renderer, but after its maiden game is done I'll probably do an Allegro renderer for 2d and some mods to make it easy to do strategy games, then one for 2d RPGs (its maiden game is a 3d RPG), then maybe even one for some other 3d genres, like FPS. [edit] -- Ryan Patterson - <http://cgamesplay.com/> |
Specter Phoenix
Member #1,425
July 2001
![]() |
I just would hate to see a 3D matrix engine:o. I've been wanting to do 3D programming but I've seen how hard the 3D rendering logic and I've not tried it yet. I want to do a few 2D games before I go to 3D and I've completed 1 lame text game but I've not done graphics yet. I've got a 2D project going now but I've not started working on the graphics or the engines yet I'm only fleshing it out on paper.
|
Chris Katko
Member #1,881
January 2002
![]() |
Actually, an "engine" has a definition. It's just like a car engine, each piece does it's part. A real engine, is something like one of the quake engines, or the unreal engines. Those are engines. Complete audio/visual/etc engines. Engine has been so abused though. It's quickly becoming a cliche. I've seen people use the term "jump engine." It's two lines of code for subtracting the gravity constant for goodness sakes! -----sig: |
Specter Phoenix
Member #1,425
July 2001
![]() |
Quote:
<b>Lutalo K said:</b> I have several sources to look at myself that probably wouldn't have helped you.
Then I have a few miscellaneous books.
|
Eradicor
Member #2,992
December 2002
![]() |
I like to think as this.. mysterious thing called "engine" as somesort of piece of code which can be used in many many differend programs. | Visit The site | |
Joel Pettersson
Member #4,187
January 2004
|
I would define an engine as one or more functions or code pieces used for one big purpose. Not a particle engine, texture engine or backround engine. Those are just single functions. Together, however, they are a graphics engine. I have one engine in my game DFD. I call it the DFD engine.
|
Billybob
Member #3,136
January 2003
|
Quote: A real engine, is something like one of the quake engines, or the unreal engines. Those are engines. Complete audio/visual/etc engines.
I wouldn't quite say that, because then that is a "game engine". The use of the word in things like "particle engine" should be just fine as well. A "particle engine" is a complete visual/audio(possible)/etc engine, it is just more specific than a whole game. Also, a game engine could very well not have something like audio in it, or visual(just text). The term is similar to RPG, the definition is unclear. If I, myself, were to give a definition, however, it is any common-goaled peice of code that can be easily removed and re-used in several situations. If you use it in other ways...oh well, no one will laugh at you and call you a n00b...unless you so happen to ask: "I want to write an engine in notepad, but when I try to run it it just displays in a notepad?"
|
Korval
Member #1,538
September 2001
![]() |
I prefer to consider the term "engine" to be for large-scale programs that serve a bunch of tasks. The term for smaller pieces of code that only do one specific thing (GUI, tilemap, particle) should be "system", not "engine". |
CGamesPlay
Member #2,559
July 2002
![]() |
Quote: large-scale programs that serve a bunch of tasks. I prefer, "the backend of [all that]". -- Ryan Patterson - <http://cgamesplay.com/> |
Tobias Dammers
Member #2,604
August 2002
![]() |
Game = (Levels+Art) + Engine. OR: Program = Data + Code. A good game has levels, which are a bunch of data, and an engine that interprets the data. An engine may be subdivided into a graphics part, a logic part, a sound part, a network part, and so on, and all these parts are "engines" by themselves. --- |
|
1
2
|