binary zoo
Welcome, Guest. Please login or register.
Did you miss your activation email?
January 23, 2018, 05:28:24 PM

Login with username, password and session length
Search:     Advanced search
30179 Posts in 1158 Topics by 195 Members
Latest Member: dianeanderson
* Home Help Search Login Register
+  binary zoo
|-+  Game Development
| |-+  Guest Dev Blogs (Moderator: JDog053)
| | |-+  Retro 2D Game Dev Blog
Pages: [1] 2 Go Down Print
Author Topic: Retro 2D Game Dev Blog  (Read 2208 times)
Mike
25 XP
*
Offline Offline

Posts: 28


:: Insert Witty Statement Here ::


View Profile WWW
« on: June 01, 2016, 05:55:57 PM »

I've always been a lover of not-so-retro retro games like Age of Empires and so on, so as a little side project (something which I've been doing during quiet time in work) is to start building a game engine which will hopefully become a little fun Isometric Game using DirectX accelerated sprites.

Screenshot 1 Attached:

Because all games require communication with the player, the first graphical elements I've worked on is rendered bitmap fonts.  The fonts are generated and stored in a custom-designed file format for extremely fast loading and management of glyphs (whilst also protecting the fonts from being stolen and used in other people's work).  The fonts are rendered in black and white, but using the power of sprites, they can be any colour, and I intend on adding a feature of defining different colours in-string for emphasis on parts of text (something like  "You picked up a <green>Cup of Coffee<white>!")

The fonts can also be aligned Left, Center and Right.

To ease development time and flow, and to keep things retro-y, I've decided to use a BASIC language called PureBasic as the language of use as I use this language all the time professionally to quickly draft apps and functions before moving them over to C# .NET or C++ etc.


* BitFont.png (27.62 KB, 802x627 - viewed 93 times.)
« Last Edit: June 02, 2016, 01:43:48 PM by Mike » Logged

- Mike

Software Engineer
Mike
25 XP
*
Offline Offline

Posts: 28


:: Insert Witty Statement Here ::


View Profile WWW
« Reply #1 on: June 02, 2016, 09:30:00 AM »

Debug Overlay built in to engine.  By pressing F12 you get debug messages appear on the screen (each message/warning/error will only appear for 3 seconds and fade out for easier viewing) including FPS counter.

I've also introduced a screen manager module that manages renderes with layering of Background, Middle, Foreground, Overlay to ensure that any elements (like DebugOverlay) will always be Z-Ordered correctly for fast introduction of game screens, HUDs etc regardless of when they're introduced to the renderer queue list.

And a User Input module has been created too that allows game screens to create User Input event pipelines to be able to direct user input (Mouse, Keyboard etc) to whichever game screen is active as well as any auxiliary (such as the DebugOverlay) screens/overlays.


To give an idea of what the code looks like for an engine module, here's the Debug Overlay component's source code:

Code:
DeclareModule DebugOverlay
  
  Declare Initialise()
  Declare Enable(State = #True)
  Declare Toggle()
  Declare Renderer()  
  Declare OnMessage(Message$, Level)
  Declare OnKeyboardRelease(Key)
  
EndDeclareModule

Module DebugOverlay
  
  Structure message
    string.s
    level.a
    lifetime.i
  EndStructure
  
  Structure instance
    enabled.a
    *pipeline.UserInput::InputPipeline
    List messages.message()
  EndStructure
  
  Global this.instance
  
  Procedure Initialise()
    Logger::AddHandler(DebugOverlay::@OnMessage())
    DebugOverlay::Enable()
    this\pipeline = UserInput::CreatePipe()
    this\pipeline\KeyReleased = @OnKeyboardRelease()
    UserInput::MonitorKey(#PB_Key_F12)
 EndProcedure
  
  Procedure Enable(State = #True)
    With this
      \enabled = State
      If \enabled
        Logger::LogMessage("Debug Overlay Enabled.  Press F12 to disable.")
        ScreenManager::AddRenderer(@Renderer(), ScreenManager::#Layer_Overlay)
      Else
        ScreenManager::RemoveRenderer(@Renderer())
      EndIf
    EndWith
  EndProcedure
  
  Procedure Toggle()
    With this
      If \enabled = #False
        Enable()
      Else
        Enable(#False)
      EndIf
    EndWith    
  EndProcedure
  
  Procedure OnMessage(Message$, Level)
    With this
      FirstElement(\messages())
      InsertElement(\messages())
      \messages()\level = Level
      \messages()\lifetime = ElapsedMilliseconds() + 3000
      \messages()\string = Message$
    EndWith
  EndProcedure
  
  Procedure Renderer()
    Define c.i = ElapsedMilliseconds(), y.i, alpha.a, time, col, pre.s
    y = ScreenManager::Height() / 2
    With this
      Define fpsLine.s =  "FPS: " + Str(ScreenManager::GetFPS())      
      BFont::RenderText(ScreenManager::Width() - 5, 0, fpsLine, BFont::#Align_Right, #White, 255)
      ForEach \messages()
        If \messages()\lifetime < c
          DeleteElement(\messages())
        Else
          time = \messages()\lifetime - c
          alpha = (time * 255 / 3000)
          Select \messages()\level
            Case 0
              col = #White
              pre = ""
            Case 1
              col = RGB(255, 128, 0)
              pre = "WARNING:  "
            Case 2
              col = RGB(255, 128, 128)
              pre = "ERROR:  "
          EndSelect
          BFont::RenderText(100, y,  pre + \messages()\string, BFont::#Align_Left, col, alpha)
          y - 20
        EndIf
      Next
    EndWith
  EndProcedure
  
  Procedure OnKeyboardRelease(Key)
    If Key = #PB_Key_F12
      Toggle()
    EndIf
  EndProcedure
  
EndModule

DebugOverlay::Initialise()


* DebugOverlay.png (27.11 KB, 802x627 - viewed 94 times.)
« Last Edit: June 02, 2016, 10:17:38 AM by Mike » Logged

- Mike

Software Engineer
fog
Zookeeper
1000 XP
*
Offline Offline

Posts: 13185



View Profile WWW Email
« Reply #2 on: June 02, 2016, 10:52:33 AM »

Interesting little project Smiley

Do you have a game in mind or are you just concentrating on building an engine for now?
Logged

Mike
25 XP
*
Offline Offline

Posts: 28


:: Insert Witty Statement Here ::


View Profile WWW
« Reply #3 on: June 02, 2016, 11:06:17 AM »

Essentially at the moment I'm just building an engine to be a modular as possible so at any time I can use the base for any type of game, but I would love to develop this in to an isometric style game where a character can wander around a big world and interact with NPCs with little challenges and what not  Smiley
Logged

- Mike

Software Engineer
Mike
25 XP
*
Offline Offline

Posts: 28


:: Insert Witty Statement Here ::


View Profile WWW
« Reply #4 on: June 02, 2016, 12:48:17 PM »

Game Screen manager (copying Finite State Machine pattern) now implemented to allow menus, worlds etc to be integrated.  Game screens can be changed dynamically with a simple call of a command which will notify the current screen it's about to leave and notify the new scene it's loading to allow loading etc (Heavy pre-loading is done in an initialisation routine called at engine startup)

Game screens can be written in their own include file, and as soon as they're included in to the main engine source code, the engine will automatically know of their presence and handle them accordingly.

Here's a little demo showing 1000 alpha blended sprites going absolutely crazy whilst still maintaining a good FPS (bare in mind this is my office PC and it is very entry-level with the graphics card)


* Screen.png (238 KB, 1026x795 - viewed 95 times.)
« Last Edit: June 02, 2016, 12:50:22 PM by Mike » Logged

- Mike

Software Engineer
Mike
25 XP
*
Offline Offline

Posts: 28


:: Insert Witty Statement Here ::


View Profile WWW
« Reply #5 on: June 02, 2016, 01:43:26 PM »

To add a bit of interactivity (if you wouldn't mind), I've created a Sprite Performance test which will gauge how many alpha blended sprites your PC can handle comfortably before it drops below 60fps.

If you want to participate, here's the download:  https://www.dropbox.com/s/vfvup11da3kgdkx/Sprite%20Test.zip?dl=0

 Just extract and run Engine.exe and give me your results Smiley

 Updated for faster increment time... Should be 500x faster now



* SpritePerform.png (233.28 KB, 1026x795 - viewed 95 times.)
« Last Edit: June 02, 2016, 05:43:30 PM by Mike » Logged

- Mike

Software Engineer
fog
Zookeeper
1000 XP
*
Offline Offline

Posts: 13185



View Profile WWW Email
« Reply #6 on: June 02, 2016, 03:45:24 PM »

Well that took a while.  You might want to increase the rate at which the number of sprites ramps up a bit Smiley

Anyway 20k+ sprites should be enough  man

(2013 i5 MBPro running Win7)


* test.png (47.08 KB, 1044x813 - viewed 89 times.)
Logged

Mike
25 XP
*
Offline Offline

Posts: 28


:: Insert Witty Statement Here ::


View Profile WWW
« Reply #7 on: June 02, 2016, 03:51:56 PM »

Well that took a while.  You might want to increase the rate at which the number of sprites ramps up a bit Smiley

Anyway 20k+ sprites should be enough  man

(2013 i5 MBPro running Win7)


Haha thanks!  And yeah, I realise now that not every PC is as shit graphics-wise as my work PC (I should really demand a higher spec machine).
« Last Edit: June 02, 2016, 03:58:04 PM by Mike » Logged

- Mike

Software Engineer
Mike
25 XP
*
Offline Offline

Posts: 28


:: Insert Witty Statement Here ::


View Profile WWW
« Reply #8 on: June 03, 2016, 10:52:35 AM »

Started creating some bare bones GUI entities for interaction in world, as well as constructed an example demonstrating the scene changes with a menu interface.

Download: https://www.dropbox.com/s/6mb2asozedbitc0/Menu%20Test.zip?dl=0

New and Load Game menus haven't been built and included in to the engine trunk yet so the engine will automatically detect and throw out a debug error message.  Options and Quit however do have scenes included so can do things Smiley


* Menus.png (115.29 KB, 1026x795 - viewed 94 times.)
« Last Edit: June 03, 2016, 01:53:59 PM by Mike » Logged

- Mike

Software Engineer
Mike
25 XP
*
Offline Offline

Posts: 28


:: Insert Witty Statement Here ::


View Profile WWW
« Reply #9 on: June 08, 2016, 09:01:10 PM »

Update

- Massive new overhaul on the Assets system, including advanced security for the engine assets as well as an automated asset compiler.
- Started building the isometric engine in to the game now (download attached) which can support massive worlds with little overhead to GPU or CPU (smart selective rendering of zones)
- Some more pretty stuff added


Tech Demo Download:  https://www.dropbox.com/s/0bej4rvv9iacsd9/Game%20Test%20-%20World%20%28Correct%29.zip?dl=0

Inside the Demo, click on 'New Game' to enter the Isometric World component which you can navigate by using the Up/Down/Left/Right keys.   Enable debug console (either  through Developer Menu, or by pressing F12) to get additional information on what is being rendered, which tile is selected etc.


* IsoUpdate.png (480.52 KB, 1026x795 - viewed 98 times.)
« Last Edit: June 08, 2016, 09:05:39 PM by Mike » Logged

- Mike

Software Engineer
fog
Zookeeper
1000 XP
*
Offline Offline

Posts: 13185



View Profile WWW Email
« Reply #10 on: June 09, 2016, 10:39:54 AM »

Good stuff.  I like the splash screen Smiley

If the grid rendering co-ords displayed are correct then it looks like you can trim the significantly as it would still be drawing quite a lot off-screen.
Logged

Mike
25 XP
*
Offline Offline

Posts: 28


:: Insert Witty Statement Here ::


View Profile WWW
« Reply #11 on: June 09, 2016, 11:20:31 AM »

The rendering scope does need a bit of refining, however i'm being generous at the moment to counter in for  the new static entity objects that have now been introduced (with shadow layer)

See attached  Smiley


* Forest.jpg (404.33 KB, 1026x795 - viewed 94 times.)
Logged

- Mike

Software Engineer
fog
Zookeeper
1000 XP
*
Offline Offline

Posts: 13185



View Profile WWW Email
« Reply #12 on: June 10, 2016, 12:58:51 PM »

We like.

On tenuously related note....why has nobody written a decent Predator style game yet.  You could do an awesomely atmospheric dense rain forest with today's tech.  The single enemy mechanic worked brilliantly in Alien Isolation.
Logged

JDog053
Moderator
1000 XP
*
Offline Offline

Posts: 2422


View Profile
« Reply #13 on: June 13, 2016, 05:37:16 PM »

Yay a new dev log to follow! Smiley
Logged
Mike
25 XP
*
Offline Offline

Posts: 28


:: Insert Witty Statement Here ::


View Profile WWW
« Reply #14 on: June 22, 2016, 09:27:32 AM »

Minor update (Been busy in work developing an AFIS Fingerprint Analysis system -- much like what you see on NCIS);

Created an asset pipeline for the production/rigging and rendering of characters.  Decided to go for an anthropomorphic style of game because Disney fans will love it, and furries will probably flock to it like a blackpool holiday maker on a bag of chips, and because I have a customisable kit already for Poser to bring in to Carrara to render.

The process pipeline creates two sprite sheets, one of which is the model performing the animation in 8 degrees, and the other is the shadow map that accompanies it so the characters can have shadows on the terrain's shadow layer


* spriteset.jpg (112.21 KB, 685x960 - viewed 68 times.)
Logged

- Mike

Software Engineer
Pages: [1] 2 Go Up Print 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
Simple Audio Video Embedder
Valid XHTML 1.0! Valid CSS!