Jump to content
MakeWebGames

Simple RTS Engine


Ayern

Recommended Posts

ok wow easy game.

Just now finished a bunch of re-balancing of rewards and costs for the Grinding and Tavern sections on demo. Need some testers to level up. Feedback if at all possible so i can get on releasing it as well.

Link to comment
Share on other sites

Even more updates and re-balancing on the entire engine to make room for quests and mobs. It seems including grinding has broadened my range of what I thought game engines were capable of.

 

On another note...

500+ lines of code and a lot of if statements, I was wondering if anyone could help me with passing variables through functions as parameters? I've tried a few different ways but can't seem to get the right result. for instance I want to check if experience is greater than or equal to the maximum value stated in the if statement that would contain the function. i have tried

$stats['experience'] >= $experience_needed

is the in basic if statement with mysql update and then displays a button in html below.

I would like a function to do this.

needtolevel($stats['experience'],$experience_needed);

function needtolevel($exp,$exp_needed){
if($exp >= $exp_needed)
{
reward("You now have enough Experience to increase your Adventurer's Level!");
 }
}

 

also would display a button to level up. I really would like to know what i'm doing wrong.. anyone have tips for this?

Link to comment
Share on other sites

You can try something like this

echo needtolevel($stats['experience'],$experience_needed);

function needtolevel($exp,$exp_needed){
   if($exp >= $exp_needed)
       echo reward("You now have enough Experience to increase your Adventurer's Level! <br />Click <a href='somepage.php'>Here</a> to level up");
}

I'm not too sure on your reward() function if it returns or echos/prints.

And also sorry if this isn't what you were looking for, maybe I read your post wrong since I'm a bit confused

Link to comment
Share on other sites

/**
* Some description of the function.
* @param int $exp - Some description.
* @param int $exp_needed - Some description.
* @return int - 1 => Exp greater than or equal. 2 => Not greater than or equal to.
*/
function needToLevel($exp,$exp_needed){
   if($exp >= $exp_needed) {
       return 1;
   } else {
       return 2;
   }
}

 

I commented function, just add the description this help developers use the function too. Like [MENTION=68711]KyleMassacre[/MENTION] said, we don't know the contents of reward(); either so that might be the issue.

Then maybe to something like this:

 

if(needToLevel($param1, $param2) == 1) {
   // Reward message.
}
Link to comment
Share on other sites

/**
* Some description of the function.
* @param int $exp - Some description.
* @param int $exp_needed - Some description.
* @return int - 1 => Exp greater than or equal. 2 => Not greater than or equal to.
*/
function needToLevel($exp,$exp_needed){
   if($exp >= $exp_needed) {
       return 1;
   } else {
       return 2;
   }
}

 

I commented function, just add the description this help developers use the function too. Like [MENTION=68711]KyleMassacre[/MENTION] said, we don't know the contents of reward(); either so that might be the issue.

Then maybe to something like this:

 

if(needToLevel($param1, $param2) == 1) {
   // Reward message.
}

This is reward();

function reward($string)
{
echo "<div id=\"reward\">" . $string . "</div>";
}

Nothin special. i havent tried == 1 yet, but ive been getting a false even when passing variables that should come out true.

Link to comment
Share on other sites

This is reward();
function reward($string)
{
echo "<div id=\"reward\">" . $string . "</div>";
}

Nothin special. i havent tried == 1 yet, but ive been getting a false even when passing variables that should come out true.

Return 1 just allows your to know if it is greater than it. You could easily do return TRUE or return FALSE. Either way it just preference.

Link to comment
Share on other sites

Well see i'd put some if logic like that into a function and if true it should call reward("You can level up now"); if false do nothing. }else{ do nothing.

which, but I would still keep getting a false and it will call the next { which has reward(); even if exp ISNT greater than exp_needed

Link to comment
Share on other sites

  • 2 weeks later...

the grinding functionality has evolved into "classes" and Grinder is one of them. Skinner, Leatherworker, Miner, Smelter and more classes to level up and each perform specific functions in relation to each other and the game mechanics of fighting other players in pvp. The live version will no longer receive updates as I cannot rely on the free servers for up-time in addition to my dsl wifi connection so im using WAMP server and i've dramatically increased development speed. I forgot the only reason I signed up and started using the online servers was to test crons, and they worked but i dont need crons anymore for development purposes.

So, in light you can play the demo version of the engine 0.5 alpha and I will be continuing coding throughout my mundane daily life of being a house dad. If you would like an update you can PM me on here and ill update the files to whatever current stable version for testing. When i'm satisfied with all the different aspects of the engine and what it lays out for any generic game I will probably release that version stripped of all db relations and just have similar generic names for distribution..

Link to comment
Share on other sites

the grinding functionality has evolved into "classes" and Grinder is one of them. Skinner, Leatherworker, Miner, Smelter and more classes to level up and each perform specific functions in relation to each other and the game mechanics of fighting other players in pvp.

Here's a look at some changes to the game...

[ATTACH=CONFIG]1538[/ATTACH]

gameupdate.thumb.png.bddf3ccc46a87e7004e61793021003d8.png

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...