putting the coast together

Discussion in 'Modding and Scripting Support' started by foobie42, Oct 8, 2011.

Remove all ads!
Support Terra-Arcanum:

GOG.com

PayPal - The safer, easier way to pay online!
  1. foobie42

    foobie42 New Member

    Messages:
    20
    Likes Received:
    0
    Joined:
    Sep 19, 2011
    There are several tilesets making up the coast area:

    Code:
    {8}{sw1/n 0} Shallow Water 1
    {9}{sw2/s/n 4} /s Shallow Water 2
    {10}{sw3/s/n 4} /s Shallow Water 3
    {11}{swr/s/n 4} /s Shallow Water
    {12}{dwr/f/n 4} /f Deep Water
    
    (also drtsw)
    But how to put it all together (i.e. in what order) to make up a coast area?

    Could you show me a sample 2d array of tiles that make up a coast without any jagged edges please?

    -sh
     
  2. Crypton

    Crypton Member

    Messages:
    589
    Likes Received:
    2
    Joined:
    May 22, 2008
    Honestly, I don't have a clue, but you can try to ask Radzh, since he's the one who made his own version of WorldEd for the Arcanum: Revolution project, so I guess that he has it figured out already.

    Also, AFAIR, this topic was also discussed at ArcanumClub.ru community, so try to search there.

    Here's a link: http://forums.arcanumclub.ru/index.php?showforum=152

    P.S. Btw, they are already aware of your project, so getting some help there shouldn't be hard. Link: http://forums.arcanumclub.ru/index.php? ... 30&p=91027
     
  3. foobie42

    foobie42 New Member

    Messages:
    20
    Likes Received:
    0
    Joined:
    Sep 19, 2011
  4. Crypton

    Crypton Member

    Messages:
    589
    Likes Received:
    2
    Joined:
    May 22, 2008
    Looks like a good start, but do you have a bigger chunk to show?;)
     
  5. foobie42

    foobie42 New Member

    Messages:
    20
    Likes Received:
    0
    Joined:
    Sep 19, 2011
    I'll have a bigger chunk when I code it to a game. Which I hope to accomplish today :)

    Plan to do the same for all directions, i.e. rotate it either horizontally, vertically, or both. Consider this code:

    Code:
                                    Tuple<string> elt = RandomElt(SideDiagonal, r);
                                    art = elt.Item1;
                                    flip = elt.Item2 ^ (directions.Contains(Direction.SouthWest) ? Flip.Horizontally : Flip.Vertically);
    Providing that a tile is mirrorable on both tiles (corners aren't, "sides" are), this code will work except for minor mistakes such as rocks being visible upside down or horizontally. With which I can do nothing, as there are no NW and N versions of the tiles.
     
  6. Crypton

    Crypton Member

    Messages:
    589
    Likes Received:
    2
    Joined:
    May 22, 2008
    Actually, many of the tiles are flippable, and the original engine knows which tiles are flippable and which not, so it doesn't need the flipped version, since it can be flipped easily on the fly, when rendering.

    In the tile message file ("art/tile/tilename.mes"), there are specified ranges, which determines which tile is outdoor/indoor and non-/flippable, so you should use this info when generating new terrain.

    There is also "tilevariant.dat" file, and I think that it contains the info about the transitions and other stuff, but it's a binary file.
     
  7. foobie42

    foobie42 New Member

    Messages:
    20
    Likes Received:
    0
    Joined:
    Sep 19, 2011
  8. Crypton

    Crypton Member

    Messages:
    589
    Likes Received:
    2
    Joined:
    May 22, 2008
    Hello,

    How are you doing? Still working on your project?:)
     
  9. foobie42

    foobie42 New Member

    Messages:
    20
    Likes Received:
    0
    Joined:
    Sep 19, 2011
    After a long hiatus, yes.

    I found another guy who's interested in a single-player RPG that's like the golden age's nineties ones.

    Just rewrote the code in F#, just over 350 lines to parse Arcanum graphics and cache them efficiently.

    I'm using MonoGame now which is like XNA.

    Sorry to hear about your dog. How are you doing?

    I'll use Arcanum textures as placeholders until proper graphics are made. The dude I know did art back in 2004 and can make some sprites.

    If you're interested in the code I can put the repo somewhere public.
     
  10. Crypton

    Crypton Member

    Messages:
    589
    Likes Received:
    2
    Joined:
    May 22, 2008
    Oh hey, thanks for the reply!

    That's pretty awesome news, I'm glad that you didn't gave up. Hmm, so you're using F# for the whole game? MonoGame seems like a wise choice, much wiser than using XNA, which is already obsolete.

    It would be really great to get access to the repository, but it can wait, until you manage to clone the previous version completely.

    I wish you good luck, and please keep up the good work and keep us updated.

    P.S. I'm better now, it's been 2 months since my dog passed away. Still miss her a lot though... Thanks for asking.
     
  11. foobie42

    foobie42 New Member

    Messages:
    20
    Likes Received:
    0
    Joined:
    Sep 19, 2011
    http://arma.misaki.pl/listing.php?repname=divided - websvn
    http://arma.misaki.pl/svn/divided/ - clone url

    Sorry about SVN, but TortoiseGit is a piece of garbage.

    So far I (re)wrote:

    - the DAT loader
    - the animation loader
    - the cache circular-buffer structure, now optimized to be just one int on the heap (+ object overhead, aka runtime type information)
    - hacked monogame not to cons (allocate on the heap) in the rendering loop, see http://monogame.codeplex.com/workitem/6844
    - transparency mask bit array for clicking on sprites
    - beginnings of the map editor

    I have big plans for the map editor, actually.I missed the ability to hover the mouse with a selected texture to actually display it. Old 'favorites' menu will appear after it's written. As well as common operations such as undo, showing the grid etc.

    As for the game, I have plans for a scripting language that allows serialization of everything, including closures and functions compiled at runtime. This comes with a performance cost, but who cares. I need that for my game AI. Also will come with coroutines for easy, declarative writing of NPC routines.

    I also plan to finish my game GUI. Check out foobie42's channel on youtube to know what I mean. If you ever used a spreadsheet, that's the idea - dependent 'cells' refreshing when one of their referenced cells changes its value. It's not something I made up, but it was successfully used in several Common Lisp projects. Now I made it with nice syntax in F#.

    As for the GUI, it doesn't have any controls aside from a vbox/hbox (logical layout, no per-pixel stuff like Windows Forms) and a button. However, mouse input is properly routed. I don't remember how's keyboard input however, and it's missing all basic controls, doesn't even have an input box which is painful, but will be done after the game is in a more advanced stage of development.

    It will of course be ISC-licensed as all of my code.

    Also I plan to have an asynchronous art asset loader. It's much more heavy-handed now, caching all frame in all direcitons at once to avoid per-frame delay e.g. for running animations which was quite visible.

    I'm glad you're feeling better :)

    Got any IM?
     
  12. foobie42

    foobie42 New Member

    Messages:
    20
    Likes Received:
    0
    Joined:
    Sep 19, 2011
    Today I implemented beginnings of the map editor.

    - Stuffing Arcanum .art files into a WritableBitmap in WPF
    - Refreshing the preview window
    - Palette selector
    - The overall layout of the editor

    Forgot to add the palette number (2 * 3 bits) to the Tile class. So I will unify the Passability enum and palette numbers into one uint16. Fits just right. :)

    Also, now decided that the editor will edit 3 cells at a time, so that 'connections' between cells can be easily made. It'll probably work on a 'database' (just a directory full of XML files though!) instead of arbitrary files.

    Hope this gets somewhere.
     
  13. Crypton

    Crypton Member

    Messages:
    589
    Likes Received:
    2
    Joined:
    May 22, 2008
    I just checked the source, and I'm quite impressed. The F# is pretty new to me (what a funny syntax!), though I was able to understand the code.

    Could you please sometimes upload to the repository a compiled version as well? I've noticed that you've uploaded the binaries in earlier revisions, but it's missing in the newer ones.

    Btw, do you have any TODO list, or some dedicated webpage, like the one from your previous project?


    That's pretty awesome! Buy why don't you just stick with good old Lua, or javascript? You can bind your de/serialization routines to the scripting language, right?

    Oh yeah, I've checked that. Including that head tracking thingy, which is also great.

    That's the way! Almost every resource should be preloaded in the background. I also load almost everything asynchronously in the OpenArcanum, using a work queue. These days such feature is necessity, as you can't just show the player black loading screen with "Loading. Please wait..." label in the middle (well you can, but it's just lame :D ).

    For example, when you're about to enter the Bates mansion in Arcanum, the game should already start preloading the map when you're approaching the doors, so it can shorten the transition time between the maps. Also there should be some nice screen effect for the map transition, like fade in & out.

    Huh, why do you need so many bits for palette index? There can be max of 4 palettes in each .art file, right? So only 2 bits should be necessary. :thumbup:

    Anyway, good luck! :)
     
  14. foobie42

    foobie42 New Member

    Messages:
    20
    Likes Received:
    0
    Joined:
    Sep 19, 2011
    > Could you please sometimes upload to the repository a compiled
    > version as well? I've noticed that you've uploaded the binaries in earlier
    > revisions, but it's missing in the newer ones.

    I will after I'm done with the current coding session. The first thing to do today is to fix the pixel -> tile function in WorldUtil. I even know how to do it already.

    Also I noticed that reloading the map every time pixel position changes is awfully slow. :( I'll try to minimize the load somehow. IIRC tried that during last coding session, but almost fell asleep on the keyboard.

    > Btw, do you have any TODO list, or some dedicated webpage, like the
    > one from your previous project?

    Not yet, no. Need to do some basic stuff first. There isn't even a working editor. Maybe later I'll do a roadmap.

    > That's the way! Almost every resource should be preloaded in the background.

    Hmm. The way I do it now, loading assets is blazingly fast anyway. When I did the coast thing, scrolling didn't result in visible delays. Also I have doubts whether showing empty space instead of a sprite is really good. Also, every access in every frame will slow down if I add locking. Perhaps I should use volatile? It's a single word anyway. Hmm...


    > For example, when you're about to enter the Bates mansion in
    > Arcanum, the game should already start preloading the map when
    > you're approaching the doors, so it can shorten the transition time
    > between the maps. Also there should be some nice screen effect for the
    > map transition, like fade in & out.

    Now I'm going to surprise you. There will be no transition. Everything will be one single map. I have a good scheme for doing it as you can see in the source code.

    As for floors, I'll shift the player by a number of tiles upward/downward.

    Don't know yet how to express it in terms of data structures, though, but we'll come to that.

    > uh, why do you need so many bits for palette index? There can be max
    > of 4 palettes in each .art file, right? So only 2 bits should be necessary

    Yes. I was sleepy :)

    > That's pretty awesome! Buy why don't you just stick with good old Lua,
    > or javascript? You can bind your de/serialization routines to the scripting
    > language, right?

    I can't serialize closures in Lua/JS.
     
  15. Crypton

    Crypton Member

    Messages:
    589
    Likes Received:
    2
    Joined:
    May 22, 2008
    But you're currently loading only the terrain and tile sprites, right? When you start loading a complete map, including all entities, it will slow down the game dramatically. Also don't forget that one sector can take 5+ seconds to load. Especially, if it's full of entities, like those in Tarant. So you can't do all the asset loading in a main thread, I guess.

    About the volatile qualifier, sure you may use it, but don't forget to access the variable only through atomic functions (if something like that even exists in F#).

    It's surely possible, look at this library: http://luaforge.net/projects/pluto/ or this one http://code.google.com/p/corsix-th/wiki/Persistance

    Apparently, it's even possible to achieve without using any special library in newer versions of Lua. :)
     
  16. foobie42

    foobie42 New Member

    Messages:
    20
    Likes Received:
    0
    Joined:
    Sep 19, 2011
    > About the volatile qualifier, sure you may use it, but don't forget to access
    > the variable only through atomic functions (if something like that even
    > exists in F#).

    Caching is disabled automatically for volatile fields. Also, for word-sized objects and less, every volatile access is atomic.

    > Also don't forget that one sector can take 5+ seconds to load.

    In my engine, every cell is 25 (was 50) tiles in size. 3 cells are loaded at a time. That makes 75x75 tiles to load at a time.

    Lua closure serialization seems amazing. Thank you very much for the link! I'd spend days, no, weeks, writing a buggy and slow Scheme in F#! Thank you!

    In other news, I committed a background loader. It's a big hack (see Monitor.TryEnter comment). I don't like this deadlock. But with crappy WPF there's no non-even-bigger-hack way to prevent BeginInvoke() from having to be called.

    Update: the other person on the "team" says F# can serialize function bodies. We'll research in spare time.

    TODO: Placing tiles/roofs/walls on the cell, saving and reloading the cell.
     
  17. Crypton

    Crypton Member

    Messages:
    589
    Likes Received:
    2
    Joined:
    May 22, 2008
    Are you sure? :) So why those atomic functions even exists? They all are for word-sized (and less) data types (i.e. char, short, int, long, and even a pointer). And what about the instruction reordering?

    Source: http://software.intel.com/en-us/blogs/2 ... ogramming/

    Edit: Whoops, I forgot that you're using F#, which does things quite differently:
    Source: http://www.codeproject.com/Articles/107 ... in-F-and-C

    No problem, I'm happy to help. :D

    That's really interesting. :) But the reason why I've mentioned the Lua, is that it's a great and popular scripting language, and it's syntax is probably easier for beginners to learn. There is also a great chance that the players or modders would already know at least the basics of writing Lua scripts from other games.

    Just saying. I know that you already know these facts. :thumbup:

    Edit2: I just checked the svn repository. Thanks for the binaries! I'm going to test it as soon as I install that new .net framework, and other prerequisites.
     
  18. foobie42

    foobie42 New Member

    Messages:
    20
    Likes Received:
    0
    Joined:
    Sep 19, 2011
    For now, volatile fields aren't used, since I found a workaround. Namely, Dispatcher.Invoke() has to be used when instantiating the WriteableBitmap() anyway so I don't need any locking.

    Time to do some work on the editor. Hopefully my depression doesn't get in the way of doing stuff on the game. I already don't have any energy on paid work :(

    Edit:

    Added some basic support for putting tiles onto the "canvas" by left-clicking.

    Next thing to do is saving and loading cells. After that, some keybindings for setting passability of tiles. Also, right click for clearing the tile of any contents.

    Also my deadlock prevention suffered from some braino. It's all good now though, no more Invoke() in the cache thingy.

    Further edit:

    Serialization and deserialization of cells now works.

    'Show grid' now works.
     
  19. foobie42

    foobie42 New Member

    Messages:
    20
    Likes Received:
    0
    Joined:
    Sep 19, 2011
    Artist bailed out :(

    I'm on my own now. Don't know if I can make it.
     
  20. foobie42

    foobie42 New Member

    Messages:
    20
    Likes Received:
    0
    Joined:
    Sep 19, 2011
    In the past few days I learned the basics of making 2D and 3D graphics.

    Now I have a question - how to save a tile in BMP format as an .art file? BMP2ART spews out 'BMP file not found' and that's it.
     
Our Host!