Posts filed under 'projects'

GORC - Map editor?

Have the timer problem yesterday somehow get resolved and I can now devote the scenes. Here I would like but let's not easy to program on it go wild and spend the whole thing a few times rather Bedenkminuten xD

The first time I've been looking for a cute map editor and tiled found. Is written in Java and runs so nice to also seriously participating in any operating system. What I also find it very handy, the cards are stored in XML and can be assigned to objects within the map editor its properties.

The latter is for instance useful if it fits as a notepad. That might be so even when you design the card missing its contents. Or Teleport Teleporter their target fields ... fine thing:)

Internally, I will save the scene in about three 2D arrays. In the first floor are tiles. Why? I noticed in Robot 3, which it does not look very nice, if a wall in the forest wegätzt, because then there is a white tile in the middle of the forest. It would be nice if there would appear on my account brown forest soil. This is exactly what allows me to be my first array (I call just layer 0 times xD).

Layer 1 will contain all other non-NPC game objects. And in layer 2 are then roofs and everything else could run under the long Charlie. Charlie You are on my account in a house just is not drawn more Layer 2 and we have the same effect as in Robot Game of the rooftops:)

NPCs and all objects are stored each in a list. These are then not sooooo long it is delayed and I have to have, despite all the possibility of multiple objects at one and the same field. Because this situation arises, I believe, only if the player discards objects. Or because I missed something?

Currently I have for each object its own PNG compatible, but unfortunately with tiled not so great. So here will switch back to a single image for a full tileset. One or two changes to the object base class and also this little problem would be solved.

I hope times, I still create all of this within this week, because then I can let off steam again in the GUI;)

12 comments February 8th, 2009

GORC - I just make stupid to be: (

Because had Löve everything works so well, I have copied the timer and switched as a precaution all float to integer variables. This brought a nice burst of speed and slammed my animations perfect. But I just wanted to use the liquid object movements and everything started to tick. So everything converted back to float. Now they are more fluid, but he expects to be stupid and dumb, 20 FPS loss: (

, There must be better ... we'll gaze ...

February 7th, 2009

GORC - Next stop: Object class

The most basic functions without a murmur in their new homes Singleton (Screen, Timer, Image) disappeared. The Game class also takes shape slowly:)

The next step is the object base class for the game elements. First I want to see how it behaves in the wild, because it must care also about any animations. Without Löve should I care about myself so this time * lol *

What I have noticed in the Löve GORC version of each object instance has had its own instance of image ... which of course was not necessarily resources. This time I got taken to ensure that an image is loaded only once and will be taken at any other "store" from the cache.

So I come forward ... and despite the cold and extremely slow thinking process xD

February 6th, 2009

GORC - C + +

A while ago I was still not so sure. But hardly had I replied to herc's comment, there was D (again) pretty impressed by my idea of the inheritance of variables and functions of a parent class to their kiddies.

I admit yes to I do not really know what I should do with things like "virtual" and "protected". But if I as:

  1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
  class Image
 (
     ...
     uint x , uint y ) void draw (uint uint x, y)
     (
         ...
     )
     ...
 )

 Image class Animation: Image
 (
     ...
     void draw ()
     (
         , 1 ) ; draw (1, 1);
     )
     ...
 ) 

did, why complain to God's will be the D compiler, the class does not draw the animation uint ("uint) function does? My understanding is that they should nevertheless have inherited from the Image class, right? Ok, thanks to Google, I do it like this to see:

  1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 void draw ( uint x , uint y ) { ... } ... } class Animation : Image { ... alias Image. draw draw ; void draw ( ) { draw ( 1 , 1 ) ; } ... } class Image (... void draw (uint x, uint y) (...) ...) class Animation: Image (... aka Image. draw draw; void draw () (draw (1, 1); ...)) 

Phew! Slowly, I really think of who do not deal with the OOP principles in his sleep, should allow the fingers of D: (

So ... I'll take C + +, which deals with my ignorance a little gracious and try to learn it;)

3 comments February 5th, 2009

GORC - new beginning? C, C + +, BASIC Free or D?

Here on my old laptop GORC runs much too slowly. This is largely because the Löve uses OpenGL. SDL for a 2D game engine would have sufficed perfectly. Naja. But what now?

Actually a pretty good time to GORC in a "real" programming language to write new and like to use the SDL library. Finally, I need not more than SDL, SDL_mixer and SDL_image. Later still Lua for scripting, but until then is still time ...

In the short-listed here come four languages: C, C + +, BASIC and Free Digital Mars D. The latter I always wanted to sniff a little more closely. The libraries of my choice all support.

To C and C + + does not like I write too much. Can pretty much be compiled for everything and I just love the syntax:)

Free BASIC is like a C with Quick Basic syntax. Can compile but unfortunately only for Windows and Linux.

D will probably be "better" than C + +. To what extent the easy on a project like GORC impact, no idea. Compiling designed DSSS, thanks a lot easier than in C / C + +. For I have still never managed really, that's my program to compile let by. / Configure & & make. Is just too expensive all * lol *

Here also, once a small glance in the direction D:

  1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 . sdl ; import tango. io . Console ; void main ( ) { try { DerelictSDL. load ( ) ; } catch ( Exception e ) { Cout ( "Could not load the SDL shared library. \n " ) ; return ; } SDL_Init ( SDL_INIT_VIDEO ) ; SDL_SetVideoMode ( 640 , 348 , 24 , SDL_SWSURFACE ) ; SDL_WM_SetCaption ( "GORC" , null ) ; mainLoop : while ( true ) { SDL_Event event ; while ( SDL_PollEvent ( & event ) ) { switch ( event. type ) { case SDL_QUIT : break mainLoop ; default : break ; } } SDL_Delay ( 10 ) ; } Cout ( "Oki Dokili. \n " ) ; SDL_Quit ( ) ; DerelictSDL. unload ( ) ; } import derelict. sdl. sdl; import tango. io. Console; void main () (try (DerelictSDL. load ();) catch (Exception e) (court ("Could not load the SDL shared library. \ n"); return;) SDL_Init (SDL_INIT_VIDEO); SDL_SetVideoMode (640, 348, 24, SDL_SWSURFACE); SDL_WM_SetCaption (GORC ", null); mainloop: while (true) (SDL_Event event while (SDL_PollEvent (& event)) (switch (event . type) (case SDL_QUIT: break mainloop; default: break;)) SDL_Delay (10);) court ("Oki Dokili. \ n"); SDL_QUIT (); DerelictSDL. unload ();) 

So? What I'll take it now?

4 comments February 3rd, 2009

GORC - pixel without a ticket

What I have today the whole day looking for dead * shake head *

Framework for menus and dialogs have been drawn without any problems, ok ... we still make the main menu quickly finished, and then after work. Nix fit there ... Somehow either the menu items not in the window or the window was too large. But what can you go wrong when a part of the frame exactly 8 × 10 pixels is large and one letter of the font is the same size? Simple mathematics, yet does not fit anything!

I had actually only a few letters of the font resources Paint miss a framework to see the error. Until then I had my source probably already read a thousand times without result correction. The standard function for bitmap fonts Löve inserts (which of course I did not know) is an emerging one pixel between two letters. But fortunately there were also a function, thanks to which I could leave this stupid pixels;)

Well, I have now had enough of programming. The menu can wait now that is finally today, who is 18 and is already strong without me in the celebrations.

Congratulations, brother!

2 comments January 24th, 2009

GORC - Game object classes finished, what next?

Preface: I've noticed that I GORC my thread in the Game of Robot Forum now abused as DevBlog. The times I will now work against it, and my progress and thoughts in this blog post ... where they actually belong too;)

So ... I used the last week and stuffed all game elements into classes. The content of a scene is no longer in a 2D array, but in two Lua tables. One of the robots, then perhaps all the other NPCs come in here. And in the other table insert all other elements (walls, gold, etc.).

The purpose of the procedure is to make the game logic manageable. Instead of a long if-then-else blocks now put all the logic for a particular object in its class instance. An example:

  1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
  "Gold" , Object ) Gold = Class ("gold", Object),

 "images/gold-0.png" ) Gold love.graphics.newImage Image = ("images/gold-0.png")
 , 0 ) Gold Image: setCenter (0, 0)

 "sounds/gold.wav" ) Gold Sound love.audio.newSound = ("sounds / gold.wav")

 x, y, params ) Gold init function: (x, y, params)
	 self.super: init (x, y)

	 self.ani = Gold Image
 end

 obj ) function Gold: canEnter (obj)
	 - Can be entered by the player only
	 obj ) then return false end if not player: made (obj) then return false end
	 return true
 end

 obj ) function Gold: onEntered (obj)
	 obj ) then return end if not player: made (obj) then return end

	 self: remove ()
	 spieler.gold spieler.gold + 1 =
	 love.audio.play (Gold Sound)
 end 

Ok. A collectible object is now no real script technical challenge. But how about something more complicated?

  1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
  "Isolator" , Moving ) Insulator = Class ("insulator", Moving)

 love.graphics.newImage ( "images/isolator-0.png" ) , 16 , 12 , 0.1 , 0 ) Isolator Image = love.graphics.newAnimation (love.graphics.newImage ("images/isolator-0.png"), 16, 12, 0.1, 0)
 , 6 ) Isolator Image: setCenter (8, 6)

 x, y, params ) insulator function: init (x, y, params)
	 self.super: init (x, y)

	 self.ani = insulator Image

	 self.speed = spieler.speed
 end

 obj ) insulator function: canEnter (obj)
	 local dx, dy

	 - Can be entered by the player only
	 obj ) then return false end if not player: made (obj) then return false end

	 - Insulator moves already,
	 - We can not enter it, or its direction to go in
	 - As we walk through it otherwise

	 then return false end if: self isMoving () then return false end

	 dx = self.X - obj.x
	 dy = self.y - obj.y

	 dx, dy ) return: self canMoveTo (dx, dy)
 end

 dx, dy ) insulator function: canMoveTo (dx, dy)
	 Szenen:current ( ) :get ( self.x + dx, self.y + dy ) local field = scenes: current (): get (self.X + dx, self.y + dy)

	 0 then # if field == 0 then 
		 16 , dy * 12 ) self: setTarget (dx * 16 * dy 12)
		 return true 
	 end

	 ( feld ) do for i, s in pairs (field) do
		 e.obj ) and not Barbwire:made ( e.obj ) then if not Insulator: Made (e.obj) and not Barbwire: made (e.obj) then
			 return false
		 else
			 dx, dy ) then if e.obj: canMoveTo (dx) then dy
				 16 , dy * 12 ) self: setTarget (dx * 16 * dy 12)
				 return true
			 end
		 end
	 end

	 return false
 end 

Another side benefit is the ability now to have several items on the same field. When one enters a scene for the first time, is usually only one object in a field. But who has played Game of Robot already know that some of the time has come to clean out his inventory. Tada! What could be better than anything that is not needed at the moment, just to lay in a heap? And when it is needed again, simply run on the field and automagically you collect everything.

Unfortunately I can not really happy about my little "achievement" because it cost frames: (The intro with just under 1000 of 60 FPS on walls is just dropped below 50th in the scenes it holds still at borders ( 300-400 objects) but once you push them around the insulators, can you disappear again up to 10 frames.

Still have one or the other idea how I can limit the loss. But in the long run, I would be better looking for something a performant solution. What complicates but by no means the Quick central scripts of the objects ...

Now I would like but not worry about it, and had me thinking of the GUI to GORC widment. Finally, the game would be the menus, message boxes, and above all the inventory. We'll see, the night has only just started xD

January 22nd, 2009


Translator

Pages

Last articles

Categories

Archives

Meta


Page optimized by WP minify WordPress Plugin