Gah - a solution with more questions. – EntropicLqd

Legacy:Spark/Developer Journal

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

Majestic Kingdom[edit]

Introduction[edit]

Majestic Kingdom is a sophisticated (read: insane) project to create a roleplaying strategy experience in a first person world. It should allow players to play either as the king (controlling structure building, training units, ressource managment, ...) or as a hero (choosing one of several classes, controlling units, ...). Heros will play the game like a role playing game, they can fight to gain experience (either against creeps or enemy units), use magic, meelee and ranged weapons and buy or learn new stuff. If a hero dies, he has to be retrained by the king and then start from scratch.

3/1/2003[edit]

Developer Journal created. I will use this place to talk about everything I do for the Majestic Kingdom project, maybe some of this will be usefull. Currently I'm working on a basic creep code.

4/1/2003 - A baby creep is born[edit]

It can't fight yet, but it will react to the player once it sees it. It is really super simple, so I doubt that it's worth lots of words. The placeable creep is just a subclassed xPawn but placeable:

class Creep extends MajesticPawn placeable;

The default property ControllerClass is set to my CreepController class. This controller class is a subclass of AIController and simply has two states, one for Idle and one for Attacking. In the Idle state, the "SeePlayer()" event will set the Enemy of the Creep and then go to the Attacking state. The attacking state then looks like this:

state Attacking
{
	function WhatToDo()
	{
		// Is our enemy still alive?
		if ( Enemy.Health <= 0 )
		{
			Log("Enemy dead, let's return to home");
			GotoState('ReturnToHome');
			return;
		}
 
		// Ok, so enemy does still live.
		// We can't fight yet, so just check if we reached it yet.
		if ( !Pawn.ReachedDestination(Enemy) )
		{
			// We didn't, so find best path
			Log("Finding new path to enemy");
			MoveTarget = FindPathToward(Enemy);
			Focus = MoveTarget;
		}	
		else
		{
			Log("Reached enemy");
			MoveTarget = None;
		}
	}
 
Begin:
	WhatToDo();
	if ( MoveTarget != None)
	{
		MoveToward(MoveTarget);
		Goto('Begin');
	} else {
		GotoState('Idle');
	}
}

What I don't like about this is, that SeePlayer() is only triggered if the player is actually in the FOV of the creep. Before I used RadiusActors to find a surrounding pawn in a Timer event, but the SeePlayer event seemed to be a better choice to me. If anyone knows how to make it see in every distance... Maybe I could use the HearNoise event, but this would be difficult to predict.

I should go on making the creep actually attack now, award XP points for killing it, etc but I feel that this isn't really possible yet without the framework, so I need to find a starting point. The best idea to me seems to be to create a new GameInfo and a new PlayerController/Pawn. I will probably subclass the most basic classes because the game really hasn't much to do with Unreal anymore and most of the stuff there in xPlayer, xPawn, etc is simply not needed by me. This will take a while though because the GameInfo class doesn't even run as a gametype yet.

6/1/2003[edit]

I was mistaken, GameInfo DOES run, it was TeamGame that didn't run (crashed). I have a nice starting point now. :) You can't really enter the game as a player yet, but I added an option to the midgamemenu to join the game as a king. This includes a nice topdown look at the map which automatically adjusts to terrainheight. See this thread at BuF for more details. Next I will do zoomin and zoomout functionality and start creating a HUD for the king including a mouse pointer.

Today I also posted a thread in the recruitment forum, hopefully someone will respond.

8/1/2003[edit]

Zooming is working nicely already. Creating the HUD took me a bit longer until I figured out that my HUD isn't drawn because my player has no pawn. Now that this is solved I can finally start working on a mouse pointer.

I think I will create a subpage Spark/Mouse Pointer for this, might be usefull.