Giter Site home page Giter Site logo

ace's People

Contributors

asman2000 avatar bebbo avatar kwahu avatar luc3klmc avatar mbeijer avatar ozzyboshi avatar polluks avatar richardleggett avatar rveilleux avatar tehkain avatar timfel avatar vairn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ace's Issues

Rework ACE tools

  • general:
    • make them all with single makefile tupfile CMakeLists
    • put all the sources in src/inc dirs
  • bitmap_conv:
    • add GIF input to bitmap_conv - put frames in a single column
    • add .piskel support
    • add IFF support
  • palette_conv:
    • add output to all supported palette types
      • ACE .plt
      • ProMotion .pal
      • GIMP .gpl
      • IFF's palette chunk
    • add ACE .plt input

Add support for more targets instead hardcoded amiga defs

Right now source code have hardcoded amiga functions, or hardcoded #ifdefs to handling amiga code.
This should be reworked to a flexible handling more possible targets (like SDL).
Targets should be a whole file replacements with correct including in compile time.
Same target pattern should be followed by games.
Compile error should be rised when no target was specified.

Decide on basic code style guidelines

Since this is multi-ppl project, a decision has to be made how code should be formatted on repo. Feel free to post suggestions below - I'll edit first post as discussion progresses.

  • Decide on braces
  • Decide on tabs vs spaces
  • Decide on folding
  • Decide on prefixes
  • Decide on include guards
  • Decide on IN/OUT
  • Apply on all source files
  • Create wiki page and/or doc file

Brace omitting - not allowed

Pros:

  • shorter code
  • improved readability for some ppl (me)

Cons:

  • expanding statement to block after control expression makes line with condition being highlighted in diff, even if condition hasn't changed - this is a major reason to write braces at all times.
  • @approxit hates it for some unknown reason

Tabs vs spaces

  • @approxit likes tab sized to 4 spaces, I like 2 spaces, so we're having source tab-based and its size set to different size in one's IDE.

Code folding

Code is horizontally limited to 80 chars, so naturally some code folding must be done.
For functions in C files:

void fnShort(t1 arg1, t2 fnNameAndArgsFitInOneLine);

void fnWithManyArgs(
  t1 arg1, t2 arg2, t3 allArgsFitInOneLineButWithoutFnName
);

void fnWithTooManyArgs(
  t1 arg1, t2 arg2, t3 thereAreTooManyFnArgsToFitInOneLine,
  t4 arg4, t5 arg5, t6 soArgListIsBrokenToMultipleLines
);

Whereas in header files:

void fnVoid(void);

void fnNonVoid(
  t1 allArgsAre,
  t2 inSeparateLine
);

Other arg formatting stuff doesn't mix with variable tab size properly. So I guess it must stay this way.

Naming conventions

camelCase with prefixes. List of prefixes:

  • ub - unsigned byte (UBYTE, uint8_t)
  • uw - unsigned word (UWORD, uint16_t)
  • ul - unsigned long (ULONG, uint32_t)
    -b, w, l for signed variants
  • p - any pointer or array
  • cb - any function pointer (callback)
  • t - typedef
  • s - struct instance
  • u - union instance
  • f - float or fixed-point var
  • undecided prefixes for double, uint64_t

for global var scoping additionally:

  • g_ - global visible from other files
  • s_ - global visible from current file (static)

Misc stuff

  • all named structs and unions should be typedefed using following convention:
typedef struct _tTypeName {

} tTypeName;
  • in header files, args should be documented using IN, OUT and INOUT defines:
void fn(
  UBYTE ubSomeInput,
  UBYTE *pSomeMoreInputDataLikeArrayOrSomething,
  UBYTE *pContentsGetOverwrittenOrArrayToBeFilled,
  UBYTE *pContentsAreUsedInFnCalculationsAndThenModified
);
  • all fns in header files must be documented using DoxyComments. Functions which are not exported in headers should be documented in .c file

  • functions should be as short as possible. If needed, split function to multiple ones. There is no hard limit for fn length, but if it doesn't fit entirely on your screen then it's a good sign you're doing something wrong.

Include guards

Currently we use something like that:

#ifndef GUARD_ACE_MANAGER_BLIT_H
#define GUARD_ACE_MANAGER_BLIT_H

Candidate for replacement:

#ifndef _ACE_MANAGERS_BLIT_H_
#define _ACE_MANAGERS_BLIT_H_

Pros:

  • not flooding intellisense starting with "G"
  • reflects filesystem location: source file in inc/ace/managers/blit.h

Switch to FS based on monolithic file

Moved from #25 since it's currently not that critical but will be for moving to ROM-based platforms or squeezing into floppy. It would be cool to have an ability to work on plain file structure of host OS or on virtual FS based on monolithic file.

  • Determine lightweight, portable, virtual FS for such mode
  • Ability to enable monolithic FS with single define during compilation
  • Implement a tool to transform required file structure to monolithic bigfile
  • Add support for storage, also modifying (hi scores)

Before we introduce another custom file format, let's look at embedded systems for similar mature solutions. Perhaps SquashFS would do the job? Or is it too bloated?

Dust off scroll buffer & tile buffer managers

I guess this part of code is bugged and rotten since it wasn't touched for a long time.

needed for Last-Minute-Creations/openFire#5

Scroll buffer:

  • Migrate to taglist syntax
  • On scroll buffer, check if bobs are drawing correctly where bitmap folds (interleaved)

Tile buffer:

  • Migrate to taglist syntax
  • Fix initial draw
  • check if tiles are redrawing properly on draw margins (checked Y for AMiner)
  • fix garbage which appears during x-movement on Y wrap line - wasn't ACE's fault

Basic documentation

  • installing compiler
  • ACE in a nutshell: managers (create/destroy, open/close), utils
  • building ACE tools
  • Basics of Amiga hardware
    • Viewports
    • Why killing OS is good/necessary, drawbacks
  • setting up simple ACE project
    • get something on screen
    • pong using blitRect()
    • loading ball gfx
    • loading font
    • using hardware sprites
  • description of generic/main.h
  • System manager - when to call systemUse()/systemUnuse()
  • Logging - how to set up logging to console, how to enable file logs
  • Tile buffer manager
  • 4bpp attached sprites

Add interleaved bitmap support

Small interleaved bitmaps are blitter-friendly as they allow updating all bitplanes in single blit.

  • Bitmap util: create & destroy interleaved bitmaps. Also, function bitmapIsInterleaved() exists.
  • Initial support for blitting interleaved bitmaps exists.
  • Font util strongly uses single plane bitmaps to blit on multiplane bitmaps. Different code for interleaved is needed.
  • Viewport managers need interleaved code.

Game manager tweaks

  1. Remove pView field and viewLoad() stuff
    1. This code doesn't work anyway since gamestate struct's view is set to 0
    2. There may be gamestates which don't have their own view - such as pause menu displayed in border on game's main vport.
  2. gameDestroy() should call gamePopState() in a loop
    1. Less code to maintain
    2. Speed isn't crucial during gameDestroy()
  3. Remove fadeout remnants from code
    1. This should be shifted to gamestate implementation or viewport managers since in multi-viewport view with color-changing copperlist doing palette fade isn't trivial task.

Since @approxit is responsible for game manager, I'd like to see his opinion in the comments.

Copper manager process fn is partially broken

One could wonder, why there is so much commented code in copper's process function.

The idea was that copper manager would mark copperlist areas which were modified and then update only them. It mostly works, but sometimes it's not.

Additional experiments are needed to determine which cases are broken. In fixing this code, there lies a potentially big performance boost.

Add CMake support

Writing makefiles is a pain and having custom build environment is no way to go. We don't need another standards.

Having CMake build environment would bring Amiga coding to 21st century even more. Also, CMake is very flexible at including other libraries with CMakeLists.txt written for them. Also, it by default supports stuff like debug/release builds and allows passing build options to dependencies very easily. It is easily configured to keep track of changes in .h files so no more using make all.

The downside is that there is no Amiga port for CMake. Yet.

Implement memRealloc()

So std library has malloc, calloc and realloc. calloc is quite useless, but realloc would be nice.

I think it should only take new size as a parameter, since memory type is readable from source mem addr.

Implement custom FS function wrappers

There are no stdc functions for reading directories, so to omit POSIX lib dependency ACE needs its own directory fns based on OS fns.

Also, wrapping around fopen will give us ability to setup file access based on OS files/dirs or one monolithic big file. This will also reduce disk usage 'cuz Amiga FSs are inefficient as hell with many small files.

  • Implement directory fns with similar syntax to opendir / readdir / closedir
  • Wrap around file access fns: fopen, close, fseek, ftell, fread, fwrite

Add ability to work on plain file structure of host OS or on virtual FS based on monolithic file.

Separate keyboard & mouse processing

Currently processing mouse & keyboard are bound together by Intuition event loop. This prevents isolation of these two managers.

I guess the best way to do this would be getting mouse & keyboard events directly from HW, omitting Intuition code.

Unit tests

  • Determine unit test framework
  • Do some basic tests on easily testable functions
  • Generate coverage report
  • Create issues for testing problematic stuff (blitter)

Unit test framework

  • should have as little external dependencies as possible
  • shouldn't require build tools which ACE isn't supporting

Libfixmath's fix16_sin is inaccurate

Right now having sine table precalculated with floats is better.

2 things should be considered:

  • improving sin/cos approximation without greater calculation costs
  • removing fix16_sin and fix16_cos to force ppl to use tabled sin. Or enabling this fns after defining FIX16_I_KNOW_WHAT_IM_DOING or something
  • adding tool for easy sin/cos generation using floats with user-specified resolution. Watch out for endianness!

Also, this should be documented quite well.

GAME_DEBUG define as compile flag

Right now we have GAME_DEBUG flag hardcoded inside source files.
It's changes results in git. To make a prod you need to switch it's value on and off.

Better idea is to move this flag to compile flags.

Determine license

There are some options. MIT, BSD, Unlicense or GPL. Also, this decision may affect our prods' licenses.

Viral vs Non-viral (GPL)

Pros:

  • It would be cool to have more and more open source stuff on Amigas. GPL would enforce it.

Cons:

  • People may prefer using other dev tools which don't enforce opening their sources.
  • There are some ppl in retrodev who'd like to keep their sources closed
  • KaiN hates those mile-long comments on top of every source file
  • If we get other contributors that would mean tracing fn history in their respective comment blocks, so that each contributor gets credit for their work

Attribution vs non-attribution (BSD)

Pros:

  • Enforcing some kind of attribution in prod could bring more popularity to project

Cons:

  • Again, not everyone may be happy with such enforcement and such enforcement could play against us

MIT vs Unlicense

All cons mentioned above are irrelevant if we just use MIT/Unlicense.

MIT is just an info about author without any restrictions, so It's mostly cool. What isn't cool is that most licenses require list of authors who modified source files. I don't really like keeping up-to-date list of contributors in copyright notice. That's getting messy very quickly.

So I propose using unlicense - at first line text below becomes copyrighted, then all rights are passed to everyone who's reading. Since there are no rights to be cleaimed, it's irrelevant who's listed as author. And there are really more important things to do than looking after all that license bs.

Add basic bob implementation

Currently, bob mechanism must be written from scratch - it should be for most games, but there should be some means to prototype things and I guess that most implementations could have a common ancestor.

It should be mentioned that blitter could be set up using CPU or Copper - the latter option ensures constant blitter throughput.

Unify logging

  • Currently there is game.log and memory.log. Having mem logged in separate file makes it hard to determine where and when specifically given alloc is taking place.
  • To unify it into single file, we need something to differentiate mem and other stuff in clean and filterable/searchable way (as easy as ctrl+f). Also, game logging should be distinct from ACE stuff, but still in same file.
  • We lack standard means to print warnings and errors. Currently I mostly use WARN: and ERR: prefixes, but some messages aren't still conforming to this. When other contributions arrive, it's going to be even bigger mess. Having fns like logErr, logWarn and logInfo might be a good idea.
  • Log categories could be mutable (as in mute) so that reading logs would be easier. But it's something that can be bypassed by filtering.
  • Also, logs should have no footprint on release builds and be non-existent there.

Any ideas?


I've started doing this but needs further work, I think

  • move memory and general logging to same output
  • add ability to output to file or WinUAE debug console
  • add consistent log message types (warning, error, info, etc.)

Integrate fixed-point math

There are numerous mature fixed points projects out there, which could be integrated into ACE, e.g. https://github.com/PetteriAimonen/libfixmath/

Rationale: ACE has bitmap rotation fn, which requires fractional computations. Currently, it uses OS's float library, which implements software floats on non-fpu machines. This implementation is horribly slow and fixed points are always faster, even than hw fpu.

Tile editor compatibility

There are some online tile editors, so it would be cool if ACE would provide at least a bit of compatibility or even a guide about incorporating such tool into toolchain.

  • Provide a list of tile editors
  • Provide compatibility required to make most of them work out of box
  • Provide guides for interop with some of editors

Add font generator utility

Currently, I have php script for generating ACE fonts, but it's inconvenient and not portable way to do this. It needs C implementation without too many dependencies - should be working directly on ttf/otf and some popular bitmap font formats.

Perhaps it would be wise to use freetype amalgamated lib?


TODO

  • Generate 1bpp bitmap glyphs, each in separate PNG file, based on TTF
  • Generate ACE packed font in PNG file
  • Organize app so that it can use either TTF or PNGs as source
  • implement glyphsFromDir()
  • Generate ACE packed font
  • Add parameters for CLI & help screen

New bitmap struct type

Currently ACE uses OS version of bitmap struct, which has many flaws. Especially distinguishing whether bitmap is interleaved is nuts: BitMap: Interleaved mode.

Also, perhaps it would be good idea to attach bitmap mask at this level - either as another bitplane or as separate field.

Rewrite random number generation

Right now, there are two RNGS - one for 16-bit and one for 32-bit numbers. There's no need to that, since most of calc is 16-bit and 32-bit may be accomplished by joining two 16-bit random values.

Here's a nice xorshift.

68000's instruction is capable of shifting up to 8 bits in one operation (source) so we should use shifts lesser than 8.

Wiki vs "doc" folder

We should determine if we use wiki or docs folder. Here's some arguments against wiki.

If we're dropping wiki, relative links will come in handy.

  • Decide whether we use wiki or doc folder
  • Port all wiki content to doc folder, if wiki is going to be scrapped

Bebbo's GCC6 compatibility

It would be cool to have choice between VBCC and GCC6 supplied by Bebbo. There are some problems which break source compatibility:

  • Improve makefile to accept other CC than vbcc
  • Rewrite interrupt handlers to asm or ask Bebbo how to do them in GCC-compatible way. VBCC has amigainterrupt keyword, which GCC is lacking.
  • Fix keyboard processing in showcase on -O1 (on -O2 works)
  • Fix illegal blits on -O2 triggered by blitRect()

Add line drawing functions

Currently, there are no means to draw lines using blitter. Drawing vertical/horizontal lines using blitRect() is probably not fastest possible solution, and most certailny such usage is not intuitive.

Implementation could be based on Cahir's routine.

  • Add blitLine() or something
  • fix bugs

Improve mouse manager

Currently, mouse actions are collected using Intuition events. Also, current cursor codebase relies on OS stuff, which is conflicting with current custom copperlist implementation. There is a need to:

  • Modernize API by integrating cursor into copperlist,
  • Add ability to have 2 cursors on screen (vide Settlers split-screen mode),
  • Display as 3bpp or 4bpp sprite with configurable sprite channel index (indices),
  • Display as the only thing on sprite channel
  • Display as part of sprite list for channel
  • Grab cursor events directly for hardware - needed in #13

Rework bitmap file format.

  • Remove unused fields in header.
  • Add version field in header.
  • Add data format in header: planar, interleaved, chunky.
  • Support reads from all three modes with possible conversion to other type on the fly.

Implement fixed point type of other width

fix16_t is of 16.16 format, so it's 32-bit value. A500 & A600 have 16-bit data bus, so 8 and 16-bit vars are faster than 32-bit to fetch. Implementing fix8_t with format 8.8 analogous to fix16_t would speed things a bit at a cost of precision.

Implement double buffering in simple buffer manager

Double buffering is needed for drawing if you don't want to race the display beam.

Many years ago I had some clever idea of implementing double buffering as vport manager which could work regardless if one uses simple or scroll buffer, but right now I have no idea how that could work. The only remnant of this idea is in viewport manager priority list:

/**
 *  Viewport manager IDs.
 *  Number determines processing order. Camera is last, so rest may see
 *  a difference between its current and previous position
 */
#define VPM_SCROLL       0
#define VPM_TILEBUFFER   1
#define VPM_DOUBLEBUFFER 2
#define VPM_CAMERA       128

ace/config.h must go away

Currently, this file only contains extern consts containing screen size. This approach is unnecessary since ACE really supports only PAL modes atm and values other than 320/256 may yield unexpected results.

Sometimes screen dimensions are needed in code, so to make them more generic I propose adding generic/screen.h which would contain defines with PAL/NTSC screen boundaries, also hires/laced variants. Also, PAL/NTSC names will be more meaningful

Add ability to take over whole HW

To achieve best performance, it is crucial to be able to disable OS stuff completely, including multitasking. After removing Intuition-related code, there should be no blockers to achieve this.

  • Implement OS disabling and re-enabling
  • Force OS enabling for FS functions - needs #25
  • Make interrupt servers also register in OS so that keyboard is properly updated when OS is active - needed for tehKaiN/ld40-squared#1

Font-drawing functions to accept multiple strings?

So in openFire I'm implementing chat and there i have to draw something like: "%s: %s" consisting of nick and message. So it would be cool to be able to pass multiple strings to font draw fn so that I could avoid copying to same buffer:

fontDrawMultiStr(stuffForFont, stuffForBfr, n, ...)

It could be used in my case as:

fontDrawMultiStr(yadda, yadda, 3, szNick, ": ", szMsg)

I guess cpp streams would do the job here. ;) Still, dunno how many times this fn would be useful in other projects.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.