ID:1520720
 
I am trying a pretty minimalist approach to this small project I had in mind. I'm pretty much not trying to overhaul the code with OO like I am used to. The on-screen stuff is pretty much just a 3D list of image objects (3 layers of 32x24 each) which contain small 10x10 (or larger if needed) icons. Since maptext and atom.transform is a thing, this means that I can do whatever is needed to these small icons to suit my needs, including offsets and scaling.

Calling the "painting" commands is pretty simple. In this example:
// Window = (X,Y,Z,L,W)
// Text = (X,Y,Z,T,PX,PY)
// Meter = (X,Y,Z,V,VM,PX,PY)
// Plot = (X,Y,Z,S,I,PX,PY)
// X,Y,Z = Coordinates on the hud grid
// T = Text given (maptext)
// V,VM = value / value max (2 pts = 1 cell)
// S,I = state and (optional) icon
// PX,PY = pixel offsets
HUD_Window(1,1,1,12,3)
HUD_Window(13,1,1,12,3)
HUD_Window(25,1,1,8,3)
HUD_Text(2,3,2,"LP: 20 / 20")
HUD_Meter(1,1,2,20,20,10,5)
HUD_Text(14,3,2,"AP: 20 / 20")
HUD_Meter(13,1,2,20,20,10,5,2)
HUD_Plot(26,2,2,"gold",IMG_ICONS20,-5,-5)
HUD_Text(28,3,2,"Gold:")
HUD_Text(28,2,2,"999999")


I just realized LP is in Lemons. AP is in Limes.
LOL, at LP Lemons and AP is in Limes. But other then that I really like the look of the game reminds me a lot of those old SNES RPG games I love.
The 16-bit era was one of my favorites. I like to keep that sort of style in many of my projects.
I decided to improve on the idea and create a very flexible HUD system which has its own module and commands. It changes the icon states of the images in the HUD. The HUD is a grid-like array of images, and I decided to import my own DMI font for use with it too, instead of using maptext.

All other commands besides Plot() use Plot() as its main rendering. Plot() has safety checks in case you want to access a HUD cell that is beyond the array size.

HUD.Rect(src,1,1,1,32,24,1,"cell")
HUD.Window(src,1,1,2,10,5)
HUD.Print(src,2,4,3,"Command?")
HUD.Plot(src,2,3,3,"cursor")
HUD.Print(src,4,3,3,"YES")
HUD.Print(src,4,2,3,"NO")




The wonderous path of image objects. Everything you see above is composed of only image objects. This is great. Not only am I no longer tied to the map in any specific way (except that every atom is piled into (1,1,1), I can manage who sees what. This means that cameras can check different mapscreens at a whim, and I can define however many mapscreens I wish. I decided not to use scrolling, much like I did in previous projects.
In response to Makeii
Yeah, that's image objects for you...
Saving the player data (or a Playersheet bound to the client) is also pretty simple. Since most data can have a specific length in character size, I decided to ensure that the data is fit into specific widths in the file:
        SavePlayersheet(client/C)
fdel ("files/[C.ckey]/playersheets/[C.playersheet.id]")
var/f = file("files/[C.ckey]/playersheets/[C.playersheet.id]")
var/s = ""
var/playersheet/p = C.playersheet
s += Function.PadText(p.name,12)
s += Function.PadText(p.class,2)
s += Function.PadText(p.lp,3)
s += Function.PadText(p.lp_max,3)
s += Function.PadText(p.ap,3)
s += Function.PadText(p.ap_max,3)
s += Function.PadText(p.str,2)
s += Function.PadText(p.mnd,2)
s += Function.PadText(p.dex,2)
s += Function.PadText(p.arm,2)
s += Function.PadText(p.gold,6)
s += Function.PadText(p.gold_bank,8)
f << s

LoadPlayersheet(client/C,I="")
var/s = file2text("files/[C.ckey]/playersheets/[I]")
var/playersheet/u = new
var/d = 1
u.name = copytext(s,d,d+12); d += 12
u.class = text2num(copytext(s,d,d+2)); d += 2
u.lp = text2num(copytext(s,d,d+3)); d += 3
u.lp_max = text2num(copytext(s,d,d+3)); d += 3
u.ap = text2num(copytext(s,d,d+3)); d += 3
u.ap_max = text2num(copytext(s,d,d+3)); d += 3
u.str = text2num(copytext(s,d,d+2)); d += 2
u.mnd = text2num(copytext(s,d,d+2)); d += 2
u.dex = text2num(copytext(s,d,d+2)); d += 2
u.arm = text2num(copytext(s,d,d+2)); d += 2
u.gold = text2num(copytext(s,d,d+6)); d += 6
u.gold_bank = text2num(copytext(s,d,d+8)); d += 8
C.playersheet = u


The output for a sample playersheet is:
      NoName 0  6  6  6  6 1 1 1 1     0       0
Ugh, it appears BYOND doesn't like me using this many image objects. I'm having a lot of CPU lag. This is disappointing. I sort of thought something like this would happen, but it didn't hurt to try. I guess I'll use /objs for the map, and /image objects for the HUD, and allocate Z levels for each map screen. I can still utilize mapscreens though. More experimentation needs to be done.
I decided to restart the project, and I think this time I've got a better grasp of what I want in this project. I've limited the HUD layers to only 2 instead of 4, and the mapscreen's layers to 3 instead of 4. This eases the stress on BYOND by eliminating 2304 objects on screen, leaving 3840 instead of 6144.

To further make things a little better for the engine, FPS was lowered to 20 instead of 30, and all animations are based off of intervals of 0.5 for delays (0.5 is 1/20ths of a second, a perfect factor of world.fps).

I'll see this project up and running in a few weeks. I'm excited to show it off when I get a stable alpha running. What are some good examples for Cash Shop items? (the game is using credits, so I wanted that to be its primary use)

$5.00 gives 1,000 credits, which could be used for something like:
  • 50,000 Gold (700 Credits)
  • 25,000 Gold (500 Credits)
  • 10,000 Gold (300 Credits)
  • 5,000 Gold (150 Credits)
  • Starter Kit (300 Credits)
  • Home Point (500 Credits)
  • Guild Tablet (750 Credits)
  • Goodie Bag - random items (400 Credits)
  • Various Overcoats / Cosmetics (??? Credits)
This small post is about the addition of HUD datums which hold data according to their type. Then, when prompted, they Draw() to the client's HUD grid. Since the HUD for a client is already full of a grid of image objects, all the HUD datum needs to do is send the appropriate data to the grid to change the states.

The following code is an example of a cursor on the HUD grid.



hudobject

var
tile_x = 1
tile_y = 1
tile_z = 1
hud_type = HUD_GRID
var_length = 0
list_variables = new/list(0)

Update()

Key_Press(N, client/C)
C.HUD_Plot(tile_x + (list_variables[1]*list_variables[3]) - 2,\
tile_y + (list_variables[2]*list_variables[4]) - 2, tile_z, null, IMG_HUD10)

if (N == KEY_UP)
if (hud_type == HUD_GRID)
list_variables[2] = Clamp(list_variables[2]+1,1,list_variables[6])

if (N == KEY_RIGHT)
if (hud_type == HUD_GRID)
list_variables[1] = Clamp(list_variables[1]+1,1,list_variables[5])

if (N == KEY_DOWN)
if (hud_type == HUD_GRID)
list_variables[2] = Clamp(list_variables[2]-1,1,list_variables[6])

if (N == KEY_LEFT)
if (hud_type == HUD_GRID)
list_variables[1] = Clamp(list_variables[1]-1,1,list_variables[5])

Draw(C)

Key_Hold(N)
Key_Release(N)

proc
Draw(client/C)
switch(hud_type)
if (HUD_GRID)
C.HUD_Plot(tile_x + (list_variables[1]*list_variables[3]) - 2,\
tile_y + (list_variables[2]*list_variables[4]) - 2, tile_z, "cursor", IMG_HUD10)

SetTile(X,Y,Z)
if (X) tile_x = X
if (Y) tile_y = Y
if (Z) tile_z = Z

SetType(N)
hud_type = N

Initialize(N,A=1,B=1,C=2,D=2,E,F)
hud_type = N
switch(hud_type)
if (HUD_GRID)
var_length = (A*B) + 6
list_variables = new/list(var_length)
list_variables[1] = 1 // cursor position x
list_variables[2] = 1 // cursor position y
list_variables[3] = C // cell spacing X
list_variables[4] = D // cell spacing Y
list_variables[5] = A // tiles x
list_variables[6] = B // tiles y
for (var/i = 1 to var_length-6)
list_variables[6+i] = 0 // grid cells (actions only)

SetVariable(N=1,V=0)
list_variables[N] = V
Are we gonna be seeing any game updates? I know these are game updates but I mean game updates if you know what I mean kinda hard to say what I mean since these mechanics are updates for your game lol.
There's no hub for it right now (well there is, but it's not being used at this moment). For now it's still too early for that.

How does this project differ from other projects I have attempted in the past? For those who might be asking if I'll drop this like I do many, many others, the answer is "much less likely." I can't guarantee I won't, and I almost did in regards to one of my posts above.

The primary drive is profits. That, and ZYNKCO (our software design business). Everything feels more professional now, and the idea of making money off of projects I make boosts the hype to complete it.

Added some path tiles. The use of 10x10 tiles (when everything is usually 20x20) makes it easier to fill in details with common tiles like these.

Some minor wooden log house tiles will shape up any sort of house I want to make.
The colours reminds me of the Sega Genesis palette.
Yeah, the Genesis was one of my favorites. I borrow the style frmo a lot of games on the Genesis too, such as Shining force, and various Treasure games.

Another graphical mockup
Page: 1 2 3