Jump to content

View more

Image of the Day

#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Sign up now

Separating game logic from the game engine itself - data representation and connection

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Helixirr   Members   


Posted 11 March 2013 - 02:33 PM

Hi, folks! Welcome to the topic! smile.png


Since many hobbyists and professionals alike use scripting for their game logic and game engine to handle all that, I decided, if they can do it, maybe I can do it too! happy.png


So I got into it. By the help of the Lord, I managed to put up a nice little system to write and read simple game data. I used my very own file decryption and encryption methods, of which I'm not that sure how many people know about. huh.png  Anyway, tongue.png  I kept on going. cool.png Eventually, I was able to store simple data, like game name, window properties, amount of entities, images, 3D models and such. No worries this far! smile.png


To be honest, I don't use scripting (at least not yet). I basically want to separate game engine from the actual game logic. I want to create a game engine, which is flexible enough to support pretty much any type of 3D game, user simply defines the what kind of game my game engine is supposed to handle. Game logic/tools to game engine. That's what I want to do. But how exactly? Simple data can be easily stored, but how about the following data:


- AI (movable areas, path finding)

- actions (user defined functionality for character entities, for instance)

- levels (geometry, entity placements)

- menus (linking to other menus, etc.)


and so on. I hope I made myself clear. wink.png


What do you think? rolleyes.gif

#2 larspensjo   Members   


Posted 11 March 2013 - 04:13 PM

Might work. But in general, it is VERY difficult to make a general purpose game engine.


Instead, I recommend that you make a specific game. Please use the standard OO technologies to keep dependencies to a minimum. Follow the SOLID principles, which will make it easier in the end.


Next step, when you have the first game up and running, you use it as a base for the next game. That is when you see what methods and data that need to be generalized. Be prepared for a lot of refactoring. That may also be when you find where to use scripting as a method of decoupling logic.

Current project: Ephenation.
Sharing OpenGL experiences: http://ephenationopengl.blogspot.com/

#3 frob   Moderators   


Posted 11 March 2013 - 04:47 PM

As for how to do it, I'm actually in the process of building a tutorial on doing exactly that.


It is in my developer journal.  


The data-driven part is Part 4, which I am planning on posting Wednesday, but the code in the package works for saving and loading a data-driven map system.


In actuality it is an entire text-based dungeon crawler game with maps, items, and commands, all of it data driven.  The entire series of 8 entries is already fleshed out on my machine but not published to my journal.  It will probably to be fully published of by the end of next week.


In this case it is a simple state-machine dungeon explorer.  It isn't a fancy game, but it does have a data-driven map and items system.

Edited by frob, 11 March 2013 - 04:47 PM.

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I occasionally write about assorted stuff.

#4 Norman Barrows   Members   


Posted 11 March 2013 - 09:47 PM

- AI (movable areas, path finding)


a generalized engine would generate a nav mesh or A* map once the user designed the game map(s). it would then use built-in AI to make all entities automatically use the nav mesh / A* map,and use A* when moving, or offer this functionality as an option. There's little or no path finding in an F-22 flight sim. 



- actions (user defined functionality for character entities, for instance)


this is where you create your own scripting language, and compiler, and an emulator built-in to the generalized engine. this allows the user to program custom behavior into the engine.



- levels (geometry, entity placements)


a generalized engine can't be locked into a single design paradigm such as level based design. the project I'm working on now is a 2500x2500 mile VR paleolithic world for a caveman rpg, and it doesn't have levels, or cells, or any of that "wolf3d is the only way to build a game" stuff. its more like a flight simulator. there's a huge world map, but not a huge world mesh. sections of the "world mesh" are drawn as needed. no loading levels. you can walk all the way from one end of the world to the other.


a generalized engine would need to be able to simulate controlling any type of vehicle, not just a person. so it would need to be able to do flight simulators, sub sims, racing car sims, space fighter sims, snowmobile sims, dragon sims (you're a dragon), etc, etc. this means being able to draw any type of environment, not just a doom level.


from my own work in this area, it seems that a library vs engine may be a more flexible approach. instead of building an engine, you build all the components for every type of game. so you have libraries for drawing ground and sky, and space and planets, water, etc. and you have some libraries for movement and collision detection, and some for path finding and AI, and so on. and all the low level tools like multi-mesh models, an animation system, timers, audio playback, etc.


the thing to do is make a list of all the different types of games you can think of, and what components they require. that's the feature list for your "engine". then you try to generalize the components as much as possible, without making them overly complex to use. in general, the whole point is to make things easier to use, so you have to design such an engine from the API point of view.


I actually did this once. it did a lot of stuff. lost the source code. it was good enough the non-coder artist on the team could build a game with it. now i use the libraries and boilerplate code approach.



- menus (linking to other menus, etc.)


menu text can be stored in data files. what menu picks trigger which sub-menus can also be stored. in the end, they must call some functionality provided by the engine (such as save game), or invoke code written by the user to provide custom functionality.

Edited by Norman Barrows, 11 March 2013 - 09:48 PM.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"







Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.