Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411423 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 19, 2024, 02:51:04 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsFreeman from the coders perspective
Pages: [1] 2
Print
Author Topic: Freeman from the coders perspective  (Read 5215 times)
xiotex
Guest
« on: May 16, 2010, 02:28:07 AM »

I decided a while back to team up with Rudolf, the designer of Dyson/Eufloria and Dugan, the artist from Gravity Crash to make a new game called Freeman which Rudolf describes as a 2D exploration game.

All of my work to date on the project has been concentrating on getting the level editor tools up and running. Rudolf thinks I am being nice to him in providing a level editor but the reality is when coding the game I need an easy way to get content in so that I can test and even I hate editing text files all the time. This does of course mean that the last few weeks I have been slogging away at writing a solid dialog based GUI system that makes interacting with the level editor easy. This has meant writing code for:

* Dialogs
* Labels
* Buttons
* Sliders
* Checkboxes
* List Views (display a scrolling list of text and image data)
* Text edit boxes
* Text boxes (non edit variety)
* Frame view (for the animation editor)

It's going well so far but all the coding is having to be done part time as I am having to contract in order to pay the bills so most of the code is being done on the train in the morning on the way to my current contract (EA). To get the above list up and running has taken just over a week at an average of an hour a day but this is helped by getting the base code correct which looks like:

Code:
class CUIBase
{
public:
CUIBase(){};

virtual ~CUIBase()
{
std::list<CUIBase*>::iterator it = m_lChildren.begin();

while(it != m_lChildren.end())
{
delete *it;
++it;
}

m_lChildren.clear();

};

virtual void UpdateAndRender(float fOffsetX, float fOffsetY) = 0;
virtual bool OnMouseDown(float fX, float fY) = 0;
virtual bool OnMouseUp(float fX, float fY) = 0;
virtual bool OnMouseMove(float fX, float fY) = 0;
virtual bool OnKeyDown(DWORD dwKey) = 0;
virtual bool OnKeyUp(DWORD dwKey) = 0;
virtual void LoseFocus() = 0;
virtual void MessageHandler(DWORD dwMessage) = 0;

void SetType(UI_TYPE dwType) { m_eType = dwType; }
UI_TYPE GetType() { return m_eType; }

void SetFocus() { m_bFocus = true; }
void RemoveFocus() { m_bFocus = false; }
bool GetFocus() { return m_bFocus; }

bool HitTest(float fX, float fY)
{
if(m_pParent)
{
m_fParentX = m_pParent->m_fX;
m_fParentY = m_pParent->m_fY;
}

if(fX >= (m_fX + m_fParentX) && fX <= (fX + m_fWidth + m_fParentX))
{
if(fY >= (m_fY + m_fParentY) && fY <= (m_fY + m_fHeight + m_fParentY))
{
return true;
}
else
{
return false;
}
}

return false;
}

bool RegisterMouseMove(float fX, float fY)
{
if(HitTest(fX, fY))
{
m_bMouseOver = true;
return true;
}

m_bMouseOver = false;
return false;
}

bool RegisterMouseClick(float fX, float fY)
{
if(HitTest(fX, fY))
{

m_bFocus = true;
m_bMouseDown = true;

m_fMouseOffsetX = fX - m_fX;
m_fMouseOffsetY = fY - m_fY;
return true;
}

m_bFocus = false;
m_bMouseDown = false;
return false;

}

void UpdateAndRenderChildren(float fOffsetX, float fOffsetY)
{
std::list<CUIBase*>::iterator it = m_lChildren.begin();

while(it != m_lChildren.end())
{
CUIBase* pChild = *it;
pChild->UpdateAndRender(fOffsetX,fOffsetY);
++it;
}
}

protected:
UI_TYPE m_eType;
float m_fX;
float m_fY;
float m_fWidth;
float m_fHeight;
bool m_bFocus;
bool m_bMouseDown;
bool m_bMouseOver;
float m_fMouseOffsetX;
float m_fMouseOffsetY;
float m_fParentX;
float m_fParentY;
CUIBase* m_pParent;
DWORD m_dwID;
char m_cLabel[32];
std::list<CUIBase*> m_lChildren;

};


Once the GUI boilerplate code is over I have to move onto the actual dialog boxes for each of the section on the editor. Lots to do...

Logged
BlueSweatshirt
Level 10
*****

the void


View Profile WWW
« Reply #1 on: May 16, 2010, 12:10:17 PM »

Why not use something like CEGUI?
Logged

xiotex
Guest
« Reply #2 on: May 16, 2010, 12:28:26 PM »

Oh the usual excuses, the main one being it was something I've always wanted to do. Another reason would be I simply didn't know about the existence of CEGUI.
Logged
BlueSweatshirt
Level 10
*****

the void


View Profile WWW
« Reply #3 on: May 16, 2010, 12:33:23 PM »

 Cheesy

GUI designing is kind of an intricate art in the programming world. I should try it some day.
Logged

xiotex
Guest
« Reply #4 on: May 16, 2010, 12:49:16 PM »

Ha!

It was worth doing, so yeah, give it a go. However if you just want to get a game made then go for something like CEGUI. Believe me if I had know if it's existence I would have seriously considered it.

Logged
xiotex
Guest
« Reply #5 on: May 17, 2010, 12:08:04 PM »

One of the overriding principles of XGDK (The engine used to create Freeman) is that it should allow the game to be as mod friendly as possible. This means I want the game creator to be able to build as much content as possible with the in-game editors. At the moment this has meant an in-game level editor and coming soon is an animation editor.

The animation system to be used was a lengthy choice and I still believe we have some way to go before the final decision is made but in the meantime I have been building the editor. Even if it's not used by Freeman it will be there to allow it to be used by other games made with XGDK. The idea is simple and in some ways based on the animation system found in Flash. A series of frames and keyframes used to animate 2D sprites. However before I dive into the actual animation system itself I need to get creating with it correct or it's not going to be used.

It's mostly there now. I have a widget displaying the frames and keyfames. You can scroll through them and select individual frames. The next step is to add the child controls that show the properties of the keyframes. Once all that feels right I can work on the actual animator with some confidence. This is of course the point where it's decided that we should be using a full 3D bone based animation framework.
Logged
xiotex
Guest
« Reply #6 on: May 20, 2010, 01:09:10 PM »

Made some significant progress in the UI Library and in turn the animation editor. It's been a hard slog but I finally got a very basic animation up and running tonight using solely the animation editor. If you ignore the fact that there is a film playing in the background (audio) here's a screencast of it in action: http://xiotexstudios.com/screencasts/AnimationEditor.swf

I am representing the actual animation using wireframe quads, eventually they will be textured quads. The positioning of the quads is done through the dialog sliders and in the final version it will be direct manipulation with the mouse, which is the way the level editor currently works.

Logged
BlueSweatshirt
Level 10
*****

the void


View Profile WWW
« Reply #7 on: May 20, 2010, 05:09:02 PM »

You should allow the user to adjust frames per second, it's especially apparent with tweening on what the framerate is.
Logged

xiotex
Guest
« Reply #8 on: May 22, 2010, 10:08:19 AM »

The frame rate you are seeing there is significantly affected by the screen recording, however, it is going to be artist driven, or a fixed (30fps) frame rate, just haven't decided yet.
Logged
PeterM
Level 0
**



View Profile
« Reply #9 on: June 11, 2010, 02:37:26 AM »

Nice read, thanks for starting a devlog.
Logged
Loren Schmidt
Level 10
*****



View Profile WWW
« Reply #10 on: June 11, 2010, 05:52:32 PM »

Oh, I've been curious about this project since Rudolf first mentioned it. I'm glad you're starting a log, it will be interesting to hear how the game progresses.
Logged
xiotex
Guest
« Reply #11 on: June 12, 2010, 12:29:55 PM »

Slowly at the moment Smiley

Paying the bills by contracting at EA so get to code on the train in, on the train back and any other time I'm not sleeping. The good thing at the moment is that the other members of the team have actually been playing with the level editor and the bad news is that they have a list of feature requests and bugs for me to fix. Serves me right for asking them to look I suppose!

The fun I am having at the moment is cross-platform coding. Not the actual details but the development environments. XCode can take a directory tree and import it directly into the project. Visual Studio however requires me to go into individual directories and add files by hand which is okay until I needed to add a lot of code nested in a bunch of directories. There has got to be an easier way and if there is let me know! It's getting to the point where I am considering adding the files directly to the proj file by editing it in notepad.

The other distraction was that my iPad arrived and I just had to write a game on it and that is going well. It's not all self-indulgence however since a lot of the code is shared with Freeman.

Logged
xiotex
Guest
« Reply #12 on: June 16, 2010, 01:50:51 AM »

It's with great sadness that I have to announce that I am no longer involved in Freeman, Rudolf decided to sever the agreement this morning.

Good news is I now have a tile based cross-platform engine that kicks ass and can be used for other games.
Logged
Evan Balster
Level 10
*****


I live in this head.


View Profile WWW
« Reply #13 on: June 16, 2010, 04:12:01 AM »

I have an iPhone and a Droid and still haven't gotten around to coding for either.  Except at a summer job last year.  :/

Also, bummer.
Logged

Creativity births expression.  Curiosity births exploration.
Our work is as soil to these seeds; our art is what grows from them...


Wreath, SoundSelf, Infinite Blank, Cave Story+, <plaid/audio>
xiotex
Guest
« Reply #14 on: June 16, 2010, 04:14:25 AM »

Bummer, but what can you do eh?

Will make me a lot more cautious about entering into collaboration with anyone else again. Wrote a hell of a lot of code for Freeman for it just to be burned in a second.
Logged
Evan Balster
Level 10
*****


I live in this head.


View Profile WWW
« Reply #15 on: June 16, 2010, 04:43:55 AM »

I assume it was slow progress that killed you?  "Writing an engine" != "Writing a game" and it's usually good to have the necessary tools in hand by the time you start a project.
Logged

Creativity births expression.  Curiosity births exploration.
Our work is as soil to these seeds; our art is what grows from them...


Wreath, SoundSelf, Infinite Blank, Cave Story+, <plaid/audio>
xiotex
Guest
« Reply #16 on: June 16, 2010, 04:54:46 AM »

..
« Last Edit: June 16, 2010, 10:21:27 AM by xiotex » Logged
Alex May
...is probably drunk right now.
Level 10
*


hen hao wan


View Profile WWW
« Reply #17 on: June 16, 2010, 05:05:43 AM »

..
« Last Edit: June 16, 2010, 11:52:05 AM by Alex May » Logged

xiotex
Guest
« Reply #18 on: June 16, 2010, 05:15:49 AM »

..
« Last Edit: June 16, 2010, 10:21:16 AM by xiotex » Logged
deathtotheweird
Guest
« Reply #19 on: June 16, 2010, 10:51:01 AM »

(I didn't see what was said and it's kinda irrelevant but I'm going to chime in anyways)

I wouldn't totally blame him for his outburst, as I'm sure it's very frustrating for him to write all that stuff for nothing. Rightfully so, I guess. Just a moment of anger, took him a bit to calm down.

Oh well, he deleted his account. Wish ya luck on whatever you work on next Byron.
Logged
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic