Jump to content
MakeWebGames

Creating My Own Custom Engine


Revolution-NOTL

Recommended Posts

Hello all, it's Revolution. I just want to say that I want to make my own custom engine.

If there is anyone here, who can give me advice that will be great. If there's any good examples of

how to make a custom engine. Can someone post the link?

I also started of by creating the members database table. I haven't coded anything yet...

--UPDATE--

I've just coded the database bit. Now I got to connect it. All I need is a good simple PDO system.

 

<?php

$databasename = "DB";
$databasehost = "localhost";
$databaseuser = "DBUSER";
$databasepassword = "DBPASS";
$code = "RANDMON";
$date = date("d-m-y", time());

?>
Edited by Revolution-NOTL
Link to comment
Share on other sites

Depends entirely on you and your needs. What should your engine contain? Why do you even need to make your own? Learning purposes?

You should divide your application in different layers. Some MVC-inspired architecture is usually a good approach.

One of the important rules in writing good code is separation, and presentation logic and application logic should always be separated, below is a simple but yet flexible way to approach:

 

app/
 config.php
 bootstrap.php
 modules/
   home/
     home.php
   login/
     login.php
 templates/
     home.html
     index.html
     login.html

index.php

 

config.php - would contain configuration such as database details, base url, smtp for email, etc.

bootstrap.php - would be responsible for bootstrapping the application, setting up error handling, database, some container to pass dependencies to modules, autoloading, etc.

modules/ - would contain modules, modules would contain the application logic and busniess logic (a simple, but less separation of concerned application structure) here you would have database queries and loading templates depending on a user's request (etc, show a login form). a module would typically contain a game feature for simplicity, example you could have a module being responsible for logging in a user (setting a session).

templates - contains presentation logic, html... You would pass data from your modules to the templates that can be displayed, etc if a user is logged in you would show a logged in template if not a login template, if you would list members of your "game", you could have a moudle "memberlist", that would pass an array of members to a memberlist.html template that would foreach the array and showing them in some nice table...

Link to comment
Share on other sites

And the only piece of code you've given doesn't even adopt a naming convention, or it does; but not a nice one.

How about reading this.

Also, not to be one of those guys, but it looks like you've taken McCodes v2 config.php file, removed the array and added the date (and renamed the variables).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...