Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - doimus

Pages: [1] 2 3
1
Off Topic / GrafX2 - the ultimate pixel editor
« on: 2013-Mar-03 »
I know people around here like to hear about latest developments on the cutting edge of pixelart technology  =D, so here's some good news..

I've been using GrafX2 on and off in the past, but then I got ProMotion license and kind of forgot about grafx as it lacked quite a few features that ProMotion had. ProMotion is/was the cutting edge pixelart editor, but commercial and windows only.

Few days ago I decided to catch up on old grafx2 and... lo and behold, was I in for a pleasant surprise! :good:
That little piece of software has all grown up, received support for layers, animation, lua scripting, palette editing, tilemap editing, lots of grat, GREAT stuff!

I guess from these few hours trying it out, it probably has about 95% features of ProMotion with some improvements as well! Namely the interface, oh how much I love that DeluxePaint Amiga/DOS style interface! We really lost some of that sleeky-ness when we started using windows-based apps.

If you have even remote interest in pixel art, or just love retro inspired software, I urge you to try it out!
Did I mention it's open source and runs on any imaginable platform?
Go! NAOW! http://code.google.com/p/grafx2/

2
Ok, I'm doing some test on a low res game with huge levels where I need pixel precision data. Actual screen is 256x192 but levels themselves can be huge and i want to have binary (true/false) info on every pixel.

So I tried with GLB arrays and when using int# the biggest (5000x5000) array is taking whopping  200mb ram! Which is a massive overkill for my needs. That array size is an overkill too tbh, but I just amped it up to test mem usage.

Is there a way to DIM the array as boolean only? I tried to inline a _bool type array but my inline jedi skills are pathetic to say the least.


Also, related to this, what is a proper procedure to save huge amounts of data? If I just loop through the array and SAVEBYTE each element, it takes ages to save it. It seems much longer than it usually takes to save a file of that size.

3
I usually keep my code organized by putting all constants and global definitions in separate SUBs. It kind of makes sense to me to have all related global stuff in one place (in this example type definition and array declaration).

Code: GLBasic [Select]
GOSUB DefineConstants
GOSUB DefineGlobals

WHILE TRUE
        MyFunction()
SHOWSCREEN
WEND


SUB DefineConstants:
        CONSTANT ARRSIZE= 100
ENDSUB

SUB DefineGlobals:
        TYPE TArray
                x;y;z
        ENDTYPE
        GLOBAL  gArr[] AS TArray
        DIM     gArr[ARRSIZE]
ENDSUB

FUNCTION MyFunction:
        // do stuff
ENDFUNCTION

That way, once I'm done with that stuff I can collapse the subs in editor, or even move them to different file, cleaning up the main source file. And since I don't use subs for any other calls, it's very easy to get back to these definitions for modifications, etc.

But GLB compiler puts up a warning for every global variable that's defined in such way as "warning : variable already exists ".
It's not much of a big deal, but when there are lots of those warnings, it's possible to miss some other warning...

4
GLBasic - en / How do you implement UNDO?
« on: 2012-Feb-28 »
I'm trying to wrap my head around this, but I'm kind of lost.
What's the proper way of adding an undo function to an app?

I'm trying to make a simple pixel editor and undo is one of the essential functions such an app should have. But how?
I guess putting all the commands/actions into an array is given. But then what? How do you actually do stuff "in reverse"?

For example, if you paint a white pixel black and then undo it: how do you know that pixel was white before you painted it black?
Or if you draw some complex shape over multiple pixels which can all be of different values...

5
Off Topic / C64anabalt
« on: 2012-Jan-11 »
Well, indie game Canabalt was ported to C64 and is available as commercial boxed cartridge and as a free download.
Now, how cool is that!?  30 years on, the old C64 is still rocking. :good:


cart: http://www.rgcd.co.uk/2012/01/c64anabalt-cartridge-available-c64.html

downloads: http://www.rgcd.co.uk/2011/12/c64anabalt-c64-2011.html

6
Off Topic / My New Year resolution is ...
« on: 2012-Jan-01 »
... 320x240.

What's yours?

7
GLBasic - en / How to make a text parser?
« on: 2011-Dec-22 »
I've been playing lots of old-school adventures (again!) - Sierra's "quest"classics: Space, Police, King's Quest and LS Larry. You know, these games with 160x200 resolution and text input.

First thing I noticed is that these games are mostly tedious crap, gameplay-wise, besides Larry, who is still funny as sh!t.
Second thing I noticed is that I want to make a game exactly like this, only mine will be MUCH BETTER(TM).

So I am wondering, what is a proper way to implement text parser in game?

I guess I will use INSTR$ to search for "tokens" or "verbs" in user input. Then the "nouns". Then I'll probably need a list of synonyms to check against. Then it sends a final "command" to the game.

What I would like to know if there are resources online that go into more detail on this topic. Stuff like checking for errors in spelling, or "words inside words" - like "pick" is not the same as "pickaxe", or whatever else...

It would be nice to do this slightly more advanced than those old adventures, which gave annoying errors for almost any combination of words that's not exactly like the one authors envisioned. Something more "interactive-fiction" like. 
Something that will allow people to experiment more, like this....  =D

<a href="http://www.youtube.com/watch?v=vBzHedBIbZQ" target="_blank">http://www.youtube.com/watch?v=vBzHedBIbZQ</a>



8
Math / Point inside polygon
« on: 2011-Oct-09 »
Here's some code that finds whether a particular point is inside a polygon.
Actual routine is not mine, I've found the C code online (http://www.visibone.com/inpoly/inpoly.c) and translated it into GLB.

It's great for implementing various regions, zones, collision or whatever else into your programs.
Code is pure math, it has nothing to do with graphical polygons (no acceleration) but it supports all kinds of mad polygonal shapes.


Code: GLBasic [Select]
SYSTEMPOINTER TRUE

//create polygon
LOCAL poly[]
DIM poly[RND(3)+3][2]

FOR i = 0 TO BOUNDS(poly[], 0) - 1
        poly[i][0] = RND(640)
        poly[i][1] = RND(480)
NEXT


// main loop
WHILE TRUE

        LOCAL mx,my,mba,mbb
        MOUSESTATE mx, my, mba, mbb

        drawPoly(poly[])
       
        IF inPoly(poly[], mx, my)
                PRINT "Inside!",0,0
        ENDIF
       
        SHOWSCREEN

WEND



FUNCTION inPoly: poly[], tx, ty

        LOCAL newx, newy, oldx, oldy
        LOCAL x1, y1, x2, y2
        LOCAL inside
       
        LOCAL npoints = BOUNDS(poly[], 0)
       
        IF npoints < 3 THEN RETURN 0
       
        oldx = poly[npoints - 1][0]
        oldy = poly[npoints - 1][1]
       
        FOR i = 0 TO npoints - 1
               
                newx = poly[i][0]
                newy = poly[i][1]
               
                IF newx > oldx
                       
                        x1 = oldx
                        x2 = newx
                        y1 = oldy
                        y2 = newy
               
                ELSE
                       
                        x1 = newx
                        x2 = oldx
                        y1 = newy
                        y2 = oldy
               
                ENDIF
               
               
                IF ((newx < tx) = (tx <= oldx) AND (ty-y1)*(x2-x1) < (y2-y1)*(tx-x1))
                       
                        inside = NOT inside
               
                ENDIF
               
                oldx = newx
                oldy = newy
       
        NEXT

        RETURN inside
       
ENDFUNCTION



FUNCTION drawPoly: poly[]

        LOCAL npoints = BOUNDS(poly[], 0)
       
        FOR i = 0 TO npoints-2
                DRAWLINE poly[i][0],poly[i][1], poly[i+1][0],poly[i+1][1], RGB(200,200,200)
        NEXT

        DRAWLINE poly[-1][0],poly[-1][1], poly[0][0],poly[0][1], RGB(200,200,200)
       
ENDFUNCTION

9
GLBasic - en / FINDPATH problem
« on: 2011-Sep-23 »
I'm not sure whether this is a bug, feature, or (most likely) I'm doing something wrong, but I have a problem with FINDPATH routine.

I'm trying to get a "character" to move across map towards target via the shortest possible route.
No matter what I do, I always get movement that is totally perpendicular.
For example, if I have a clear map without obstacles and with same movement cost for all fields, "character" will move first horizontally along x-axis and then descend down on y-axis towards the target in a perfect, L-shaped path (that's obviously not the shortest).
If I add some random blocks and terrain costs to the map, it still follows this same angular path, but it's kind of masked by the pathfinding heuristics.

Here's the code:
Code: GLBasic [Select]
// change these variables for different map layouts

LOCAL mapIsFlat         = TRUE   // true = all fields on map have same passage value
LOCAL heuristics        = 0.0            // 0 = shortest route , 1 = cheapest route
LOCAL mapBlockValue = 0          // percentage of blocked map fields, 0 = clear map



GLOBAL walkpath[]
GLOBAL map[]


makeMap(300, 300, mapBlockValue, mapIsFlat)

calculatePath(heuristics)

WHILE TRUE

        walk()

        SLEEP 20
        SHOWSCREEN

WEND


FUNCTION walk:

        // draw map
        DRAWSPRITE 0,0,0

        STATIC currentStep
        LOCAL maxStep

        STATIC currentx
        STATIC currenty

        PRINT "step: " + currentStep + "  x: " + currentx + "  y: " + currenty ,0,0

        maxStep = BOUNDS(walkpath[], 0) - 1

        currentx = walkpath[currentStep][0]
        currenty = walkpath[currentStep][1]
       
        // draw path
        FOR i = 0 TO maxStep - 1
                SETPIXEL walkpath[i][0], walkpath[i][1], RGB(0,0,90)
        NEXT

        // draw character
        SETPIXEL currentx, currenty, RGB(0,255,0)                      
       
        //draw target  
        SETPIXEL walkpath[-1][0], walkpath[-1][1], RGB(255,0,0)

        INC currentStep, 1
        IF currentStep = maxStep THEN currentStep = 0


ENDFUNCTION



FUNCTION calculatePath: heuristics


        LOCAL startx, starty, targetx, targety

        startx = 10
        starty = 10
        targetx = BOUNDS(map[], 0) - 20
        targety = BOUNDS(map[], 1) - 20

        LOCAL ok = FINDPATH(map[], walkpath[], heuristics, startx, starty, targetx, targety)

        IF ok = FALSE

                PRINT "Path NOT found!", 10,10
                SHOWSCREEN
                KEYWAIT
                END

        ENDIF


ENDFUNCTION


FUNCTION makeMap: x, y, blocked, mapIsFlat


        DIM map[x][y]

        FOR i = 0 TO x - 1
                FOR j = 0 TO y -1

                        LOCAL r = RND(100) + 1

                        IF mapIsFlat = TRUE
                                IF r > blocked THEN map[i][j] = 1
                        ELSE
                                IF r > blocked THEN map[i][j] = RND(10) + 1
                        ENDIF
                NEXT
        NEXT


        FOR i = 0 TO x - 1
                FOR j = 0 TO y - 1
                        IF map[i][j] > 0.1
                                        LOCAL col = 32 + (map[i][j])
                                        SETPIXEL i, j, RGB(col,col,col)
                        ENDIF
                NEXT
        NEXT

        GRABSPRITE 0, 0,0, x,y

ENDFUNCTION

 

10
Sprite Something

http://www.youtube.com/v/4_ZBI7KSI0M

Finally, !!FINALLY!! a proper mobile pixel drawing app exists!  :happy:
Oh my, this changes my attitude towards iPad for 180 degrees. It's the definition of killer app as far as I'm concerned.

I have ProMotion license, but it's a 100% desktop app, with not-so-friendly interface (very 90s in philosophy).
Even if I had a touchscreen PC, desktops app generally suck on it.

And all the pixel apps I tried for iPhone are more or less useless. But this... this is just wonderful.

11
I'm trying to make a framework for point'n'click adventure games, like the old classics from Lucas Arts. Just like Monkey Island, Indiana Jones, Day Of The Tentacle, etc.

Structure of these games revolves around "Rooms" (locations, what you walk around) and "Objects" (stuff you interact with, like items that you can pick up and characters you can talk to).
I'm wandering what is the best way to organize this?

My current plan is to use arrays that store all objects and all characters in the game. Let's call them "game arrays".
There really isn't much raw data to store in these anyway. Let's say that I could have up to 50 rooms with about 20 objects max. per room - that's array[1000]. Not that big.
These "game arrays" are useful as they provide instant game-save feature. Write them to file and you're done.

Code: GLBasic [Select]
TYPE TObject
        roomNr
        positionX
        positionY
        sprite[] as TSprite
        sound[] as TSound
        //..... other stuff
ENDTYPE

LOCAL gameObject[] as TObject
LOCAL gameCharacter[] as TCharacter

gameObject[34].roomNr = 12
gameCharacter[23].roomNr = 12
 

When the player enters certain room, all relevant "game" objects will be copied into "Room" array for easier handling, sorting and drawing. At this time, all graphics and sound is loaded as well. "Game array" just stores references to files, etc.

Code: GLBasic [Select]
LOCAL object[] AS TObject  // this is the "Room" array
FOREACH n IN gameObject[]
        IF n.roomNr = currentRoom
                DIMPUSH object[], n
        ENDIF
NEXT

FOREACH n IN object[]
        // load all sprites, sounds
        // draw it on screen, do other exciting stuff
NEXT
 
Upon player exiting the Room, all data from local room array should be copied back to game array.
This is the tricky & untidy part - now I need another reference to know exactly *where* I should copy back the data.
Maybe I could use object "names" for reference:
Code: GLBasic [Select]
IF gameObject[j].name = object[i].name THEN gameObject[j] = object[i]
 

Or maybe I should store array index when copying from game to room array:
   
Code: GLBasic [Select]

gameObject[42].arrIndex = 42  // extreme potential for fcuk-up here!

DIMPUSH object[], gameObject[42]

FOREACH n IN object[]
        gameObject[n.arrIndex] = n
NEXT
       
 
This method is faster, and seems to be more sensible.

I considered putting everything into multi-dimensional array but then I could have something like:
object[currentRoom][LAMP].sound[FIRE].volume = 12
Ouch! :)
And I don't need to have all of that in memory anyway - gameObject[] could be deleted before loading graphics and sounds to free some memory.

I also considered having all Rooms in their separate files. That would make run-time loading very easy, but would complicate save-game routines.

Then again, I'm sure I'm over-complicating stuff here. Twenty-some years ago these games came on a single floppy. There must be a quick & dirty solution to this.

12
Off Topic / Exclusive line of GLB underwear!
« on: 2011-Apr-01 »
I am proud to announce something I've been working on for some time now:

Fashionable GLBasic-branded boxer shorts for self-concious indie developer!!!

Currently, I have few slightly worn-out prototypes that are available for immediate delivery for just $498.78 + postage.

Preorders for first batch of shorts start as of today, April 1st, 2011.
Estimated delivery is in two-months-from-nowTM.

Teaser image of the prototype model is enclosed.

Apply now!!!



[attachment deleted by admin]

13
GLBasic - en / Breathtaking 2D engine!
« on: 2010-Oct-27 »
Take a look at this Youtube vid. It's a bit old, but I've just run into it.  :O

<a href="http://www.youtube.com/watch?v=-Q6ISVaM5Ww" target="_blank">http://www.youtube.com/watch?v=-Q6ISVaM5Ww</a>

There's full description on Youtube page, but here's the short version.
Basically, the author is using pixel shaders and pre-rendered pixels to make a REAL 3D world on a 2D projection. Everything on screen is made of 2D cut-outs, but it acts like real 3D objects.Ever seen real-time lighting, HDR, bloom, daylight changes and weather effects in a 2D game?

It's kind of difficult to explain in words, but method is ingeniously simple, just watch the vid.
This is THE stuff I dream of. THE perfect 2D engine, as author himself rightfully calls it, "better than Baldur's Gate 2".

Gernot, streamline something like this into GLB and I'll wash your car for a year.

14
GLBasic - en / Mac App Store
« on: 2010-Oct-20 »
Not iPhone, but full-size Mac store is starting soon. Might get interesting. Mac gaming is probably going to skyrocket in popularity.

http://www.apple.com/mac/app-store/

Oh, and one more thing: now we can finally make (and maybe even sell) games that use mouse and keyboard input! Yay!  :P


15
I have switched to Mac as my main development machine and I would like to have GLB in a VirtualBox partition.
Installing full Win XP for a few programs seems like an overkill to me ( I already have Bootcamp XP partition for games etc.) so I was thinking about installing an old copy of Win98SE in VirtualBox and running GLB off that. Will it work?

I'm mainly concerned if VirtualBox supports file/network sharing between OSX and Win98.

Pages: [1] 2 3